gpu_info_enumerator.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. // Copyright (c) 2018 GitHub, Inc.
  2. // Use of this source code is governed by the MIT license that can be
  3. // found in the LICENSE file.
  4. #ifndef ATOM_BROWSER_API_GPU_INFO_ENUMERATOR_H_
  5. #define ATOM_BROWSER_API_GPU_INFO_ENUMERATOR_H_
  6. #include <memory>
  7. #include <stack>
  8. #include <string>
  9. #include "base/values.h"
  10. #include "gpu/config/gpu_info.h"
  11. namespace atom {
  12. // This class implements the enumerator for reading all the attributes in
  13. // GPUInfo into a dictionary.
  14. class GPUInfoEnumerator final : public gpu::GPUInfo::Enumerator {
  15. const char* kGPUDeviceKey = "gpuDevice";
  16. const char* kVideoDecodeAcceleratorSupportedProfileKey =
  17. "videoDecodeAcceleratorSupportedProfile";
  18. const char* kVideoEncodeAcceleratorSupportedProfileKey =
  19. "videoEncodeAcceleratorSupportedProfile";
  20. const char* kImageDecodeAcceleratorSupportedProfileKey =
  21. "imageDecodeAcceleratorSupportedProfile";
  22. const char* kAuxAttributesKey = "auxAttributes";
  23. const char* kDx12VulkanVersionInfoKey = "dx12VulkanVersionInfo";
  24. public:
  25. GPUInfoEnumerator();
  26. ~GPUInfoEnumerator() override;
  27. void AddInt64(const char* name, int64_t value) override;
  28. void AddInt(const char* name, int value) override;
  29. void AddString(const char* name, const std::string& value) override;
  30. void AddBool(const char* name, bool value) override;
  31. void AddTimeDeltaInSecondsF(const char* name,
  32. const base::TimeDelta& value) override;
  33. void BeginGPUDevice() override;
  34. void EndGPUDevice() override;
  35. void BeginVideoDecodeAcceleratorSupportedProfile() override;
  36. void EndVideoDecodeAcceleratorSupportedProfile() override;
  37. void BeginVideoEncodeAcceleratorSupportedProfile() override;
  38. void EndVideoEncodeAcceleratorSupportedProfile() override;
  39. void BeginImageDecodeAcceleratorSupportedProfile() override;
  40. void EndImageDecodeAcceleratorSupportedProfile() override;
  41. void BeginAuxAttributes() override;
  42. void EndAuxAttributes() override;
  43. void BeginDx12VulkanVersionInfo() override;
  44. void EndDx12VulkanVersionInfo() override;
  45. std::unique_ptr<base::DictionaryValue> GetDictionary();
  46. private:
  47. // The stack is used to manage nested values
  48. std::stack<std::unique_ptr<base::DictionaryValue>> value_stack;
  49. std::unique_ptr<base::DictionaryValue> current;
  50. };
  51. } // namespace atom
  52. #endif // ATOM_BROWSER_API_GPU_INFO_ENUMERATOR_H_