OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/gpu/gpu_internals_ui.h" | 5 #include "content/browser/gpu/gpu_internals_ui.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 #include <string> | 10 #include <string> |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 vendor.c_str(), device.c_str(), gpu.active ? " *ACTIVE*" : ""); | 120 vendor.c_str(), device.c_str(), gpu.active ? " *ACTIVE*" : ""); |
121 } | 121 } |
122 | 122 |
123 base::DictionaryValue* GpuInfoAsDictionaryValue() { | 123 base::DictionaryValue* GpuInfoAsDictionaryValue() { |
124 gpu::GPUInfo gpu_info = GpuDataManagerImpl::GetInstance()->GetGPUInfo(); | 124 gpu::GPUInfo gpu_info = GpuDataManagerImpl::GetInstance()->GetGPUInfo(); |
125 base::ListValue* basic_info = new base::ListValue(); | 125 base::ListValue* basic_info = new base::ListValue(); |
126 basic_info->Append(NewDescriptionValuePair( | 126 basic_info->Append(NewDescriptionValuePair( |
127 "Initialization time", | 127 "Initialization time", |
128 base::Int64ToString(gpu_info.initialization_time.InMilliseconds()))); | 128 base::Int64ToString(gpu_info.initialization_time.InMilliseconds()))); |
129 basic_info->Append(NewDescriptionValuePair( | 129 basic_info->Append(NewDescriptionValuePair( |
130 "In-process GPU", new base::FundamentalValue(gpu_info.in_process_gpu))); | 130 "In-process GPU", new base::Value(gpu_info.in_process_gpu))); |
131 basic_info->Append(NewDescriptionValuePair( | 131 basic_info->Append(NewDescriptionValuePair( |
132 "Passthrough Command Decoder", | 132 "Passthrough Command Decoder", |
133 new base::FundamentalValue(gpu_info.passthrough_cmd_decoder))); | 133 new base::Value(gpu_info.passthrough_cmd_decoder))); |
134 basic_info->Append(NewDescriptionValuePair( | 134 basic_info->Append(NewDescriptionValuePair( |
135 "Sandboxed", new base::FundamentalValue(gpu_info.sandboxed))); | 135 "Sandboxed", new base::Value(gpu_info.sandboxed))); |
136 basic_info->Append(NewDescriptionValuePair( | 136 basic_info->Append(NewDescriptionValuePair( |
137 "GPU0", GPUDeviceToString(gpu_info.gpu))); | 137 "GPU0", GPUDeviceToString(gpu_info.gpu))); |
138 for (size_t i = 0; i < gpu_info.secondary_gpus.size(); ++i) { | 138 for (size_t i = 0; i < gpu_info.secondary_gpus.size(); ++i) { |
139 basic_info->Append(NewDescriptionValuePair( | 139 basic_info->Append(NewDescriptionValuePair( |
140 base::StringPrintf("GPU%d", static_cast<int>(i + 1)), | 140 base::StringPrintf("GPU%d", static_cast<int>(i + 1)), |
141 GPUDeviceToString(gpu_info.secondary_gpus[i]))); | 141 GPUDeviceToString(gpu_info.secondary_gpus[i]))); |
142 } | 142 } |
| 143 basic_info->Append( |
| 144 NewDescriptionValuePair("Optimus", new base::Value(gpu_info.optimus))); |
| 145 basic_info->Append( |
| 146 NewDescriptionValuePair("Optimus", new base::Value(gpu_info.optimus))); |
143 basic_info->Append(NewDescriptionValuePair( | 147 basic_info->Append(NewDescriptionValuePair( |
144 "Optimus", new base::FundamentalValue(gpu_info.optimus))); | 148 "AMD switchable", new base::Value(gpu_info.amd_switchable))); |
145 basic_info->Append(NewDescriptionValuePair( | |
146 "AMD switchable", new base::FundamentalValue(gpu_info.amd_switchable))); | |
147 #if defined(OS_WIN) | 149 #if defined(OS_WIN) |
148 std::string compositor = | 150 std::string compositor = |
149 ui::win::IsAeroGlassEnabled() ? "Aero Glass" : "none"; | 151 ui::win::IsAeroGlassEnabled() ? "Aero Glass" : "none"; |
150 basic_info->Append( | 152 basic_info->Append( |
151 NewDescriptionValuePair("Desktop compositing", compositor)); | 153 NewDescriptionValuePair("Desktop compositing", compositor)); |
152 | 154 |
153 std::vector<gfx::PhysicalDisplaySize> display_sizes = | 155 std::vector<gfx::PhysicalDisplaySize> display_sizes = |
154 gfx::GetPhysicalSizeForDisplays(); | 156 gfx::GetPhysicalSizeForDisplays(); |
155 for (const auto& display_size : display_sizes) { | 157 for (const auto& display_size : display_sizes) { |
156 const int w = display_size.width_mm; | 158 const int w = display_size.width_mm; |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 #endif | 230 #endif |
229 std::string direct_rendering = gpu_info.direct_rendering ? "Yes" : "No"; | 231 std::string direct_rendering = gpu_info.direct_rendering ? "Yes" : "No"; |
230 basic_info->Append( | 232 basic_info->Append( |
231 NewDescriptionValuePair("Direct rendering", direct_rendering)); | 233 NewDescriptionValuePair("Direct rendering", direct_rendering)); |
232 | 234 |
233 std::string reset_strategy = | 235 std::string reset_strategy = |
234 base::StringPrintf("0x%04x", gpu_info.gl_reset_notification_strategy); | 236 base::StringPrintf("0x%04x", gpu_info.gl_reset_notification_strategy); |
235 basic_info->Append(NewDescriptionValuePair( | 237 basic_info->Append(NewDescriptionValuePair( |
236 "Reset notification strategy", reset_strategy)); | 238 "Reset notification strategy", reset_strategy)); |
237 | 239 |
238 basic_info->Append(NewDescriptionValuePair( | 240 basic_info->Append( |
239 "GPU process crash count", | 241 NewDescriptionValuePair("GPU process crash count", |
240 new base::FundamentalValue(gpu_info.process_crash_count))); | 242 new base::Value(gpu_info.process_crash_count))); |
241 | 243 |
242 base::DictionaryValue* info = new base::DictionaryValue(); | 244 base::DictionaryValue* info = new base::DictionaryValue(); |
243 info->Set("basic_info", basic_info); | 245 info->Set("basic_info", basic_info); |
244 | 246 |
245 #if defined(OS_WIN) | 247 #if defined(OS_WIN) |
246 std::unique_ptr<base::Value> dx_info = base::Value::CreateNullValue(); | 248 std::unique_ptr<base::Value> dx_info = base::Value::CreateNullValue(); |
247 if (gpu_info.dx_diagnostics.children.size()) | 249 if (gpu_info.dx_diagnostics.children.size()) |
248 dx_info.reset(DxDiagNodeToList(gpu_info.dx_diagnostics)); | 250 dx_info.reset(DxDiagNodeToList(gpu_info.dx_diagnostics)); |
249 info->Set("diagnostics", std::move(dx_info)); | 251 info->Set("diagnostics", std::move(dx_info)); |
250 #endif | 252 #endif |
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
554 : WebUIController(web_ui) { | 556 : WebUIController(web_ui) { |
555 web_ui->AddMessageHandler(base::MakeUnique<GpuMessageHandler>()); | 557 web_ui->AddMessageHandler(base::MakeUnique<GpuMessageHandler>()); |
556 | 558 |
557 // Set up the chrome://gpu/ source. | 559 // Set up the chrome://gpu/ source. |
558 BrowserContext* browser_context = | 560 BrowserContext* browser_context = |
559 web_ui->GetWebContents()->GetBrowserContext(); | 561 web_ui->GetWebContents()->GetBrowserContext(); |
560 WebUIDataSource::Add(browser_context, CreateGpuHTMLSource()); | 562 WebUIDataSource::Add(browser_context, CreateGpuHTMLSource()); |
561 } | 563 } |
562 | 564 |
563 } // namespace content | 565 } // namespace content |
OLD | NEW |