gpu_info_enumerator.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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* kAuxAttributesKey = "auxAttributes";
  21. const char* kOverlayCapabilityKey = "overlayCapability";
  22. const char* kDx12VulkanVersionInfoKey = "dx12VulkanVersionInfo";
  23. public:
  24. GPUInfoEnumerator();
  25. ~GPUInfoEnumerator() override;
  26. void AddInt64(const char* name, int64_t value) override;
  27. void AddInt(const char* name, int value) override;
  28. void AddString(const char* name, const std::string& value) override;
  29. void AddBool(const char* name, bool value) override;
  30. void AddTimeDeltaInSecondsF(const char* name,
  31. const base::TimeDelta& value) override;
  32. void BeginGPUDevice() override;
  33. void EndGPUDevice() override;
  34. void BeginVideoDecodeAcceleratorSupportedProfile() override;
  35. void EndVideoDecodeAcceleratorSupportedProfile() override;
  36. void BeginVideoEncodeAcceleratorSupportedProfile() override;
  37. void EndVideoEncodeAcceleratorSupportedProfile() override;
  38. void BeginAuxAttributes() override;
  39. void EndAuxAttributes() override;
  40. void BeginOverlayCapability() override;
  41. void EndOverlayCapability() override;
  42. void BeginDx12VulkanVersionInfo() override;
  43. void EndDx12VulkanVersionInfo() override;
  44. std::unique_ptr<base::DictionaryValue> GetDictionary();
  45. private:
  46. // The stack is used to manage nested values
  47. std::stack<std::unique_ptr<base::DictionaryValue>> value_stack;
  48. std::unique_ptr<base::DictionaryValue> current;
  49. };
  50. } // namespace atom
  51. #endif // ATOM_BROWSER_API_GPU_INFO_ENUMERATOR_H_