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.
|
|
|
|
|
2021-11-22 07:34:31 +00:00
|
|
|
#ifndef ELECTRON_SHELL_BROWSER_API_GPU_INFO_ENUMERATOR_H_
|
|
|
|
#define ELECTRON_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"
|
|
|
|
|
|
|
|
namespace electron {
|
|
|
|
|
|
|
|
// This class implements the enumerator for reading all the attributes in
|
|
|
|
// GPUInfo into a dictionary.
|
|
|
|
class GPUInfoEnumerator final : public gpu::GPUInfo::Enumerator {
|
2021-07-02 00:51:52 +00:00
|
|
|
const char* const kGPUDeviceKey = "gpuDevice";
|
|
|
|
const char* const kVideoDecodeAcceleratorSupportedProfileKey =
|
2018-09-27 14:59:23 +00:00
|
|
|
"videoDecodeAcceleratorSupportedProfile";
|
2021-07-02 00:51:52 +00:00
|
|
|
const char* const kVideoEncodeAcceleratorSupportedProfileKey =
|
2018-09-27 14:59:23 +00:00
|
|
|
"videoEncodeAcceleratorSupportedProfile";
|
2021-07-02 00:51:52 +00:00
|
|
|
const char* const kImageDecodeAcceleratorSupportedProfileKey =
|
2019-02-21 17:34:59 +00:00
|
|
|
"imageDecodeAcceleratorSupportedProfile";
|
2021-07-02 00:51:52 +00:00
|
|
|
const char* const kAuxAttributesKey = "auxAttributes";
|
|
|
|
const char* const kOverlayInfo = "overlayInfo";
|
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;
|
2020-03-03 21:35:05 +00:00
|
|
|
void BeginOverlayInfo() override;
|
|
|
|
void EndOverlayInfo() override;
|
2022-06-28 16:52:59 +00:00
|
|
|
base::Value::Dict GetDictionary();
|
2018-09-27 14:59:23 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
// The stack is used to manage nested values
|
2022-06-28 16:52:59 +00:00
|
|
|
std::stack<base::Value::Dict> value_stack_;
|
|
|
|
base::Value::Dict current_;
|
2018-09-27 14:59:23 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace electron
|
2021-11-22 07:34:31 +00:00
|
|
|
#endif // ELECTRON_SHELL_BROWSER_API_GPU_INFO_ENUMERATOR_H_
|