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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 const std::string& desc, | 73 const std::string& desc, |
74 const std::string& value) { | 74 const std::string& value) { |
75 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); | 75 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); |
76 dict->SetString("description", desc); | 76 dict->SetString("description", desc); |
77 dict->SetString("value", value); | 77 dict->SetString("value", value); |
78 return dict; | 78 return dict; |
79 } | 79 } |
80 | 80 |
81 std::unique_ptr<base::DictionaryValue> NewDescriptionValuePair( | 81 std::unique_ptr<base::DictionaryValue> NewDescriptionValuePair( |
82 const std::string& desc, | 82 const std::string& desc, |
83 base::Value* value) { | 83 std::unique_ptr<base::Value> value) { |
84 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); | 84 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); |
85 dict->SetString("description", desc); | 85 dict->SetString("description", desc); |
86 dict->Set("value", value); | 86 dict->Set("value", std::move(value)); |
87 return dict; | 87 return dict; |
88 } | 88 } |
89 | 89 |
90 #if defined(OS_WIN) | 90 #if defined(OS_WIN) |
91 // Output DxDiagNode tree as nested array of {description,value} pairs | 91 // Output DxDiagNode tree as nested array of {description,value} pairs |
92 base::ListValue* DxDiagNodeToList(const gpu::DxDiagNode& node) { | 92 std::unique_ptr<base::ListValue> DxDiagNodeToList(const gpu::DxDiagNode& node) { |
93 base::ListValue* list = new base::ListValue(); | 93 auto list = base::MakeUnique<base::ListValue>(); |
94 for (std::map<std::string, std::string>::const_iterator it = | 94 for (std::map<std::string, std::string>::const_iterator it = |
95 node.values.begin(); | 95 node.values.begin(); |
96 it != node.values.end(); | 96 it != node.values.end(); |
97 ++it) { | 97 ++it) { |
98 list->Append(NewDescriptionValuePair(it->first, it->second)); | 98 list->Append(NewDescriptionValuePair(it->first, it->second)); |
99 } | 99 } |
100 | 100 |
101 for (std::map<std::string, gpu::DxDiagNode>::const_iterator it = | 101 for (std::map<std::string, gpu::DxDiagNode>::const_iterator it = |
102 node.children.begin(); | 102 node.children.begin(); |
103 it != node.children.end(); | 103 it != node.children.end(); |
104 ++it) { | 104 ++it) { |
105 base::ListValue* sublist = DxDiagNodeToList(it->second); | 105 std::unique_ptr<base::ListValue> sublist = DxDiagNodeToList(it->second); |
106 list->Append(NewDescriptionValuePair(it->first, sublist)); | 106 list->Append(NewDescriptionValuePair(it->first, std::move(sublist))); |
107 } | 107 } |
108 return list; | 108 return list; |
109 } | 109 } |
110 #endif | 110 #endif |
111 | 111 |
112 std::string GPUDeviceToString(const gpu::GPUInfo::GPUDevice& gpu) { | 112 std::string GPUDeviceToString(const gpu::GPUInfo::GPUDevice& gpu) { |
113 std::string vendor = base::StringPrintf("0x%04x", gpu.vendor_id); | 113 std::string vendor = base::StringPrintf("0x%04x", gpu.vendor_id); |
114 if (!gpu.vendor_string.empty()) | 114 if (!gpu.vendor_string.empty()) |
115 vendor += " [" + gpu.vendor_string + "]"; | 115 vendor += " [" + gpu.vendor_string + "]"; |
116 std::string device = base::StringPrintf("0x%04x", gpu.device_id); | 116 std::string device = base::StringPrintf("0x%04x", gpu.device_id); |
117 if (!gpu.device_string.empty()) | 117 if (!gpu.device_string.empty()) |
118 device += " [" + gpu.device_string + "]"; | 118 device += " [" + gpu.device_string + "]"; |
119 return base::StringPrintf("VENDOR = %s, DEVICE= %s%s", | 119 return base::StringPrintf("VENDOR = %s, DEVICE= %s%s", |
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 std::unique_ptr<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 auto basic_info = base::MakeUnique<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::Value(gpu_info.in_process_gpu))); | 130 "In-process GPU", |
| 131 base::MakeUnique<base::Value>(gpu_info.in_process_gpu))); |
131 basic_info->Append(NewDescriptionValuePair( | 132 basic_info->Append(NewDescriptionValuePair( |
132 "Passthrough Command Decoder", | 133 "Passthrough Command Decoder", |
133 new base::Value(gpu_info.passthrough_cmd_decoder))); | 134 base::MakeUnique<base::Value>(gpu_info.passthrough_cmd_decoder))); |
134 basic_info->Append(NewDescriptionValuePair( | 135 basic_info->Append(NewDescriptionValuePair( |
135 "Supports overlays", new base::Value(gpu_info.supports_overlays))); | 136 "Supports overlays", |
| 137 base::MakeUnique<base::Value>(gpu_info.supports_overlays))); |
136 basic_info->Append(NewDescriptionValuePair( | 138 basic_info->Append(NewDescriptionValuePair( |
137 "Sandboxed", new base::Value(gpu_info.sandboxed))); | 139 "Sandboxed", base::MakeUnique<base::Value>(gpu_info.sandboxed))); |
138 basic_info->Append(NewDescriptionValuePair( | 140 basic_info->Append(NewDescriptionValuePair( |
139 "GPU0", GPUDeviceToString(gpu_info.gpu))); | 141 "GPU0", GPUDeviceToString(gpu_info.gpu))); |
140 for (size_t i = 0; i < gpu_info.secondary_gpus.size(); ++i) { | 142 for (size_t i = 0; i < gpu_info.secondary_gpus.size(); ++i) { |
141 basic_info->Append(NewDescriptionValuePair( | 143 basic_info->Append(NewDescriptionValuePair( |
142 base::StringPrintf("GPU%d", static_cast<int>(i + 1)), | 144 base::StringPrintf("GPU%d", static_cast<int>(i + 1)), |
143 GPUDeviceToString(gpu_info.secondary_gpus[i]))); | 145 GPUDeviceToString(gpu_info.secondary_gpus[i]))); |
144 } | 146 } |
145 basic_info->Append( | |
146 NewDescriptionValuePair("Optimus", new base::Value(gpu_info.optimus))); | |
147 basic_info->Append( | |
148 NewDescriptionValuePair("Optimus", new base::Value(gpu_info.optimus))); | |
149 basic_info->Append(NewDescriptionValuePair( | 147 basic_info->Append(NewDescriptionValuePair( |
150 "AMD switchable", new base::Value(gpu_info.amd_switchable))); | 148 "Optimus", base::MakeUnique<base::Value>(gpu_info.optimus))); |
| 149 basic_info->Append(NewDescriptionValuePair( |
| 150 "Optimus", base::MakeUnique<base::Value>(gpu_info.optimus))); |
| 151 basic_info->Append(NewDescriptionValuePair( |
| 152 "AMD switchable", |
| 153 base::MakeUnique<base::Value>(gpu_info.amd_switchable))); |
151 #if defined(OS_WIN) | 154 #if defined(OS_WIN) |
152 std::string compositor = | 155 std::string compositor = |
153 ui::win::IsAeroGlassEnabled() ? "Aero Glass" : "none"; | 156 ui::win::IsAeroGlassEnabled() ? "Aero Glass" : "none"; |
154 basic_info->Append( | 157 basic_info->Append( |
155 NewDescriptionValuePair("Desktop compositing", compositor)); | 158 NewDescriptionValuePair("Desktop compositing", compositor)); |
156 | 159 |
157 std::vector<gfx::PhysicalDisplaySize> display_sizes = | 160 std::vector<gfx::PhysicalDisplaySize> display_sizes = |
158 gfx::GetPhysicalSizeForDisplays(); | 161 gfx::GetPhysicalSizeForDisplays(); |
159 for (const auto& display_size : display_sizes) { | 162 for (const auto& display_size : display_sizes) { |
160 const int w = display_size.width_mm; | 163 const int w = display_size.width_mm; |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 #endif | 228 #endif |
226 std::string direct_rendering = gpu_info.direct_rendering ? "Yes" : "No"; | 229 std::string direct_rendering = gpu_info.direct_rendering ? "Yes" : "No"; |
227 basic_info->Append( | 230 basic_info->Append( |
228 NewDescriptionValuePair("Direct rendering", direct_rendering)); | 231 NewDescriptionValuePair("Direct rendering", direct_rendering)); |
229 | 232 |
230 std::string reset_strategy = | 233 std::string reset_strategy = |
231 base::StringPrintf("0x%04x", gpu_info.gl_reset_notification_strategy); | 234 base::StringPrintf("0x%04x", gpu_info.gl_reset_notification_strategy); |
232 basic_info->Append(NewDescriptionValuePair( | 235 basic_info->Append(NewDescriptionValuePair( |
233 "Reset notification strategy", reset_strategy)); | 236 "Reset notification strategy", reset_strategy)); |
234 | 237 |
235 basic_info->Append( | 238 basic_info->Append(NewDescriptionValuePair( |
236 NewDescriptionValuePair("GPU process crash count", | 239 "GPU process crash count", |
237 new base::Value(gpu_info.process_crash_count))); | 240 base::MakeUnique<base::Value>(gpu_info.process_crash_count))); |
238 | 241 |
239 base::DictionaryValue* info = new base::DictionaryValue(); | 242 auto info = base::MakeUnique<base::DictionaryValue>(); |
240 info->Set("basic_info", basic_info); | |
241 | 243 |
242 #if defined(OS_WIN) | 244 #if defined(OS_WIN) |
243 auto dx_info = base::MakeUnique<base::Value>(); | 245 auto dx_info = base::MakeUnique<base::Value>(); |
244 if (gpu_info.dx_diagnostics.children.size()) | 246 if (gpu_info.dx_diagnostics.children.size()) |
245 dx_info.reset(DxDiagNodeToList(gpu_info.dx_diagnostics)); | 247 dx_info = DxDiagNodeToList(gpu_info.dx_diagnostics); |
246 info->Set("diagnostics", std::move(dx_info)); | 248 info->Set("diagnostics", std::move(dx_info)); |
247 #endif | 249 #endif |
248 | 250 |
249 #if defined(USE_X11) && !defined(OS_CHROMEOS) | 251 #if defined(USE_X11) && !defined(OS_CHROMEOS) |
250 basic_info->Append(NewDescriptionValuePair( | 252 basic_info->Append(NewDescriptionValuePair( |
251 "System visual ID", base::Uint64ToString(gpu_info.system_visual))); | 253 "System visual ID", base::Uint64ToString(gpu_info.system_visual))); |
252 basic_info->Append(NewDescriptionValuePair( | 254 basic_info->Append(NewDescriptionValuePair( |
253 "RGBA visual ID", base::Uint64ToString(gpu_info.rgba_visual))); | 255 "RGBA visual ID", base::Uint64ToString(gpu_info.rgba_visual))); |
254 #endif | 256 #endif |
255 | 257 |
| 258 info->Set("basic_info", std::move(basic_info)); |
256 return info; | 259 return info; |
257 } | 260 } |
258 | 261 |
259 const char* BufferFormatToString(gfx::BufferFormat format) { | 262 const char* BufferFormatToString(gfx::BufferFormat format) { |
260 switch (format) { | 263 switch (format) { |
261 case gfx::BufferFormat::ATC: | 264 case gfx::BufferFormat::ATC: |
262 return "ATC"; | 265 return "ATC"; |
263 case gfx::BufferFormat::ATCIA: | 266 case gfx::BufferFormat::ATCIA: |
264 return "ATCIA"; | 267 return "ATCIA"; |
265 case gfx::BufferFormat::DXT1: | 268 case gfx::BufferFormat::DXT1: |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 return "SCANOUT_CPU_READ_WRITE"; | 310 return "SCANOUT_CPU_READ_WRITE"; |
308 case gfx::BufferUsage::GPU_READ_CPU_READ_WRITE: | 311 case gfx::BufferUsage::GPU_READ_CPU_READ_WRITE: |
309 return "GPU_READ_CPU_READ_WRITE"; | 312 return "GPU_READ_CPU_READ_WRITE"; |
310 case gfx::BufferUsage::GPU_READ_CPU_READ_WRITE_PERSISTENT: | 313 case gfx::BufferUsage::GPU_READ_CPU_READ_WRITE_PERSISTENT: |
311 return "GPU_READ_CPU_READ_WRITE_PERSISTENT"; | 314 return "GPU_READ_CPU_READ_WRITE_PERSISTENT"; |
312 } | 315 } |
313 NOTREACHED(); | 316 NOTREACHED(); |
314 return nullptr; | 317 return nullptr; |
315 } | 318 } |
316 | 319 |
317 base::ListValue* CompositorInfo() { | 320 std::unique_ptr<base::ListValue> CompositorInfo() { |
318 base::ListValue* compositor_info = new base::ListValue(); | 321 auto compositor_info = base::MakeUnique<base::ListValue>(); |
319 | 322 |
320 compositor_info->Append(NewDescriptionValuePair( | 323 compositor_info->Append(NewDescriptionValuePair( |
321 "Tile Update Mode", | 324 "Tile Update Mode", |
322 IsZeroCopyUploadEnabled() ? "Zero-copy" : "One-copy")); | 325 IsZeroCopyUploadEnabled() ? "Zero-copy" : "One-copy")); |
323 | 326 |
324 compositor_info->Append(NewDescriptionValuePair( | 327 compositor_info->Append(NewDescriptionValuePair( |
325 "Partial Raster", IsPartialRasterEnabled() ? "Enabled" : "Disabled")); | 328 "Partial Raster", IsPartialRasterEnabled() ? "Enabled" : "Disabled")); |
326 return compositor_info; | 329 return compositor_info; |
327 } | 330 } |
328 | 331 |
329 base::ListValue* GpuMemoryBufferInfo() { | 332 std::unique_ptr<base::ListValue> GpuMemoryBufferInfo() { |
330 base::ListValue* gpu_memory_buffer_info = new base::ListValue(); | 333 auto gpu_memory_buffer_info = base::MakeUnique<base::ListValue>(); |
331 | 334 |
332 BrowserGpuMemoryBufferManager* gpu_memory_buffer_manager = | 335 BrowserGpuMemoryBufferManager* gpu_memory_buffer_manager = |
333 BrowserGpuMemoryBufferManager::current(); | 336 BrowserGpuMemoryBufferManager::current(); |
334 | 337 |
335 for (size_t format = 0; | 338 for (size_t format = 0; |
336 format < static_cast<size_t>(gfx::BufferFormat::LAST) + 1; format++) { | 339 format < static_cast<size_t>(gfx::BufferFormat::LAST) + 1; format++) { |
337 std::string native_usage_support; | 340 std::string native_usage_support; |
338 for (size_t usage = 0; | 341 for (size_t usage = 0; |
339 usage < static_cast<size_t>(gfx::BufferUsage::LAST) + 1; usage++) { | 342 usage < static_cast<size_t>(gfx::BufferUsage::LAST) + 1; usage++) { |
340 if (gpu_memory_buffer_manager->IsNativeGpuMemoryBufferConfiguration( | 343 if (gpu_memory_buffer_manager->IsNativeGpuMemoryBufferConfiguration( |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
374 void OnGpuInfoUpdate() override; | 377 void OnGpuInfoUpdate() override; |
375 | 378 |
376 // ui::GpuSwitchingObserver implementation. | 379 // ui::GpuSwitchingObserver implementation. |
377 void OnGpuSwitched() override; | 380 void OnGpuSwitched() override; |
378 | 381 |
379 // Messages | 382 // Messages |
380 void OnBrowserBridgeInitialized(const base::ListValue* list); | 383 void OnBrowserBridgeInitialized(const base::ListValue* list); |
381 void OnCallAsync(const base::ListValue* list); | 384 void OnCallAsync(const base::ListValue* list); |
382 | 385 |
383 // Submessages dispatched from OnCallAsync | 386 // Submessages dispatched from OnCallAsync |
384 base::Value* OnRequestClientInfo(const base::ListValue* list); | 387 std::unique_ptr<base::DictionaryValue> OnRequestClientInfo( |
385 base::Value* OnRequestLogMessages(const base::ListValue* list); | 388 const base::ListValue* list); |
| 389 std::unique_ptr<base::ListValue> OnRequestLogMessages( |
| 390 const base::ListValue* list); |
386 | 391 |
387 private: | 392 private: |
388 // True if observing the GpuDataManager (re-attaching as observer would | 393 // True if observing the GpuDataManager (re-attaching as observer would |
389 // DCHECK). | 394 // DCHECK). |
390 bool observing_; | 395 bool observing_; |
391 | 396 |
392 DISALLOW_COPY_AND_ASSIGN(GpuMessageHandler); | 397 DISALLOW_COPY_AND_ASSIGN(GpuMessageHandler); |
393 }; | 398 }; |
394 | 399 |
395 //////////////////////////////////////////////////////////////////////////////// | 400 //////////////////////////////////////////////////////////////////////////////// |
(...skipping 28 matching lines...) Expand all Loading... |
424 // unpack args into requestId, submessage and submessageArgs | 429 // unpack args into requestId, submessage and submessageArgs |
425 bool ok; | 430 bool ok; |
426 const base::Value* requestId; | 431 const base::Value* requestId; |
427 ok = args->Get(0, &requestId); | 432 ok = args->Get(0, &requestId); |
428 DCHECK(ok); | 433 DCHECK(ok); |
429 | 434 |
430 std::string submessage; | 435 std::string submessage; |
431 ok = args->GetString(1, &submessage); | 436 ok = args->GetString(1, &submessage); |
432 DCHECK(ok); | 437 DCHECK(ok); |
433 | 438 |
434 base::ListValue* submessageArgs = new base::ListValue(); | 439 auto submessageArgs = base::MakeUnique<base::ListValue>(); |
435 for (size_t i = 2; i < args->GetSize(); ++i) { | 440 for (size_t i = 2; i < args->GetSize(); ++i) { |
436 const base::Value* arg; | 441 const base::Value* arg; |
437 ok = args->Get(i, &arg); | 442 ok = args->Get(i, &arg); |
438 DCHECK(ok); | 443 DCHECK(ok); |
439 | 444 |
440 submessageArgs->Append(arg->CreateDeepCopy()); | 445 submessageArgs->Append(arg->CreateDeepCopy()); |
441 } | 446 } |
442 | 447 |
443 // call the submessage handler | 448 // call the submessage handler |
444 base::Value* ret = NULL; | 449 std::unique_ptr<base::Value> ret; |
445 if (submessage == "requestClientInfo") { | 450 if (submessage == "requestClientInfo") { |
446 ret = OnRequestClientInfo(submessageArgs); | 451 ret = OnRequestClientInfo(submessageArgs.get()); |
447 } else if (submessage == "requestLogMessages") { | 452 } else if (submessage == "requestLogMessages") { |
448 ret = OnRequestLogMessages(submessageArgs); | 453 ret = OnRequestLogMessages(submessageArgs.get()); |
449 } else { // unrecognized submessage | 454 } else { // unrecognized submessage |
450 NOTREACHED(); | 455 NOTREACHED(); |
451 delete submessageArgs; | |
452 return; | 456 return; |
453 } | 457 } |
454 delete submessageArgs; | |
455 | 458 |
456 // call BrowserBridge.onCallAsyncReply with result | 459 // call BrowserBridge.onCallAsyncReply with result |
457 if (ret) { | 460 if (ret) { |
458 web_ui()->CallJavascriptFunctionUnsafe("browserBridge.onCallAsyncReply", | 461 web_ui()->CallJavascriptFunctionUnsafe("browserBridge.onCallAsyncReply", |
459 *requestId, *ret); | 462 *requestId, *ret); |
460 delete ret; | |
461 } else { | 463 } else { |
462 web_ui()->CallJavascriptFunctionUnsafe("browserBridge.onCallAsyncReply", | 464 web_ui()->CallJavascriptFunctionUnsafe("browserBridge.onCallAsyncReply", |
463 *requestId); | 465 *requestId); |
464 } | 466 } |
465 } | 467 } |
466 | 468 |
467 void GpuMessageHandler::OnBrowserBridgeInitialized( | 469 void GpuMessageHandler::OnBrowserBridgeInitialized( |
468 const base::ListValue* args) { | 470 const base::ListValue* args) { |
469 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 471 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
470 | 472 |
471 // Watch for changes in GPUInfo | 473 // Watch for changes in GPUInfo |
472 if (!observing_) { | 474 if (!observing_) { |
473 GpuDataManagerImpl::GetInstance()->AddObserver(this); | 475 GpuDataManagerImpl::GetInstance()->AddObserver(this); |
474 ui::GpuSwitchingManager::GetInstance()->AddObserver(this); | 476 ui::GpuSwitchingManager::GetInstance()->AddObserver(this); |
475 } | 477 } |
476 observing_ = true; | 478 observing_ = true; |
477 | 479 |
478 // Tell GpuDataManager it should have full GpuInfo. If the | 480 // Tell GpuDataManager it should have full GpuInfo. If the |
479 // Gpu process has not run yet, this will trigger its launch. | 481 // Gpu process has not run yet, this will trigger its launch. |
480 GpuDataManagerImpl::GetInstance()->RequestCompleteGpuInfoIfNeeded(); | 482 GpuDataManagerImpl::GetInstance()->RequestCompleteGpuInfoIfNeeded(); |
481 | 483 |
482 // Run callback immediately in case the info is ready and no update in the | 484 // Run callback immediately in case the info is ready and no update in the |
483 // future. | 485 // future. |
484 OnGpuInfoUpdate(); | 486 OnGpuInfoUpdate(); |
485 } | 487 } |
486 | 488 |
487 base::Value* GpuMessageHandler::OnRequestClientInfo( | 489 std::unique_ptr<base::DictionaryValue> GpuMessageHandler::OnRequestClientInfo( |
488 const base::ListValue* list) { | 490 const base::ListValue* list) { |
489 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 491 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
490 | 492 |
491 base::DictionaryValue* dict = new base::DictionaryValue(); | 493 auto dict = base::MakeUnique<base::DictionaryValue>(); |
492 | 494 |
493 dict->SetString("version", GetContentClient()->GetProduct()); | 495 dict->SetString("version", GetContentClient()->GetProduct()); |
494 dict->SetString("command_line", | 496 dict->SetString("command_line", |
495 base::CommandLine::ForCurrentProcess()->GetCommandLineString()); | 497 base::CommandLine::ForCurrentProcess()->GetCommandLineString()); |
496 dict->SetString("operating_system", | 498 dict->SetString("operating_system", |
497 base::SysInfo::OperatingSystemName() + " " + | 499 base::SysInfo::OperatingSystemName() + " " + |
498 base::SysInfo::OperatingSystemVersion()); | 500 base::SysInfo::OperatingSystemVersion()); |
499 dict->SetString("angle_commit_id", ANGLE_COMMIT_HASH); | 501 dict->SetString("angle_commit_id", ANGLE_COMMIT_HASH); |
500 dict->SetString("graphics_backend", | 502 dict->SetString("graphics_backend", |
501 std::string("Skia/" STRINGIZE(SK_MILESTONE) | 503 std::string("Skia/" STRINGIZE(SK_MILESTONE) |
502 " " SKIA_COMMIT_HASH)); | 504 " " SKIA_COMMIT_HASH)); |
503 dict->SetString("blacklist_version", | 505 dict->SetString("blacklist_version", |
504 GpuDataManagerImpl::GetInstance()->GetBlacklistVersion()); | 506 GpuDataManagerImpl::GetInstance()->GetBlacklistVersion()); |
505 dict->SetString("driver_bug_list_version", | 507 dict->SetString("driver_bug_list_version", |
506 GpuDataManagerImpl::GetInstance()->GetDriverBugListVersion()); | 508 GpuDataManagerImpl::GetInstance()->GetDriverBugListVersion()); |
507 | 509 |
508 return dict; | 510 return dict; |
509 } | 511 } |
510 | 512 |
511 base::Value* GpuMessageHandler::OnRequestLogMessages(const base::ListValue*) { | 513 std::unique_ptr<base::ListValue> GpuMessageHandler::OnRequestLogMessages( |
| 514 const base::ListValue*) { |
512 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 515 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
513 | 516 |
514 return GpuDataManagerImpl::GetInstance()->GetLogMessages(); | 517 return GpuDataManagerImpl::GetInstance()->GetLogMessages(); |
515 } | 518 } |
516 | 519 |
517 void GpuMessageHandler::OnGpuInfoUpdate() { | 520 void GpuMessageHandler::OnGpuInfoUpdate() { |
518 // Get GPU Info. | 521 // Get GPU Info. |
519 std::unique_ptr<base::DictionaryValue> gpu_info_val( | 522 std::unique_ptr<base::DictionaryValue> gpu_info_val( |
520 GpuInfoAsDictionaryValue()); | 523 GpuInfoAsDictionaryValue()); |
521 | 524 |
522 // Add in blacklisting features | 525 // Add in blacklisting features |
523 base::DictionaryValue* feature_status = new base::DictionaryValue; | 526 auto feature_status = base::MakeUnique<base::DictionaryValue>(); |
524 feature_status->Set("featureStatus", GetFeatureStatus()); | 527 feature_status->Set("featureStatus", GetFeatureStatus()); |
525 feature_status->Set("problems", GetProblems()); | 528 feature_status->Set("problems", GetProblems()); |
526 base::ListValue* workarounds = new base::ListValue(); | 529 auto workarounds = base::MakeUnique<base::ListValue>(); |
527 for (const std::string& workaround : GetDriverBugWorkarounds()) | 530 for (const std::string& workaround : GetDriverBugWorkarounds()) |
528 workarounds->AppendString(workaround); | 531 workarounds->AppendString(workaround); |
529 feature_status->Set("workarounds", workarounds); | 532 feature_status->Set("workarounds", std::move(workarounds)); |
530 gpu_info_val->Set("featureStatus", feature_status); | 533 gpu_info_val->Set("featureStatus", std::move(feature_status)); |
531 gpu_info_val->Set("compositorInfo", CompositorInfo()); | 534 gpu_info_val->Set("compositorInfo", CompositorInfo()); |
532 gpu_info_val->Set("gpuMemoryBufferInfo", GpuMemoryBufferInfo()); | 535 gpu_info_val->Set("gpuMemoryBufferInfo", GpuMemoryBufferInfo()); |
533 | 536 |
534 // Send GPU Info to javascript. | 537 // Send GPU Info to javascript. |
535 web_ui()->CallJavascriptFunctionUnsafe("browserBridge.onGpuInfoUpdate", | 538 web_ui()->CallJavascriptFunctionUnsafe("browserBridge.onGpuInfoUpdate", |
536 *(gpu_info_val.get())); | 539 *(gpu_info_val.get())); |
537 } | 540 } |
538 | 541 |
539 void GpuMessageHandler::OnGpuSwitched() { | 542 void GpuMessageHandler::OnGpuSwitched() { |
540 GpuDataManagerImpl::GetInstance()->RequestCompleteGpuInfoIfNeeded(); | 543 GpuDataManagerImpl::GetInstance()->RequestCompleteGpuInfoIfNeeded(); |
(...skipping 12 matching lines...) Expand all Loading... |
553 : WebUIController(web_ui) { | 556 : WebUIController(web_ui) { |
554 web_ui->AddMessageHandler(base::MakeUnique<GpuMessageHandler>()); | 557 web_ui->AddMessageHandler(base::MakeUnique<GpuMessageHandler>()); |
555 | 558 |
556 // Set up the chrome://gpu/ source. | 559 // Set up the chrome://gpu/ source. |
557 BrowserContext* browser_context = | 560 BrowserContext* browser_context = |
558 web_ui->GetWebContents()->GetBrowserContext(); | 561 web_ui->GetWebContents()->GetBrowserContext(); |
559 WebUIDataSource::Add(browser_context, CreateGpuHTMLSource()); | 562 WebUIDataSource::Add(browser_context, CreateGpuHTMLSource()); |
560 } | 563 } |
561 | 564 |
562 } // namespace content | 565 } // namespace content |
OLD | NEW |