2018-09-27 14:59:23 +00:00
|
|
|
// Copyright (c) 2018 GitHub, Inc.
|
|
|
|
// Use of this source code is governed by the MIT license that can be
|
|
|
|
// found in the LICENSE file.
|
|
|
|
|
2019-06-19 20:56:58 +00:00
|
|
|
#ifndef SHELL_BROWSER_API_GPU_INFO_ENUMERATOR_H_
|
|
|
|
#define SHELL_BROWSER_API_GPU_INFO_ENUMERATOR_H_
|
2018-09-27 14:59:23 +00:00
|
|
|
|
|
|
|
#include <memory>
|
|
|
|
#include <stack>
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
#include "base/values.h"
|
|
|
|
#include "gpu/config/gpu_info.h"
|
|
|
|
|
2019-06-19 21:23:04 +00:00
|
|
|
namespace electron {
|
2018-09-27 14:59:23 +00:00
|
|
|
|
|
|
|
// This class implements the enumerator for reading all the attributes in
|
|
|
|
// GPUInfo into a dictionary.
|
|
|
|
class GPUInfoEnumerator final : public gpu::GPUInfo::Enumerator {
|
|
|
|
const char* kGPUDeviceKey = "gpuDevice";
|
|
|
|
const char* kVideoDecodeAcceleratorSupportedProfileKey =
|
|
|
|
"videoDecodeAcceleratorSupportedProfile";
|
|
|
|
const char* kVideoEncodeAcceleratorSupportedProfileKey =
|
|
|
|
"videoEncodeAcceleratorSupportedProfile";
|
2019-02-21 17:34:59 +00:00
|
|
|
const char* kImageDecodeAcceleratorSupportedProfileKey =
|
|
|
|
"imageDecodeAcceleratorSupportedProfile";
|
2018-09-27 14:59:23 +00:00
|
|
|
const char* kAuxAttributesKey = "auxAttributes";
|
2019-01-12 01:00:43 +00:00
|
|
|
const char* kDx12VulkanVersionInfoKey = "dx12VulkanVersionInfo";
|
2018-09-27 14:59:23 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
GPUInfoEnumerator();
|
|
|
|
~GPUInfoEnumerator() override;
|
|
|
|
void AddInt64(const char* name, int64_t value) override;
|
|
|
|
void AddInt(const char* name, int value) override;
|
|
|
|
void AddString(const char* name, const std::string& value) override;
|
|
|
|
void AddBool(const char* name, bool value) override;
|
|
|
|
void AddTimeDeltaInSecondsF(const char* name,
|
|
|
|
const base::TimeDelta& value) override;
|
2019-12-11 00:22:35 +00:00
|
|
|
void AddBinary(const char* name,
|
|
|
|
const base::span<const uint8_t>& value) override;
|
2018-09-27 14:59:23 +00:00
|
|
|
void BeginGPUDevice() override;
|
|
|
|
void EndGPUDevice() override;
|
|
|
|
void BeginVideoDecodeAcceleratorSupportedProfile() override;
|
|
|
|
void EndVideoDecodeAcceleratorSupportedProfile() override;
|
|
|
|
void BeginVideoEncodeAcceleratorSupportedProfile() override;
|
|
|
|
void EndVideoEncodeAcceleratorSupportedProfile() override;
|
2019-02-21 17:34:59 +00:00
|
|
|
void BeginImageDecodeAcceleratorSupportedProfile() override;
|
|
|
|
void EndImageDecodeAcceleratorSupportedProfile() override;
|
2018-09-27 14:59:23 +00:00
|
|
|
void BeginAuxAttributes() override;
|
|
|
|
void EndAuxAttributes() override;
|
2019-01-12 01:00:43 +00:00
|
|
|
void BeginDx12VulkanVersionInfo() override;
|
|
|
|
void EndDx12VulkanVersionInfo() override;
|
2018-09-27 14:59:23 +00:00
|
|
|
std::unique_ptr<base::DictionaryValue> GetDictionary();
|
|
|
|
|
|
|
|
private:
|
|
|
|
// The stack is used to manage nested values
|
|
|
|
std::stack<std::unique_ptr<base::DictionaryValue>> value_stack;
|
|
|
|
std::unique_ptr<base::DictionaryValue> current;
|
|
|
|
};
|
|
|
|
|
2019-06-19 21:23:04 +00:00
|
|
|
} // namespace electron
|
2019-06-19 20:56:58 +00:00
|
|
|
#endif // SHELL_BROWSER_API_GPU_INFO_ENUMERATOR_H_
|