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 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
437 ret = OnRequestLogMessages(submessageArgs); | 437 ret = OnRequestLogMessages(submessageArgs); |
438 } else { // unrecognized submessage | 438 } else { // unrecognized submessage |
439 NOTREACHED(); | 439 NOTREACHED(); |
440 delete submessageArgs; | 440 delete submessageArgs; |
441 return; | 441 return; |
442 } | 442 } |
443 delete submessageArgs; | 443 delete submessageArgs; |
444 | 444 |
445 // call BrowserBridge.onCallAsyncReply with result | 445 // call BrowserBridge.onCallAsyncReply with result |
446 if (ret) { | 446 if (ret) { |
447 web_ui()->CallJavascriptFunction("browserBridge.onCallAsyncReply", | 447 web_ui()->CallJavascriptFunctionUnsafe("browserBridge.onCallAsyncReply", |
448 *requestId, | 448 *requestId, *ret); |
449 *ret); | |
450 delete ret; | 449 delete ret; |
451 } else { | 450 } else { |
452 web_ui()->CallJavascriptFunction("browserBridge.onCallAsyncReply", | 451 web_ui()->CallJavascriptFunctionUnsafe("browserBridge.onCallAsyncReply", |
453 *requestId); | 452 *requestId); |
454 } | 453 } |
455 } | 454 } |
456 | 455 |
457 void GpuMessageHandler::OnBrowserBridgeInitialized( | 456 void GpuMessageHandler::OnBrowserBridgeInitialized( |
458 const base::ListValue* args) { | 457 const base::ListValue* args) { |
459 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 458 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
460 | 459 |
461 // Watch for changes in GPUInfo | 460 // Watch for changes in GPUInfo |
462 if (!observing_) { | 461 if (!observing_) { |
463 GpuDataManagerImpl::GetInstance()->AddObserver(this); | 462 GpuDataManagerImpl::GetInstance()->AddObserver(this); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
513 feature_status->Set("problems", GetProblems()); | 512 feature_status->Set("problems", GetProblems()); |
514 base::ListValue* workarounds = new base::ListValue(); | 513 base::ListValue* workarounds = new base::ListValue(); |
515 for (const std::string& workaround : GetDriverBugWorkarounds()) | 514 for (const std::string& workaround : GetDriverBugWorkarounds()) |
516 workarounds->AppendString(workaround); | 515 workarounds->AppendString(workaround); |
517 feature_status->Set("workarounds", workarounds); | 516 feature_status->Set("workarounds", workarounds); |
518 gpu_info_val->Set("featureStatus", feature_status); | 517 gpu_info_val->Set("featureStatus", feature_status); |
519 gpu_info_val->Set("compositorInfo", CompositorInfo()); | 518 gpu_info_val->Set("compositorInfo", CompositorInfo()); |
520 gpu_info_val->Set("gpuMemoryBufferInfo", GpuMemoryBufferInfo()); | 519 gpu_info_val->Set("gpuMemoryBufferInfo", GpuMemoryBufferInfo()); |
521 | 520 |
522 // Send GPU Info to javascript. | 521 // Send GPU Info to javascript. |
523 web_ui()->CallJavascriptFunction("browserBridge.onGpuInfoUpdate", | 522 web_ui()->CallJavascriptFunctionUnsafe("browserBridge.onGpuInfoUpdate", |
524 *(gpu_info_val.get())); | 523 *(gpu_info_val.get())); |
525 } | 524 } |
526 | 525 |
527 void GpuMessageHandler::OnGpuSwitched() { | 526 void GpuMessageHandler::OnGpuSwitched() { |
528 GpuDataManagerImpl::GetInstance()->RequestCompleteGpuInfoIfNeeded(); | 527 GpuDataManagerImpl::GetInstance()->RequestCompleteGpuInfoIfNeeded(); |
529 } | 528 } |
530 | 529 |
531 } // namespace | 530 } // namespace |
532 | 531 |
533 | 532 |
534 //////////////////////////////////////////////////////////////////////////////// | 533 //////////////////////////////////////////////////////////////////////////////// |
535 // | 534 // |
536 // GpuInternalsUI | 535 // GpuInternalsUI |
537 // | 536 // |
538 //////////////////////////////////////////////////////////////////////////////// | 537 //////////////////////////////////////////////////////////////////////////////// |
539 | 538 |
540 GpuInternalsUI::GpuInternalsUI(WebUI* web_ui) | 539 GpuInternalsUI::GpuInternalsUI(WebUI* web_ui) |
541 : WebUIController(web_ui) { | 540 : WebUIController(web_ui) { |
542 web_ui->AddMessageHandler(new GpuMessageHandler()); | 541 web_ui->AddMessageHandler(new GpuMessageHandler()); |
543 | 542 |
544 // Set up the chrome://gpu/ source. | 543 // Set up the chrome://gpu/ source. |
545 BrowserContext* browser_context = | 544 BrowserContext* browser_context = |
546 web_ui->GetWebContents()->GetBrowserContext(); | 545 web_ui->GetWebContents()->GetBrowserContext(); |
547 WebUIDataSource::Add(browser_context, CreateGpuHTMLSource()); | 546 WebUIDataSource::Add(browser_context, CreateGpuHTMLSource()); |
548 } | 547 } |
549 | 548 |
550 } // namespace content | 549 } // namespace content |
OLD | NEW |