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 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
405 } | 405 } |
406 | 406 |
407 void GpuDataManagerImplPrivate::RegisterSwiftShaderPath( | 407 void GpuDataManagerImplPrivate::RegisterSwiftShaderPath( |
408 const base::FilePath& path) { | 408 const base::FilePath& path) { |
409 swiftshader_path_ = path; | 409 swiftshader_path_ = path; |
410 EnableSwiftShaderIfNecessary(); | 410 EnableSwiftShaderIfNecessary(); |
411 } | 411 } |
412 | 412 |
413 bool GpuDataManagerImplPrivate::ShouldUseWarp() const { | 413 bool GpuDataManagerImplPrivate::ShouldUseWarp() const { |
414 return use_warp_ || | 414 return use_warp_ || |
415 CommandLine::ForCurrentProcess()->HasSwitch(switches::kUseWarp); | 415 base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kUseWarp); |
416 } | 416 } |
417 | 417 |
418 void GpuDataManagerImplPrivate::AddObserver(GpuDataManagerObserver* observer) { | 418 void GpuDataManagerImplPrivate::AddObserver(GpuDataManagerObserver* observer) { |
419 GpuDataManagerImpl::UnlockedSession session(owner_); | 419 GpuDataManagerImpl::UnlockedSession session(owner_); |
420 observer_list_->AddObserver(observer); | 420 observer_list_->AddObserver(observer); |
421 } | 421 } |
422 | 422 |
423 void GpuDataManagerImplPrivate::RemoveObserver( | 423 void GpuDataManagerImplPrivate::RemoveObserver( |
424 GpuDataManagerObserver* observer) { | 424 GpuDataManagerObserver* observer) { |
425 GpuDataManagerImpl::UnlockedSession session(owner_); | 425 GpuDataManagerImpl::UnlockedSession session(owner_); |
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
839 gpu_info_.secondary_gpus[ii].active = false; | 839 gpu_info_.secondary_gpus[ii].active = false; |
840 } | 840 } |
841 } | 841 } |
842 gpu_info_.gpu.active = false; | 842 gpu_info_.gpu.active = false; |
843 } | 843 } |
844 UpdateGpuInfoHelper(); | 844 UpdateGpuInfoHelper(); |
845 return true; | 845 return true; |
846 } | 846 } |
847 | 847 |
848 bool GpuDataManagerImplPrivate::CanUseGpuBrowserCompositor() const { | 848 bool GpuDataManagerImplPrivate::CanUseGpuBrowserCompositor() const { |
849 if (CommandLine::ForCurrentProcess()->HasSwitch( | 849 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
850 switches::kDisableGpuCompositing)) | 850 switches::kDisableGpuCompositing)) |
851 return false; | 851 return false; |
852 if (ShouldUseWarp()) | 852 if (ShouldUseWarp()) |
853 return true; | 853 return true; |
854 if (ShouldUseSwiftShader()) | 854 if (ShouldUseSwiftShader()) |
855 return false; | 855 return false; |
856 if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_GPU_COMPOSITING)) | 856 if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_GPU_COMPOSITING)) |
857 return false; | 857 return false; |
858 return true; | 858 return true; |
859 } | 859 } |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1008 use_swiftshader_ = true; | 1008 use_swiftshader_ = true; |
1009 } | 1009 } |
1010 } | 1010 } |
1011 | 1011 |
1012 void GpuDataManagerImplPrivate::EnableWarpIfNecessary() { | 1012 void GpuDataManagerImplPrivate::EnableWarpIfNecessary() { |
1013 #if defined(OS_WIN) | 1013 #if defined(OS_WIN) |
1014 if (use_warp_) | 1014 if (use_warp_) |
1015 return; | 1015 return; |
1016 // We should only use WARP if we are unable to use the regular GPU for | 1016 // We should only use WARP if we are unable to use the regular GPU for |
1017 // compositing, and if we in Metro mode. | 1017 // compositing, and if we in Metro mode. |
1018 use_warp_ = | 1018 use_warp_ = base::CommandLine::ForCurrentProcess()->HasSwitch( |
1019 CommandLine::ForCurrentProcess()->HasSwitch(switches::kViewerConnect) && | 1019 switches::kViewerConnect) && |
1020 !CanUseGpuBrowserCompositor(); | 1020 !CanUseGpuBrowserCompositor(); |
1021 #endif | 1021 #endif |
1022 } | 1022 } |
1023 | 1023 |
1024 void GpuDataManagerImplPrivate::ForceWarpModeForTesting() { | 1024 void GpuDataManagerImplPrivate::ForceWarpModeForTesting() { |
1025 use_warp_ = true; | 1025 use_warp_ = true; |
1026 } | 1026 } |
1027 | 1027 |
1028 std::string GpuDataManagerImplPrivate::GetDomainFromURL( | 1028 std::string GpuDataManagerImplPrivate::GetDomainFromURL( |
1029 const GURL& url) const { | 1029 const GURL& url) const { |
1030 // For the moment, we just use the host, or its IP address, as the | 1030 // For the moment, we just use the host, or its IP address, as the |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1135 gpu_info_.context_info_state = gpu::kCollectInfoFatalFailure; | 1135 gpu_info_.context_info_state = gpu::kCollectInfoFatalFailure; |
1136 #if defined(OS_WIN) | 1136 #if defined(OS_WIN) |
1137 gpu_info_.dx_diagnostics_info_state = gpu::kCollectInfoFatalFailure; | 1137 gpu_info_.dx_diagnostics_info_state = gpu::kCollectInfoFatalFailure; |
1138 #endif | 1138 #endif |
1139 complete_gpu_info_already_requested_ = true; | 1139 complete_gpu_info_already_requested_ = true; |
1140 // Some observers might be waiting. | 1140 // Some observers might be waiting. |
1141 NotifyGpuInfoUpdate(); | 1141 NotifyGpuInfoUpdate(); |
1142 } | 1142 } |
1143 | 1143 |
1144 } // namespace content | 1144 } // namespace content |
OLD | NEW |