| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/gpu/gpu_data_manager_impl_private.h" | 5 #include "content/browser/gpu/gpu_data_manager_impl_private.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 // Send UMA histograms about the enabled features and GPU properties. | 106 // Send UMA histograms about the enabled features and GPU properties. |
| 107 void UpdateStats(const gpu::GPUInfo& gpu_info, | 107 void UpdateStats(const gpu::GPUInfo& gpu_info, |
| 108 const gpu::GpuBlacklist* blacklist, | 108 const gpu::GpuBlacklist* blacklist, |
| 109 const std::set<int>& blacklisted_features) { | 109 const std::set<int>& blacklisted_features) { |
| 110 uint32 max_entry_id = blacklist->max_entry_id(); | 110 uint32 max_entry_id = blacklist->max_entry_id(); |
| 111 if (max_entry_id == 0) { | 111 if (max_entry_id == 0) { |
| 112 // GPU Blacklist was not loaded. No need to go further. | 112 // GPU Blacklist was not loaded. No need to go further. |
| 113 return; | 113 return; |
| 114 } | 114 } |
| 115 | 115 |
| 116 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 116 const base::CommandLine& command_line = |
| 117 *base::CommandLine::ForCurrentProcess(); |
| 117 bool disabled = false; | 118 bool disabled = false; |
| 118 | 119 |
| 119 // Use entry 0 to capture the total number of times that data | 120 // Use entry 0 to capture the total number of times that data |
| 120 // was recorded in this histogram in order to have a convenient | 121 // was recorded in this histogram in order to have a convenient |
| 121 // denominator to compute blacklist percentages for the rest of the | 122 // denominator to compute blacklist percentages for the rest of the |
| 122 // entries. | 123 // entries. |
| 123 UMA_HISTOGRAM_ENUMERATION("GPU.BlacklistTestResultsPerEntry", | 124 UMA_HISTOGRAM_ENUMERATION("GPU.BlacklistTestResultsPerEntry", |
| 124 0, max_entry_id + 1); | 125 0, max_entry_id + 1); |
| 125 | 126 |
| 126 if (blacklisted_features.size() != 0) { | 127 if (blacklisted_features.size() != 0) { |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 | 259 |
| 259 // Prevent all further initialization. | 260 // Prevent all further initialization. |
| 260 finalized_ = true; | 261 finalized_ = true; |
| 261 | 262 |
| 262 InitializeImpl(gpu_blacklist_json, std::string(), gpu_info); | 263 InitializeImpl(gpu_blacklist_json, std::string(), gpu_info); |
| 263 } | 264 } |
| 264 | 265 |
| 265 bool GpuDataManagerImplPrivate::IsFeatureBlacklisted(int feature) const { | 266 bool GpuDataManagerImplPrivate::IsFeatureBlacklisted(int feature) const { |
| 266 #if defined(OS_CHROMEOS) | 267 #if defined(OS_CHROMEOS) |
| 267 if (feature == gpu::GPU_FEATURE_TYPE_PANEL_FITTING && | 268 if (feature == gpu::GPU_FEATURE_TYPE_PANEL_FITTING && |
| 268 CommandLine::ForCurrentProcess()->HasSwitch( | 269 base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 269 switches::kDisablePanelFitting)) { | 270 switches::kDisablePanelFitting)) { |
| 270 return true; | 271 return true; |
| 271 } | 272 } |
| 272 #endif // OS_CHROMEOS | 273 #endif // OS_CHROMEOS |
| 273 if (use_swiftshader_) { | 274 if (use_swiftshader_) { |
| 274 // Skia's software rendering is probably more efficient than going through | 275 // Skia's software rendering is probably more efficient than going through |
| 275 // software emulation of the GPU, so use that. | 276 // software emulation of the GPU, so use that. |
| 276 if (feature == gpu::GPU_FEATURE_TYPE_ACCELERATED_2D_CANVAS) | 277 if (feature == gpu::GPU_FEATURE_TYPE_ACCELERATED_2D_CANVAS) |
| 277 return true; | 278 return true; |
| 278 return false; | 279 return false; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 if (!gpu_process_accessible_) { | 317 if (!gpu_process_accessible_) { |
| 317 if (reason) { | 318 if (reason) { |
| 318 *reason = "GPU process launch failed."; | 319 *reason = "GPU process launch failed."; |
| 319 } | 320 } |
| 320 return false; | 321 return false; |
| 321 } | 322 } |
| 322 | 323 |
| 323 if (card_blacklisted_) { | 324 if (card_blacklisted_) { |
| 324 if (reason) { | 325 if (reason) { |
| 325 *reason = "GPU access is disabled "; | 326 *reason = "GPU access is disabled "; |
| 326 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 327 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
| 327 if (command_line->HasSwitch(switches::kDisableGpu)) | 328 if (command_line->HasSwitch(switches::kDisableGpu)) |
| 328 *reason += "through commandline switch --disable-gpu."; | 329 *reason += "through commandline switch --disable-gpu."; |
| 329 else | 330 else |
| 330 *reason += "in chrome://settings."; | 331 *reason += "in chrome://settings."; |
| 331 } | 332 } |
| 332 return false; | 333 return false; |
| 333 } | 334 } |
| 334 | 335 |
| 335 // We only need to block GPU process if more features are disallowed other | 336 // We only need to block GPU process if more features are disallowed other |
| 336 // than those in the preliminary gpu feature flags because the latter work | 337 // than those in the preliminary gpu feature flags because the latter work |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 470 *gl_version = gpu_info_.gl_version; | 471 *gl_version = gpu_info_.gl_version; |
| 471 } | 472 } |
| 472 | 473 |
| 473 void GpuDataManagerImplPrivate::Initialize() { | 474 void GpuDataManagerImplPrivate::Initialize() { |
| 474 TRACE_EVENT0("startup", "GpuDataManagerImpl::Initialize"); | 475 TRACE_EVENT0("startup", "GpuDataManagerImpl::Initialize"); |
| 475 if (finalized_) { | 476 if (finalized_) { |
| 476 DVLOG(0) << "GpuDataManagerImpl marked as finalized; skipping Initialize"; | 477 DVLOG(0) << "GpuDataManagerImpl marked as finalized; skipping Initialize"; |
| 477 return; | 478 return; |
| 478 } | 479 } |
| 479 | 480 |
| 480 const CommandLine* command_line = CommandLine::ForCurrentProcess(); | 481 const base::CommandLine* command_line = |
| 482 base::CommandLine::ForCurrentProcess(); |
| 481 if (command_line->HasSwitch(switches::kSkipGpuDataLoading)) | 483 if (command_line->HasSwitch(switches::kSkipGpuDataLoading)) |
| 482 return; | 484 return; |
| 483 | 485 |
| 484 gpu::GPUInfo gpu_info; | 486 gpu::GPUInfo gpu_info; |
| 485 if (command_line->GetSwitchValueASCII( | 487 if (command_line->GetSwitchValueASCII( |
| 486 switches::kUseGL) == gfx::kGLImplementationOSMesaName) { | 488 switches::kUseGL) == gfx::kGLImplementationOSMesaName) { |
| 487 // If using the OSMesa GL implementation, use fake vendor and device ids to | 489 // If using the OSMesa GL implementation, use fake vendor and device ids to |
| 488 // make sure it never gets blacklisted. This is better than simply | 490 // make sure it never gets blacklisted. This is better than simply |
| 489 // cancelling GPUInfo gathering as it allows us to proceed with loading the | 491 // cancelling GPUInfo gathering as it allows us to proceed with loading the |
| 490 // blacklist below which may have non-device specific entries we want to | 492 // blacklist below which may have non-device specific entries we want to |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 528 if (update_histograms_) | 530 if (update_histograms_) |
| 529 UpdateStats(gpu_info_, gpu_blacklist_.get(), features); | 531 UpdateStats(gpu_info_, gpu_blacklist_.get(), features); |
| 530 | 532 |
| 531 UpdateBlacklistedFeatures(features); | 533 UpdateBlacklistedFeatures(features); |
| 532 } | 534 } |
| 533 if (gpu_driver_bug_list_) { | 535 if (gpu_driver_bug_list_) { |
| 534 gpu_driver_bugs_ = gpu_driver_bug_list_->MakeDecision( | 536 gpu_driver_bugs_ = gpu_driver_bug_list_->MakeDecision( |
| 535 gpu::GpuControlList::kOsAny, std::string(), gpu_info_); | 537 gpu::GpuControlList::kOsAny, std::string(), gpu_info_); |
| 536 } | 538 } |
| 537 gpu::GpuDriverBugList::AppendWorkaroundsFromCommandLine( | 539 gpu::GpuDriverBugList::AppendWorkaroundsFromCommandLine( |
| 538 &gpu_driver_bugs_, *CommandLine::ForCurrentProcess()); | 540 &gpu_driver_bugs_, *base::CommandLine::ForCurrentProcess()); |
| 539 | 541 |
| 540 // We have to update GpuFeatureType before notify all the observers. | 542 // We have to update GpuFeatureType before notify all the observers. |
| 541 NotifyGpuInfoUpdate(); | 543 NotifyGpuInfoUpdate(); |
| 542 } | 544 } |
| 543 | 545 |
| 544 void GpuDataManagerImplPrivate::UpdateGpuInfo(const gpu::GPUInfo& gpu_info) { | 546 void GpuDataManagerImplPrivate::UpdateGpuInfo(const gpu::GPUInfo& gpu_info) { |
| 545 // No further update of gpu_info if falling back to SwiftShader. | 547 // No further update of gpu_info if falling back to SwiftShader. |
| 546 if (use_swiftshader_) | 548 if (use_swiftshader_) |
| 547 return; | 549 return; |
| 548 | 550 |
| 549 gpu::MergeGPUInfo(&gpu_info_, gpu_info); | 551 gpu::MergeGPUInfo(&gpu_info_, gpu_info); |
| 550 complete_gpu_info_already_requested_ = | 552 complete_gpu_info_already_requested_ = |
| 551 complete_gpu_info_already_requested_ || gpu_info_.finalized; | 553 complete_gpu_info_already_requested_ || gpu_info_.finalized; |
| 552 | 554 |
| 553 UpdateGpuInfoHelper(); | 555 UpdateGpuInfoHelper(); |
| 554 } | 556 } |
| 555 | 557 |
| 556 void GpuDataManagerImplPrivate::UpdateVideoMemoryUsageStats( | 558 void GpuDataManagerImplPrivate::UpdateVideoMemoryUsageStats( |
| 557 const GPUVideoMemoryUsageStats& video_memory_usage_stats) { | 559 const GPUVideoMemoryUsageStats& video_memory_usage_stats) { |
| 558 GpuDataManagerImpl::UnlockedSession session(owner_); | 560 GpuDataManagerImpl::UnlockedSession session(owner_); |
| 559 observer_list_->Notify(&GpuDataManagerObserver::OnVideoMemoryUsageStatsUpdate, | 561 observer_list_->Notify(&GpuDataManagerObserver::OnVideoMemoryUsageStatsUpdate, |
| 560 video_memory_usage_stats); | 562 video_memory_usage_stats); |
| 561 } | 563 } |
| 562 | 564 |
| 563 void GpuDataManagerImplPrivate::AppendRendererCommandLine( | 565 void GpuDataManagerImplPrivate::AppendRendererCommandLine( |
| 564 CommandLine* command_line) const { | 566 base::CommandLine* command_line) const { |
| 565 DCHECK(command_line); | 567 DCHECK(command_line); |
| 566 | 568 |
| 567 if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_ACCELERATED_VIDEO_DECODE) && | 569 if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_ACCELERATED_VIDEO_DECODE) && |
| 568 !command_line->HasSwitch(switches::kDisableAcceleratedVideoDecode)) | 570 !command_line->HasSwitch(switches::kDisableAcceleratedVideoDecode)) |
| 569 command_line->AppendSwitch(switches::kDisableAcceleratedVideoDecode); | 571 command_line->AppendSwitch(switches::kDisableAcceleratedVideoDecode); |
| 570 #if defined(ENABLE_WEBRTC) | 572 #if defined(ENABLE_WEBRTC) |
| 571 if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_ACCELERATED_VIDEO_ENCODE) && | 573 if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_ACCELERATED_VIDEO_ENCODE) && |
| 572 !command_line->HasSwitch(switches::kDisableWebRtcHWEncoding)) | 574 !command_line->HasSwitch(switches::kDisableWebRtcHWEncoding)) |
| 573 command_line->AppendSwitch(switches::kDisableWebRtcHWEncoding); | 575 command_line->AppendSwitch(switches::kDisableWebRtcHWEncoding); |
| 574 #endif | 576 #endif |
| 575 | 577 |
| 576 #if defined(USE_AURA) | 578 #if defined(USE_AURA) |
| 577 if (!CanUseGpuBrowserCompositor()) | 579 if (!CanUseGpuBrowserCompositor()) |
| 578 command_line->AppendSwitch(switches::kDisableGpuCompositing); | 580 command_line->AppendSwitch(switches::kDisableGpuCompositing); |
| 579 #endif | 581 #endif |
| 580 } | 582 } |
| 581 | 583 |
| 582 void GpuDataManagerImplPrivate::AppendGpuCommandLine( | 584 void GpuDataManagerImplPrivate::AppendGpuCommandLine( |
| 583 CommandLine* command_line) const { | 585 base::CommandLine* command_line) const { |
| 584 DCHECK(command_line); | 586 DCHECK(command_line); |
| 585 | 587 |
| 586 std::string use_gl = | 588 std::string use_gl = |
| 587 CommandLine::ForCurrentProcess()->GetSwitchValueASCII(switches::kUseGL); | 589 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
| 590 switches::kUseGL); |
| 588 base::FilePath swiftshader_path = | 591 base::FilePath swiftshader_path = |
| 589 CommandLine::ForCurrentProcess()->GetSwitchValuePath( | 592 base::CommandLine::ForCurrentProcess()->GetSwitchValuePath( |
| 590 switches::kSwiftShaderPath); | 593 switches::kSwiftShaderPath); |
| 591 if (gpu_driver_bugs_.find(gpu::DISABLE_D3D11) != gpu_driver_bugs_.end()) | 594 if (gpu_driver_bugs_.find(gpu::DISABLE_D3D11) != gpu_driver_bugs_.end()) |
| 592 command_line->AppendSwitch(switches::kDisableD3D11); | 595 command_line->AppendSwitch(switches::kDisableD3D11); |
| 593 if (use_swiftshader_) { | 596 if (use_swiftshader_) { |
| 594 command_line->AppendSwitchASCII(switches::kUseGL, "swiftshader"); | 597 command_line->AppendSwitchASCII(switches::kUseGL, "swiftshader"); |
| 595 if (swiftshader_path.empty()) | 598 if (swiftshader_path.empty()) |
| 596 swiftshader_path = swiftshader_path_; | 599 swiftshader_path = swiftshader_path_; |
| 597 } else if ((IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_WEBGL) || | 600 } else if ((IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_WEBGL) || |
| 598 IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_GPU_COMPOSITING) || | 601 IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_GPU_COMPOSITING) || |
| 599 IsFeatureBlacklisted( | 602 IsFeatureBlacklisted( |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 638 base::StringPrintf("0x%04x", gpu_info_.gpu.vendor_id)); | 641 base::StringPrintf("0x%04x", gpu_info_.gpu.vendor_id)); |
| 639 command_line->AppendSwitchASCII(switches::kGpuDeviceID, | 642 command_line->AppendSwitchASCII(switches::kGpuDeviceID, |
| 640 base::StringPrintf("0x%04x", gpu_info_.gpu.device_id)); | 643 base::StringPrintf("0x%04x", gpu_info_.gpu.device_id)); |
| 641 command_line->AppendSwitchASCII(switches::kGpuDriverVendor, | 644 command_line->AppendSwitchASCII(switches::kGpuDriverVendor, |
| 642 gpu_info_.driver_vendor); | 645 gpu_info_.driver_vendor); |
| 643 command_line->AppendSwitchASCII(switches::kGpuDriverVersion, | 646 command_line->AppendSwitchASCII(switches::kGpuDriverVersion, |
| 644 gpu_info_.driver_version); | 647 gpu_info_.driver_version); |
| 645 } | 648 } |
| 646 | 649 |
| 647 void GpuDataManagerImplPrivate::AppendPluginCommandLine( | 650 void GpuDataManagerImplPrivate::AppendPluginCommandLine( |
| 648 CommandLine* command_line) const { | 651 base::CommandLine* command_line) const { |
| 649 DCHECK(command_line); | 652 DCHECK(command_line); |
| 650 | 653 |
| 651 #if defined(OS_MACOSX) | 654 #if defined(OS_MACOSX) |
| 652 // TODO(jbauman): Add proper blacklist support for core animation plugins so | 655 // TODO(jbauman): Add proper blacklist support for core animation plugins so |
| 653 // special-casing this video card won't be necessary. See | 656 // special-casing this video card won't be necessary. See |
| 654 // http://crbug.com/134015 | 657 // http://crbug.com/134015 |
| 655 if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_GPU_COMPOSITING)) { | 658 if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_GPU_COMPOSITING)) { |
| 656 if (!command_line->HasSwitch( | 659 if (!command_line->HasSwitch( |
| 657 switches::kDisableCoreAnimationPlugins)) | 660 switches::kDisableCoreAnimationPlugins)) |
| 658 command_line->AppendSwitch( | 661 command_line->AppendSwitch( |
| (...skipping 26 matching lines...) Expand all Loading... |
| 685 prefs->gl_multisampling_enabled = false; | 688 prefs->gl_multisampling_enabled = false; |
| 686 | 689 |
| 687 #if defined(USE_AURA) | 690 #if defined(USE_AURA) |
| 688 if (!CanUseGpuBrowserCompositor()) { | 691 if (!CanUseGpuBrowserCompositor()) { |
| 689 prefs->accelerated_2d_canvas_enabled = false; | 692 prefs->accelerated_2d_canvas_enabled = false; |
| 690 prefs->pepper_3d_enabled = false; | 693 prefs->pepper_3d_enabled = false; |
| 691 } | 694 } |
| 692 #endif | 695 #endif |
| 693 | 696 |
| 694 if (!IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_ACCELERATED_VIDEO_DECODE) && | 697 if (!IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_ACCELERATED_VIDEO_DECODE) && |
| 695 !CommandLine::ForCurrentProcess()->HasSwitch( | 698 !base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 696 switches::kDisableAcceleratedVideoDecode)) { | 699 switches::kDisableAcceleratedVideoDecode)) { |
| 697 prefs->pepper_accelerated_video_decode_enabled = true; | 700 prefs->pepper_accelerated_video_decode_enabled = true; |
| 698 } | 701 } |
| 699 | 702 |
| 700 if (!IsFeatureBlacklisted( | 703 if (!IsFeatureBlacklisted( |
| 701 gpu::GPU_FEATURE_TYPE_GPU_RASTERIZATION_EXPANDED_HEURISTICS) || | 704 gpu::GPU_FEATURE_TYPE_GPU_RASTERIZATION_EXPANDED_HEURISTICS) || |
| 702 base::FieldTrialList::FindFullName( | 705 base::FieldTrialList::FindFullName( |
| 703 "GpuRasterizationExpandedContentWhitelist") == "Enabled") | 706 "GpuRasterizationExpandedContentWhitelist") == "Enabled") |
| 704 prefs->use_expanded_heuristics_for_gpu_rasterization = true; | 707 prefs->use_expanded_heuristics_for_gpu_rasterization = true; |
| 705 } | 708 } |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 864 use_swiftshader_(false), | 867 use_swiftshader_(false), |
| 865 card_blacklisted_(false), | 868 card_blacklisted_(false), |
| 866 update_histograms_(true), | 869 update_histograms_(true), |
| 867 window_count_(0), | 870 window_count_(0), |
| 868 domain_blocking_enabled_(true), | 871 domain_blocking_enabled_(true), |
| 869 owner_(owner), | 872 owner_(owner), |
| 870 display_count_(0), | 873 display_count_(0), |
| 871 gpu_process_accessible_(true), | 874 gpu_process_accessible_(true), |
| 872 finalized_(false) { | 875 finalized_(false) { |
| 873 DCHECK(owner_); | 876 DCHECK(owner_); |
| 874 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 877 const base::CommandLine* command_line = |
| 878 base::CommandLine::ForCurrentProcess(); |
| 875 if (command_line->HasSwitch(switches::kDisableGpu)) | 879 if (command_line->HasSwitch(switches::kDisableGpu)) |
| 876 DisableHardwareAcceleration(); | 880 DisableHardwareAcceleration(); |
| 877 | 881 |
| 878 #if defined(OS_MACOSX) | 882 #if defined(OS_MACOSX) |
| 879 CGGetActiveDisplayList (0, NULL, &display_count_); | 883 CGGetActiveDisplayList (0, NULL, &display_count_); |
| 880 CGDisplayRegisterReconfigurationCallback(DisplayReconfigCallback, owner_); | 884 CGDisplayRegisterReconfigurationCallback(DisplayReconfigCallback, owner_); |
| 881 #endif // OS_MACOSX | 885 #endif // OS_MACOSX |
| 882 | 886 |
| 883 // For testing only. | 887 // For testing only. |
| 884 if (command_line->HasSwitch(switches::kDisableDomainBlockingFor3DAPIs)) { | 888 if (command_line->HasSwitch(switches::kDisableDomainBlockingFor3DAPIs)) { |
| 885 domain_blocking_enabled_ = false; | 889 domain_blocking_enabled_ = false; |
| 886 } | 890 } |
| 887 } | 891 } |
| 888 | 892 |
| 889 GpuDataManagerImplPrivate::~GpuDataManagerImplPrivate() { | 893 GpuDataManagerImplPrivate::~GpuDataManagerImplPrivate() { |
| 890 #if defined(OS_MACOSX) | 894 #if defined(OS_MACOSX) |
| 891 CGDisplayRemoveReconfigurationCallback(DisplayReconfigCallback, owner_); | 895 CGDisplayRemoveReconfigurationCallback(DisplayReconfigCallback, owner_); |
| 892 #endif | 896 #endif |
| 893 } | 897 } |
| 894 | 898 |
| 895 void GpuDataManagerImplPrivate::InitializeImpl( | 899 void GpuDataManagerImplPrivate::InitializeImpl( |
| 896 const std::string& gpu_blacklist_json, | 900 const std::string& gpu_blacklist_json, |
| 897 const std::string& gpu_driver_bug_list_json, | 901 const std::string& gpu_driver_bug_list_json, |
| 898 const gpu::GPUInfo& gpu_info) { | 902 const gpu::GPUInfo& gpu_info) { |
| 899 const bool log_gpu_control_list_decisions = | 903 const bool log_gpu_control_list_decisions = |
| 900 CommandLine::ForCurrentProcess()->HasSwitch( | 904 base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 901 switches::kLogGpuControlListDecisions); | 905 switches::kLogGpuControlListDecisions); |
| 902 | 906 |
| 903 if (!gpu_blacklist_json.empty()) { | 907 if (!gpu_blacklist_json.empty()) { |
| 904 gpu_blacklist_.reset(gpu::GpuBlacklist::Create()); | 908 gpu_blacklist_.reset(gpu::GpuBlacklist::Create()); |
| 905 if (log_gpu_control_list_decisions) | 909 if (log_gpu_control_list_decisions) |
| 906 gpu_blacklist_->enable_control_list_logging("gpu_blacklist"); | 910 gpu_blacklist_->enable_control_list_logging("gpu_blacklist"); |
| 907 bool success = gpu_blacklist_->LoadList( | 911 bool success = gpu_blacklist_->LoadList( |
| 908 gpu_blacklist_json, gpu::GpuControlList::kCurrentOsOnly); | 912 gpu_blacklist_json, gpu::GpuControlList::kCurrentOsOnly); |
| 909 DCHECK(success); | 913 DCHECK(success); |
| 910 } | 914 } |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 955 } | 959 } |
| 956 | 960 |
| 957 void GpuDataManagerImplPrivate::NotifyGpuInfoUpdate() { | 961 void GpuDataManagerImplPrivate::NotifyGpuInfoUpdate() { |
| 958 observer_list_->Notify(&GpuDataManagerObserver::OnGpuInfoUpdate); | 962 observer_list_->Notify(&GpuDataManagerObserver::OnGpuInfoUpdate); |
| 959 } | 963 } |
| 960 | 964 |
| 961 void GpuDataManagerImplPrivate::EnableSwiftShaderIfNecessary() { | 965 void GpuDataManagerImplPrivate::EnableSwiftShaderIfNecessary() { |
| 962 if (!GpuAccessAllowed(NULL) || | 966 if (!GpuAccessAllowed(NULL) || |
| 963 blacklisted_features_.count(gpu::GPU_FEATURE_TYPE_WEBGL)) { | 967 blacklisted_features_.count(gpu::GPU_FEATURE_TYPE_WEBGL)) { |
| 964 if (!swiftshader_path_.empty() && | 968 if (!swiftshader_path_.empty() && |
| 965 !CommandLine::ForCurrentProcess()->HasSwitch( | 969 !base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 966 switches::kDisableSoftwareRasterizer)) | 970 switches::kDisableSoftwareRasterizer)) |
| 967 use_swiftshader_ = true; | 971 use_swiftshader_ = true; |
| 968 } | 972 } |
| 969 } | 973 } |
| 970 | 974 |
| 971 std::string GpuDataManagerImplPrivate::GetDomainFromURL( | 975 std::string GpuDataManagerImplPrivate::GetDomainFromURL( |
| 972 const GURL& url) const { | 976 const GURL& url) const { |
| 973 // For the moment, we just use the host, or its IP address, as the | 977 // For the moment, we just use the host, or its IP address, as the |
| 974 // entry in the set, rather than trying to figure out the top-level | 978 // entry in the set, rather than trying to figure out the top-level |
| 975 // domain. This does mean that a.foo.com and b.foo.com will be | 979 // domain. This does mean that a.foo.com and b.foo.com will be |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1075 | 1079 |
| 1076 void GpuDataManagerImplPrivate::OnGpuProcessInitFailure() { | 1080 void GpuDataManagerImplPrivate::OnGpuProcessInitFailure() { |
| 1077 gpu_process_accessible_ = false; | 1081 gpu_process_accessible_ = false; |
| 1078 gpu_info_.finalized = true; | 1082 gpu_info_.finalized = true; |
| 1079 complete_gpu_info_already_requested_ = true; | 1083 complete_gpu_info_already_requested_ = true; |
| 1080 // Some observers might be waiting. | 1084 // Some observers might be waiting. |
| 1081 NotifyGpuInfoUpdate(); | 1085 NotifyGpuInfoUpdate(); |
| 1082 } | 1086 } |
| 1083 | 1087 |
| 1084 } // namespace content | 1088 } // namespace content |
| OLD | NEW |