| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/browser/devtools/devtools_system_info_handler.h" | 5 #include "content/browser/devtools/devtools_system_info_handler.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/values.h" | 9 #include "base/values.h" |
| 10 #include "content/browser/devtools/devtools_protocol_constants.h" | 10 #include "content/browser/devtools/devtools_protocol_constants.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 const char kModelVersion[] = "modelVersion"; | 27 const char kModelVersion[] = "modelVersion"; |
| 28 const char kVendorId[] = "vendorId"; | 28 const char kVendorId[] = "vendorId"; |
| 29 const char kVendorString[] = "vendorString"; | 29 const char kVendorString[] = "vendorString"; |
| 30 | 30 |
| 31 class AuxGPUInfoEnumerator : public gpu::GPUInfo::Enumerator { | 31 class AuxGPUInfoEnumerator : public gpu::GPUInfo::Enumerator { |
| 32 public: | 32 public: |
| 33 AuxGPUInfoEnumerator(base::DictionaryValue* dictionary) | 33 AuxGPUInfoEnumerator(base::DictionaryValue* dictionary) |
| 34 : dictionary_(dictionary), | 34 : dictionary_(dictionary), |
| 35 in_aux_attributes_(false) { } | 35 in_aux_attributes_(false) { } |
| 36 | 36 |
| 37 virtual void AddInt64(const char* name, int64 value) override { | 37 void AddInt64(const char* name, int64 value) override { |
| 38 if (in_aux_attributes_) | 38 if (in_aux_attributes_) |
| 39 dictionary_->SetDouble(name, value); | 39 dictionary_->SetDouble(name, value); |
| 40 } | 40 } |
| 41 | 41 |
| 42 virtual void AddInt(const char* name, int value) override { | 42 void AddInt(const char* name, int value) override { |
| 43 if (in_aux_attributes_) | 43 if (in_aux_attributes_) |
| 44 dictionary_->SetInteger(name, value); | 44 dictionary_->SetInteger(name, value); |
| 45 } | 45 } |
| 46 | 46 |
| 47 virtual void AddString(const char* name, const std::string& value) override { | 47 void AddString(const char* name, const std::string& value) override { |
| 48 if (in_aux_attributes_) | 48 if (in_aux_attributes_) |
| 49 dictionary_->SetString(name, value); | 49 dictionary_->SetString(name, value); |
| 50 } | 50 } |
| 51 | 51 |
| 52 virtual void AddBool(const char* name, bool value) override { | 52 void AddBool(const char* name, bool value) override { |
| 53 if (in_aux_attributes_) | 53 if (in_aux_attributes_) |
| 54 dictionary_->SetBoolean(name, value); | 54 dictionary_->SetBoolean(name, value); |
| 55 } | 55 } |
| 56 | 56 |
| 57 virtual void AddTimeDeltaInSecondsF(const char* name, | 57 void AddTimeDeltaInSecondsF(const char* name, |
| 58 const base::TimeDelta& value) override { | 58 const base::TimeDelta& value) override { |
| 59 if (in_aux_attributes_) | 59 if (in_aux_attributes_) |
| 60 dictionary_->SetDouble(name, value.InSecondsF()); | 60 dictionary_->SetDouble(name, value.InSecondsF()); |
| 61 } | 61 } |
| 62 | 62 |
| 63 virtual void BeginGPUDevice() override { | 63 void BeginGPUDevice() override {} |
| 64 } | |
| 65 | 64 |
| 66 virtual void EndGPUDevice() override { | 65 void EndGPUDevice() override {} |
| 67 } | |
| 68 | 66 |
| 69 virtual void BeginVideoEncodeAcceleratorSupportedProfile() override {} | 67 void BeginVideoEncodeAcceleratorSupportedProfile() override {} |
| 70 | 68 |
| 71 virtual void EndVideoEncodeAcceleratorSupportedProfile() override {} | 69 void EndVideoEncodeAcceleratorSupportedProfile() override {} |
| 72 | 70 |
| 73 virtual void BeginAuxAttributes() override { | 71 void BeginAuxAttributes() override { in_aux_attributes_ = true; } |
| 74 in_aux_attributes_ = true; | |
| 75 } | |
| 76 | 72 |
| 77 virtual void EndAuxAttributes() override { | 73 void EndAuxAttributes() override { in_aux_attributes_ = false; } |
| 78 in_aux_attributes_ = false; | |
| 79 } | |
| 80 | 74 |
| 81 private: | 75 private: |
| 82 base::DictionaryValue* dictionary_; | 76 base::DictionaryValue* dictionary_; |
| 83 bool in_aux_attributes_; | 77 bool in_aux_attributes_; |
| 84 }; | 78 }; |
| 85 | 79 |
| 86 base::DictionaryValue* GPUDeviceToDictionary( | 80 base::DictionaryValue* GPUDeviceToDictionary( |
| 87 const gpu::GPUInfo::GPUDevice& device) { | 81 const gpu::GPUInfo::GPUDevice& device) { |
| 88 base::DictionaryValue* result = new base::DictionaryValue; | 82 base::DictionaryValue* result = new base::DictionaryValue; |
| 89 result->SetInteger(kVendorId, device.vendor_id); | 83 result->SetInteger(kVendorId, device.vendor_id); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 gpu_dict->Set(kDriverBugWorkarounds, GetDriverBugWorkarounds()); | 121 gpu_dict->Set(kDriverBugWorkarounds, GetDriverBugWorkarounds()); |
| 128 | 122 |
| 129 base::DictionaryValue* system_dict = new base::DictionaryValue; | 123 base::DictionaryValue* system_dict = new base::DictionaryValue; |
| 130 system_dict->SetString(kModelName, gpu_info.machine_model_name); | 124 system_dict->SetString(kModelName, gpu_info.machine_model_name); |
| 131 system_dict->SetString(kModelVersion, gpu_info.machine_model_version); | 125 system_dict->SetString(kModelVersion, gpu_info.machine_model_version); |
| 132 system_dict->Set(kGPU, gpu_dict); | 126 system_dict->Set(kGPU, gpu_dict); |
| 133 return command->SuccessResponse(system_dict); | 127 return command->SuccessResponse(system_dict); |
| 134 } | 128 } |
| 135 | 129 |
| 136 } // namespace content | 130 } // namespace content |
| OLD | NEW |