| 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 "chrome/browser/ui/webui/gpu_internals_ui.h" | 5 #include "chrome/browser/ui/webui/gpu_internals_ui.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| 11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
| 12 #include "base/i18n/time_formatting.h" | 12 #include "base/i18n/time_formatting.h" |
| 13 #include "base/string_number_conversions.h" | 13 #include "base/string_number_conversions.h" |
| 14 #include "base/stringprintf.h" | 14 #include "base/stringprintf.h" |
| 15 #include "base/sys_info.h" | 15 #include "base/sys_info.h" |
| 16 #include "base/values.h" | 16 #include "base/values.h" |
| 17 #include "chrome/browser/crash_upload_list.h" | 17 #include "chrome/browser/crash_upload_list.h" |
| 18 #include "chrome/browser/gpu_blacklist.h" |
| 19 #include "chrome/browser/gpu_util.h" |
| 18 #include "chrome/browser/profiles/profile.h" | 20 #include "chrome/browser/profiles/profile.h" |
| 19 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" | 21 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" |
| 20 #include "chrome/browser/ui/webui/chrome_web_ui_data_source.h" | 22 #include "chrome/browser/ui/webui/chrome_web_ui_data_source.h" |
| 21 #include "chrome/browser/ui/webui/crashes_ui.h" | 23 #include "chrome/browser/ui/webui/crashes_ui.h" |
| 22 #include "chrome/common/chrome_version_info.h" | 24 #include "chrome/common/chrome_version_info.h" |
| 23 #include "chrome/common/url_constants.h" | 25 #include "chrome/common/url_constants.h" |
| 24 #include "content/public/browser/browser_thread.h" | 26 #include "content/public/browser/browser_thread.h" |
| 25 #include "content/public/browser/gpu_data_manager.h" | 27 #include "content/public/browser/gpu_data_manager.h" |
| 26 #include "content/public/browser/gpu_data_manager_observer.h" | 28 #include "content/public/browser/gpu_data_manager_observer.h" |
| 27 #include "content/public/browser/web_contents.h" | 29 #include "content/public/browser/web_contents.h" |
| 28 #include "content/public/browser/web_ui.h" | 30 #include "content/public/browser/web_ui.h" |
| 29 #include "content/public/browser/web_ui_message_handler.h" | 31 #include "content/public/browser/web_ui_message_handler.h" |
| 30 #include "content/public/common/compositor_util.h" | |
| 31 #include "content/public/common/content_switches.h" | |
| 32 #include "content/public/common/gpu_info.h" | |
| 33 #include "grit/browser_resources.h" | 32 #include "grit/browser_resources.h" |
| 34 #include "grit/generated_resources.h" | 33 #include "grit/generated_resources.h" |
| 35 #include "third_party/angle/src/common/version.h" | 34 #include "third_party/angle/src/common/version.h" |
| 36 #include "ui/base/l10n/l10n_util.h" | 35 #include "ui/base/l10n/l10n_util.h" |
| 37 | 36 |
| 38 #if defined(OS_LINUX) || defined(OS_OPENBSD) | 37 #if defined(OS_LINUX) || defined(OS_OPENBSD) |
| 39 #include "content/public/browser/zygote_host_linux.h" | 38 #include "content/public/browser/zygote_host_linux.h" |
| 40 #include "content/public/common/sandbox_linux.h" | 39 #include "content/public/common/sandbox_linux.h" |
| 41 #endif | 40 #endif |
| 42 | 41 |
| 43 using content::BrowserThread; | 42 using content::BrowserThread; |
| 44 using content::GpuDataManager; | 43 using content::GpuDataManager; |
| 45 using content::GpuFeatureType; | |
| 46 using content::WebContents; | 44 using content::WebContents; |
| 47 using content::WebUIMessageHandler; | 45 using content::WebUIMessageHandler; |
| 48 | 46 |
| 49 namespace { | 47 namespace { |
| 50 | 48 |
| 51 struct GpuFeatureInfo { | |
| 52 std::string name; | |
| 53 uint32 blocked; | |
| 54 bool disabled; | |
| 55 std::string disabled_description; | |
| 56 bool fallback_to_software; | |
| 57 }; | |
| 58 | |
| 59 ChromeWebUIDataSource* CreateGpuHTMLSource() { | 49 ChromeWebUIDataSource* CreateGpuHTMLSource() { |
| 60 ChromeWebUIDataSource* source = | 50 ChromeWebUIDataSource* source = |
| 61 new ChromeWebUIDataSource(chrome::kChromeUIGpuInternalsHost); | 51 new ChromeWebUIDataSource(chrome::kChromeUIGpuInternalsHost); |
| 62 | 52 |
| 63 source->set_json_path("strings.js"); | 53 source->set_json_path("strings.js"); |
| 64 source->add_resource_path("gpu_internals.js", IDR_GPU_INTERNALS_JS); | 54 source->add_resource_path("gpu_internals.js", IDR_GPU_INTERNALS_JS); |
| 65 source->set_default_resource(IDR_GPU_INTERNALS_HTML); | 55 source->set_default_resource(IDR_GPU_INTERNALS_HTML); |
| 66 return source; | 56 return source; |
| 67 } | 57 } |
| 68 | 58 |
| 69 DictionaryValue* NewDescriptionValuePair(const std::string& desc, | |
| 70 const std::string& value) { | |
| 71 DictionaryValue* dict = new DictionaryValue(); | |
| 72 dict->SetString("description", desc); | |
| 73 dict->SetString("value", value); | |
| 74 return dict; | |
| 75 } | |
| 76 | |
| 77 DictionaryValue* NewDescriptionValuePair(const std::string& desc, | |
| 78 Value* value) { | |
| 79 DictionaryValue* dict = new DictionaryValue(); | |
| 80 dict->SetString("description", desc); | |
| 81 dict->Set("value", value); | |
| 82 return dict; | |
| 83 } | |
| 84 | |
| 85 Value* NewStatusValue(const char* name, const char* status) { | |
| 86 DictionaryValue* value = new DictionaryValue(); | |
| 87 value->SetString("name", name); | |
| 88 value->SetString("status", status); | |
| 89 return value; | |
| 90 } | |
| 91 | |
| 92 // Output DxDiagNode tree as nested array of {description,value} pairs | |
| 93 ListValue* DxDiagNodeToList(const content::DxDiagNode& node) { | |
| 94 ListValue* list = new ListValue(); | |
| 95 for (std::map<std::string, std::string>::const_iterator it = | |
| 96 node.values.begin(); | |
| 97 it != node.values.end(); | |
| 98 ++it) { | |
| 99 list->Append(NewDescriptionValuePair(it->first, it->second)); | |
| 100 } | |
| 101 | |
| 102 for (std::map<std::string, content::DxDiagNode>::const_iterator it = | |
| 103 node.children.begin(); | |
| 104 it != node.children.end(); | |
| 105 ++it) { | |
| 106 ListValue* sublist = DxDiagNodeToList(it->second); | |
| 107 list->Append(NewDescriptionValuePair(it->first, sublist)); | |
| 108 } | |
| 109 return list; | |
| 110 } | |
| 111 | |
| 112 std::string GPUDeviceToString(const content::GPUInfo::GPUDevice& gpu) { | |
| 113 std::string vendor = base::StringPrintf("0x%04x", gpu.vendor_id); | |
| 114 if (!gpu.vendor_string.empty()) | |
| 115 vendor += " [" + gpu.vendor_string + "]"; | |
| 116 std::string device = base::StringPrintf("0x%04x", gpu.device_id); | |
| 117 if (!gpu.device_string.empty()) | |
| 118 device += " [" + gpu.device_string + "]"; | |
| 119 return base::StringPrintf( | |
| 120 "VENDOR = %s, DEVICE= %s", vendor.c_str(), device.c_str()); | |
| 121 } | |
| 122 | |
| 123 DictionaryValue* GpuInfoAsDictionaryValue() { | |
| 124 content::GPUInfo gpu_info = GpuDataManager::GetInstance()->GetGPUInfo(); | |
| 125 ListValue* basic_info = new ListValue(); | |
| 126 basic_info->Append(NewDescriptionValuePair( | |
| 127 "Initialization time", | |
| 128 base::Int64ToString(gpu_info.initialization_time.InMilliseconds()))); | |
| 129 basic_info->Append(NewDescriptionValuePair( | |
| 130 "GPU0", GPUDeviceToString(gpu_info.gpu))); | |
| 131 for (size_t i = 0; i < gpu_info.secondary_gpus.size(); ++i) { | |
| 132 basic_info->Append(NewDescriptionValuePair( | |
| 133 base::StringPrintf("GPU%d", static_cast<int>(i + 1)), | |
| 134 GPUDeviceToString(gpu_info.secondary_gpus[i]))); | |
| 135 } | |
| 136 basic_info->Append(NewDescriptionValuePair( | |
| 137 "Optimus", Value::CreateBooleanValue(gpu_info.optimus))); | |
| 138 basic_info->Append(NewDescriptionValuePair( | |
| 139 "AMD switchable", Value::CreateBooleanValue(gpu_info.amd_switchable))); | |
| 140 basic_info->Append(NewDescriptionValuePair("Driver vendor", | |
| 141 gpu_info.driver_vendor)); | |
| 142 basic_info->Append(NewDescriptionValuePair("Driver version", | |
| 143 gpu_info.driver_version)); | |
| 144 basic_info->Append(NewDescriptionValuePair("Driver date", | |
| 145 gpu_info.driver_date)); | |
| 146 basic_info->Append(NewDescriptionValuePair("Pixel shader version", | |
| 147 gpu_info.pixel_shader_version)); | |
| 148 basic_info->Append(NewDescriptionValuePair("Vertex shader version", | |
| 149 gpu_info.vertex_shader_version)); | |
| 150 basic_info->Append(NewDescriptionValuePair("GL version", | |
| 151 gpu_info.gl_version)); | |
| 152 basic_info->Append(NewDescriptionValuePair("GL_VENDOR", | |
| 153 gpu_info.gl_vendor)); | |
| 154 basic_info->Append(NewDescriptionValuePair("GL_RENDERER", | |
| 155 gpu_info.gl_renderer)); | |
| 156 basic_info->Append(NewDescriptionValuePair("GL_VERSION", | |
| 157 gpu_info.gl_version_string)); | |
| 158 basic_info->Append(NewDescriptionValuePair("GL_EXTENSIONS", | |
| 159 gpu_info.gl_extensions)); | |
| 160 | |
| 161 DictionaryValue* info = new DictionaryValue(); | |
| 162 info->Set("basic_info", basic_info); | |
| 163 | |
| 164 #if defined(OS_WIN) | |
| 165 ListValue* perf_info = new ListValue(); | |
| 166 perf_info->Append(NewDescriptionValuePair( | |
| 167 "Graphics", | |
| 168 base::StringPrintf("%.1f", gpu_info.performance_stats.graphics))); | |
| 169 perf_info->Append(NewDescriptionValuePair( | |
| 170 "Gaming", | |
| 171 base::StringPrintf("%.1f", gpu_info.performance_stats.gaming))); | |
| 172 perf_info->Append(NewDescriptionValuePair( | |
| 173 "Overall", | |
| 174 base::StringPrintf("%.1f", gpu_info.performance_stats.overall))); | |
| 175 info->Set("performance_info", perf_info); | |
| 176 | |
| 177 Value* dx_info; | |
| 178 if (gpu_info.dx_diagnostics.children.size()) | |
| 179 dx_info = DxDiagNodeToList(gpu_info.dx_diagnostics); | |
| 180 else | |
| 181 dx_info = Value::CreateNullValue(); | |
| 182 info->Set("diagnostics", dx_info); | |
| 183 #endif | |
| 184 | |
| 185 return info; | |
| 186 } | |
| 187 | |
| 188 // Determine if accelerated-2d-canvas is supported, which depends on whether | |
| 189 // lose_context could happen and whether skia is the backend. | |
| 190 bool SupportsAccelerated2dCanvas() { | |
| 191 if (GpuDataManager::GetInstance()->GetGPUInfo().can_lose_context) | |
| 192 return false; | |
| 193 #if defined(USE_SKIA) | |
| 194 return true; | |
| 195 #else | |
| 196 return false; | |
| 197 #endif | |
| 198 } | |
| 199 | |
| 200 Value* GetFeatureStatus() { | |
| 201 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | |
| 202 bool gpu_access_blocked = !GpuDataManager::GetInstance()->GpuAccessAllowed(); | |
| 203 | |
| 204 uint32 flags = GpuDataManager::GetInstance()->GetBlacklistedFeatures(); | |
| 205 DictionaryValue* status = new DictionaryValue(); | |
| 206 | |
| 207 const GpuFeatureInfo kGpuFeatureInfo[] = { | |
| 208 { | |
| 209 "2d_canvas", | |
| 210 flags & content::GPU_FEATURE_TYPE_ACCELERATED_2D_CANVAS, | |
| 211 command_line.HasSwitch(switches::kDisableAccelerated2dCanvas) || | |
| 212 !SupportsAccelerated2dCanvas(), | |
| 213 "Accelerated 2D canvas is unavailable: either disabled at the command" | |
| 214 " line or not supported by the current system.", | |
| 215 true | |
| 216 }, | |
| 217 { | |
| 218 "compositing", | |
| 219 flags & content::GPU_FEATURE_TYPE_ACCELERATED_COMPOSITING, | |
| 220 command_line.HasSwitch(switches::kDisableAcceleratedCompositing), | |
| 221 "Accelerated compositing has been disabled, either via about:flags or" | |
| 222 " command line. This adversely affects performance of all hardware" | |
| 223 " accelerated features.", | |
| 224 true | |
| 225 }, | |
| 226 { | |
| 227 "3d_css", | |
| 228 flags & content::GPU_FEATURE_TYPE_ACCELERATED_COMPOSITING, | |
| 229 command_line.HasSwitch(switches::kDisableAcceleratedLayers), | |
| 230 "Accelerated layers have been disabled at the command line.", | |
| 231 false | |
| 232 }, | |
| 233 { | |
| 234 "css_animation", | |
| 235 flags & content::GPU_FEATURE_TYPE_ACCELERATED_COMPOSITING, | |
| 236 command_line.HasSwitch(switches::kDisableThreadedAnimation) || | |
| 237 command_line.HasSwitch(switches::kDisableAcceleratedCompositing), | |
| 238 "Accelerated CSS animation has been disabled at the command line.", | |
| 239 true | |
| 240 }, | |
| 241 { | |
| 242 "webgl", | |
| 243 flags & content::GPU_FEATURE_TYPE_WEBGL, | |
| 244 #if defined(OS_ANDROID) | |
| 245 !command_line.HasSwitch(switches::kEnableExperimentalWebGL), | |
| 246 #else | |
| 247 command_line.HasSwitch(switches::kDisableExperimentalWebGL), | |
| 248 #endif | |
| 249 "WebGL has been disabled, either via about:flags or command line.", | |
| 250 false | |
| 251 }, | |
| 252 { | |
| 253 "multisampling", | |
| 254 flags & content::GPU_FEATURE_TYPE_MULTISAMPLING, | |
| 255 command_line.HasSwitch(switches::kDisableGLMultisampling), | |
| 256 "Multisampling has been disabled, either via about:flags or command" | |
| 257 " line.", | |
| 258 false | |
| 259 }, | |
| 260 { | |
| 261 "flash_3d", | |
| 262 flags & content::GPU_FEATURE_TYPE_FLASH3D, | |
| 263 command_line.HasSwitch(switches::kDisableFlash3d), | |
| 264 "Using 3d in flash has been disabled, either via about:flags or" | |
| 265 " command line.", | |
| 266 false | |
| 267 }, | |
| 268 { | |
| 269 "flash_stage3d", | |
| 270 flags & content::GPU_FEATURE_TYPE_FLASH_STAGE3D, | |
| 271 command_line.HasSwitch(switches::kDisableFlashStage3d), | |
| 272 "Using Stage3d in Flash has been disabled, either via about:flags or" | |
| 273 " command line.", | |
| 274 false | |
| 275 }, | |
| 276 { | |
| 277 "texture_sharing", | |
| 278 flags & content::GPU_FEATURE_TYPE_TEXTURE_SHARING, | |
| 279 command_line.HasSwitch(switches::kDisableImageTransportSurface), | |
| 280 "Sharing textures between processes has been disabled, either via" | |
| 281 " about:flags or command line.", | |
| 282 false | |
| 283 }, | |
| 284 { | |
| 285 "video_decode", | |
| 286 flags & content::GPU_FEATURE_TYPE_ACCELERATED_VIDEO_DECODE, | |
| 287 command_line.HasSwitch(switches::kDisableAcceleratedVideoDecode), | |
| 288 "Accelerated video decode has been disabled, either via about:flags" | |
| 289 " or command line.", | |
| 290 true | |
| 291 } | |
| 292 }; | |
| 293 const size_t kNumFeatures = sizeof(kGpuFeatureInfo) / sizeof(GpuFeatureInfo); | |
| 294 | |
| 295 // Build the feature_status field. | |
| 296 { | |
| 297 ListValue* feature_status_list = new ListValue(); | |
| 298 | |
| 299 for (size_t i = 0; i < kNumFeatures; ++i) { | |
| 300 std::string status; | |
| 301 if (kGpuFeatureInfo[i].disabled) { | |
| 302 status = "disabled"; | |
| 303 if (kGpuFeatureInfo[i].name == "css_animation") { | |
| 304 status += "_software_animated"; | |
| 305 } else { | |
| 306 if (kGpuFeatureInfo[i].fallback_to_software) | |
| 307 status += "_software"; | |
| 308 else | |
| 309 status += "_off"; | |
| 310 } | |
| 311 } else if (GpuDataManager::GetInstance()->ShouldUseSoftwareRendering()) { | |
| 312 status = "unavailable_software"; | |
| 313 } else if (kGpuFeatureInfo[i].blocked || | |
| 314 gpu_access_blocked) { | |
| 315 status = "unavailable"; | |
| 316 if (kGpuFeatureInfo[i].fallback_to_software) | |
| 317 status += "_software"; | |
| 318 else | |
| 319 status += "_off"; | |
| 320 } else { | |
| 321 status = "enabled"; | |
| 322 if (kGpuFeatureInfo[i].name == "webgl" && | |
| 323 (command_line.HasSwitch(switches::kDisableAcceleratedCompositing) || | |
| 324 (flags & content::GPU_FEATURE_TYPE_ACCELERATED_COMPOSITING))) | |
| 325 status += "_readback"; | |
| 326 bool has_thread = content::IsThreadedCompositingEnabled(); | |
| 327 if (kGpuFeatureInfo[i].name == "compositing") { | |
| 328 bool force_compositing = | |
| 329 content::IsForceCompositingModeEnabled(); | |
| 330 if (force_compositing) | |
| 331 status += "_force"; | |
| 332 if (has_thread) | |
| 333 status += "_threaded"; | |
| 334 } | |
| 335 if (kGpuFeatureInfo[i].name == "css_animation") { | |
| 336 if (has_thread) | |
| 337 status = "accelerated_threaded"; | |
| 338 else | |
| 339 status = "accelerated"; | |
| 340 } | |
| 341 } | |
| 342 feature_status_list->Append( | |
| 343 NewStatusValue(kGpuFeatureInfo[i].name.c_str(), status.c_str())); | |
| 344 } | |
| 345 | |
| 346 status->Set("featureStatus", feature_status_list); | |
| 347 } | |
| 348 | |
| 349 // Build the problems list. | |
| 350 { | |
| 351 ListValue* problem_list = | |
| 352 GpuDataManager::GetInstance()->GetBlacklistReasons(); | |
| 353 | |
| 354 if (gpu_access_blocked) { | |
| 355 DictionaryValue* problem = new DictionaryValue(); | |
| 356 problem->SetString("description", | |
| 357 "GPU process was unable to boot. Access to GPU disallowed."); | |
| 358 problem->Set("crBugs", new ListValue()); | |
| 359 problem->Set("webkitBugs", new ListValue()); | |
| 360 problem_list->Append(problem); | |
| 361 } | |
| 362 | |
| 363 for (size_t i = 0; i < kNumFeatures; ++i) { | |
| 364 if (kGpuFeatureInfo[i].disabled) { | |
| 365 DictionaryValue* problem = new DictionaryValue(); | |
| 366 problem->SetString( | |
| 367 "description", kGpuFeatureInfo[i].disabled_description); | |
| 368 problem->Set("crBugs", new ListValue()); | |
| 369 problem->Set("webkitBugs", new ListValue()); | |
| 370 problem_list->Append(problem); | |
| 371 } | |
| 372 } | |
| 373 | |
| 374 status->Set("problems", problem_list); | |
| 375 } | |
| 376 | |
| 377 return status; | |
| 378 } | |
| 379 | |
| 380 // This class receives javascript messages from the renderer. | 59 // This class receives javascript messages from the renderer. |
| 381 // Note that the WebUI infrastructure runs on the UI thread, therefore all of | 60 // Note that the WebUI infrastructure runs on the UI thread, therefore all of |
| 382 // this class's methods are expected to run on the UI thread. | 61 // this class's methods are expected to run on the UI thread. |
| 383 class GpuMessageHandler | 62 class GpuMessageHandler |
| 384 : public WebUIMessageHandler, | 63 : public WebUIMessageHandler, |
| 385 public base::SupportsWeakPtr<GpuMessageHandler>, | 64 public base::SupportsWeakPtr<GpuMessageHandler>, |
| 386 public content::GpuDataManagerObserver, | 65 public content::GpuDataManagerObserver, |
| 387 public CrashUploadList::Delegate { | 66 public CrashUploadList::Delegate { |
| 388 public: | 67 public: |
| 389 GpuMessageHandler(); | 68 GpuMessageHandler(); |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 554 dict->SetString("operating_system", | 233 dict->SetString("operating_system", |
| 555 base::SysInfo::OperatingSystemName() + " " + | 234 base::SysInfo::OperatingSystemName() + " " + |
| 556 base::SysInfo::OperatingSystemVersion()); | 235 base::SysInfo::OperatingSystemVersion()); |
| 557 dict->SetString("angle_revision", base::UintToString(BUILD_REVISION)); | 236 dict->SetString("angle_revision", base::UintToString(BUILD_REVISION)); |
| 558 #if defined(USE_SKIA) | 237 #if defined(USE_SKIA) |
| 559 dict->SetString("graphics_backend", "Skia"); | 238 dict->SetString("graphics_backend", "Skia"); |
| 560 #else | 239 #else |
| 561 dict->SetString("graphics_backend", "Core Graphics"); | 240 dict->SetString("graphics_backend", "Core Graphics"); |
| 562 #endif | 241 #endif |
| 563 dict->SetString("blacklist_version", | 242 dict->SetString("blacklist_version", |
| 564 GpuDataManager::GetInstance()->GetBlacklistVersion()); | 243 GpuBlacklist::GetInstance()->GetVersion()); |
| 565 | 244 |
| 566 return dict; | 245 return dict; |
| 567 } | 246 } |
| 568 | 247 |
| 569 Value* GpuMessageHandler::OnRequestSandboxInfo(const ListValue*) { | 248 Value* GpuMessageHandler::OnRequestSandboxInfo(const ListValue*) { |
| 570 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 249 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 571 | 250 |
| 572 DictionaryValue* dict = new DictionaryValue(); | 251 DictionaryValue* dict = new DictionaryValue(); |
| 573 | 252 |
| 574 #if defined(OS_LINUX) || defined(OS_OPENBSD) | 253 #if defined(OS_LINUX) || defined(OS_OPENBSD) |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 624 crash->SetString("time", | 303 crash->SetString("time", |
| 625 base::TimeFormatFriendlyDateAndTime(i->crash_time)); | 304 base::TimeFormatFriendlyDateAndTime(i->crash_time)); |
| 626 list_value->Append(crash); | 305 list_value->Append(crash); |
| 627 } | 306 } |
| 628 return list_value; | 307 return list_value; |
| 629 } | 308 } |
| 630 | 309 |
| 631 void GpuMessageHandler::OnGpuInfoUpdate() { | 310 void GpuMessageHandler::OnGpuInfoUpdate() { |
| 632 // Get GPU Info. | 311 // Get GPU Info. |
| 633 scoped_ptr<base::DictionaryValue> gpu_info_val( | 312 scoped_ptr<base::DictionaryValue> gpu_info_val( |
| 634 GpuInfoAsDictionaryValue()); | 313 gpu_util::GpuInfoAsDictionaryValue()); |
| 635 | 314 |
| 636 // Add in blacklisting features | 315 // Add in blacklisting features |
| 637 Value* feature_status = GetFeatureStatus(); | 316 Value* feature_status = gpu_util::GetFeatureStatus(); |
| 638 if (feature_status) | 317 if (feature_status) |
| 639 gpu_info_val->Set("featureStatus", feature_status); | 318 gpu_info_val->Set("featureStatus", feature_status); |
| 640 | 319 |
| 641 // Send GPU Info to javascript. | 320 // Send GPU Info to javascript. |
| 642 web_ui()->CallJavascriptFunction("browserBridge.onGpuInfoUpdate", | 321 web_ui()->CallJavascriptFunction("browserBridge.onGpuInfoUpdate", |
| 643 *(gpu_info_val.get())); | 322 *(gpu_info_val.get())); |
| 644 } | 323 } |
| 645 | 324 |
| 646 void GpuMessageHandler::OnCrashListAvailable() { | 325 void GpuMessageHandler::OnCrashListAvailable() { |
| 647 crash_list_available_ = true; | 326 crash_list_available_ = true; |
| 648 } | 327 } |
| 649 | 328 |
| 650 } // namespace | 329 } // namespace |
| 651 | 330 |
| 652 | 331 |
| 653 //////////////////////////////////////////////////////////////////////////////// | 332 //////////////////////////////////////////////////////////////////////////////// |
| 654 // | 333 // |
| 655 // GpuInternalsUI | 334 // GpuInternalsUI |
| 656 // | 335 // |
| 657 //////////////////////////////////////////////////////////////////////////////// | 336 //////////////////////////////////////////////////////////////////////////////// |
| 658 | 337 |
| 659 GpuInternalsUI::GpuInternalsUI(content::WebUI* web_ui) | 338 GpuInternalsUI::GpuInternalsUI(content::WebUI* web_ui) |
| 660 : WebUIController(web_ui) { | 339 : WebUIController(web_ui) { |
| 661 web_ui->AddMessageHandler(new GpuMessageHandler()); | 340 web_ui->AddMessageHandler(new GpuMessageHandler()); |
| 662 | 341 |
| 663 // Set up the chrome://gpu-internals/ source. | 342 // Set up the chrome://gpu-internals/ source. |
| 664 Profile* profile = Profile::FromWebUI(web_ui); | 343 Profile* profile = Profile::FromWebUI(web_ui); |
| 665 ChromeURLDataManager::AddDataSource(profile, CreateGpuHTMLSource()); | 344 ChromeURLDataManager::AddDataSource(profile, CreateGpuHTMLSource()); |
| 666 } | 345 } |
| OLD | NEW |