2018-09-27 07:59:23 -07: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 13:56:58 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#ifndef SHELL_BROWSER_API_GPU_INFO_ENUMERATOR_H_
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#define SHELL_BROWSER_API_GPU_INFO_ENUMERATOR_H_
							 | 
						
					
						
							
								
									
										
										
										
											2018-09-27 07:59:23 -07:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#include <memory>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#include <stack>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#include <string>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#include "base/values.h"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#include "gpu/config/gpu_info.h"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2019-06-19 14:23:04 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								namespace electron {
							 | 
						
					
						
							
								
									
										
										
										
											2018-09-27 07:59:23 -07:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								// This class implements the enumerator for reading all the attributes in
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								// GPUInfo into a dictionary.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								class GPUInfoEnumerator final : public gpu::GPUInfo::Enumerator {
							 | 
						
					
						
							
								
									
										
										
										
											2021-07-01 17:51:52 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  const char* const kGPUDeviceKey = "gpuDevice";
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  const char* const kVideoDecodeAcceleratorSupportedProfileKey =
							 | 
						
					
						
							
								
									
										
										
										
											2018-09-27 07:59:23 -07:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      "videoDecodeAcceleratorSupportedProfile";
							 | 
						
					
						
							
								
									
										
										
										
											2021-07-01 17:51:52 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  const char* const kVideoEncodeAcceleratorSupportedProfileKey =
							 | 
						
					
						
							
								
									
										
										
										
											2018-09-27 07:59:23 -07:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      "videoEncodeAcceleratorSupportedProfile";
							 | 
						
					
						
							
								
									
										
										
										
											2021-07-01 17:51:52 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  const char* const kImageDecodeAcceleratorSupportedProfileKey =
							 | 
						
					
						
							
								
									
										
										
										
											2019-02-21 23:04:59 +05:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      "imageDecodeAcceleratorSupportedProfile";
							 | 
						
					
						
							
								
									
										
										
										
											2021-07-01 17:51:52 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  const char* const kAuxAttributesKey = "auxAttributes";
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  const char* const kOverlayInfo = "overlayInfo";
							 | 
						
					
						
							
								
									
										
										
										
											2018-09-27 07:59:23 -07: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-10 16:22:35 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  void AddBinary(const char* name,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                 const base::span<const uint8_t>& value) override;
							 | 
						
					
						
							
								
									
										
										
										
											2018-09-27 07:59:23 -07:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  void BeginGPUDevice() override;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  void EndGPUDevice() override;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  void BeginVideoDecodeAcceleratorSupportedProfile() override;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  void EndVideoDecodeAcceleratorSupportedProfile() override;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  void BeginVideoEncodeAcceleratorSupportedProfile() override;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  void EndVideoEncodeAcceleratorSupportedProfile() override;
							 | 
						
					
						
							
								
									
										
										
										
											2019-02-21 23:04:59 +05:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  void BeginImageDecodeAcceleratorSupportedProfile() override;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  void EndImageDecodeAcceleratorSupportedProfile() override;
							 | 
						
					
						
							
								
									
										
										
										
											2018-09-27 07:59:23 -07:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  void BeginAuxAttributes() override;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  void EndAuxAttributes() override;
							 | 
						
					
						
							
								
									
										
										
										
											2020-03-03 13:35:05 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  void BeginOverlayInfo() override;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  void EndOverlayInfo() override;
							 | 
						
					
						
							
								
									
										
										
										
											2018-09-27 07:59:23 -07: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 14:23:04 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								}  // namespace electron
							 | 
						
					
						
							
								
									
										
										
										
											2019-06-19 13:56:58 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#endif  // SHELL_BROWSER_API_GPU_INFO_ENUMERATOR_H_
							 |