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 <algorithm> | 7 #include <algorithm> |
8 #include <iterator> | 8 #include <iterator> |
9 #include <memory> | 9 #include <memory> |
10 #include <utility> | 10 #include <utility> |
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
433 void GpuDataManagerImplPrivate::RequestVideoMemoryUsageStatsUpdate() const { | 433 void GpuDataManagerImplPrivate::RequestVideoMemoryUsageStatsUpdate() const { |
434 GpuProcessHost::SendOnIO(GpuProcessHost::GPU_PROCESS_KIND_SANDBOXED, | 434 GpuProcessHost::SendOnIO(GpuProcessHost::GPU_PROCESS_KIND_SANDBOXED, |
435 false /* force_create */, | 435 false /* force_create */, |
436 new GpuMsg_GetVideoMemoryUsageStats()); | 436 new GpuMsg_GetVideoMemoryUsageStats()); |
437 } | 437 } |
438 | 438 |
439 bool GpuDataManagerImplPrivate::ShouldUseSwiftShader() const { | 439 bool GpuDataManagerImplPrivate::ShouldUseSwiftShader() const { |
440 return use_swiftshader_; | 440 return use_swiftshader_; |
441 } | 441 } |
442 | 442 |
443 void GpuDataManagerImplPrivate::RegisterSwiftShaderPath( | |
444 const base::FilePath& path) { | |
445 swiftshader_path_ = path; | |
446 EnableSwiftShaderIfNecessary(); | |
447 } | |
448 | |
449 void GpuDataManagerImplPrivate::AddObserver(GpuDataManagerObserver* observer) { | 443 void GpuDataManagerImplPrivate::AddObserver(GpuDataManagerObserver* observer) { |
450 GpuDataManagerImpl::UnlockedSession session(owner_); | 444 GpuDataManagerImpl::UnlockedSession session(owner_); |
451 observer_list_->AddObserver(observer); | 445 observer_list_->AddObserver(observer); |
452 } | 446 } |
453 | 447 |
454 void GpuDataManagerImplPrivate::RemoveObserver( | 448 void GpuDataManagerImplPrivate::RemoveObserver( |
455 GpuDataManagerObserver* observer) { | 449 GpuDataManagerObserver* observer) { |
456 GpuDataManagerImpl::UnlockedSession session(owner_); | 450 GpuDataManagerImpl::UnlockedSession session(owner_); |
457 observer_list_->RemoveObserver(observer); | 451 observer_list_->RemoveObserver(observer); |
458 } | 452 } |
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
747 switches::kUseGL, | 741 switches::kUseGL, |
748 gl::GetGLImplementationName(gl::GetSoftwareGLImplementation())); | 742 gl::GetGLImplementationName(gl::GetSoftwareGLImplementation())); |
749 } else if (!use_gl.empty()) { | 743 } else if (!use_gl.empty()) { |
750 command_line->AppendSwitchASCII(switches::kUseGL, use_gl); | 744 command_line->AppendSwitchASCII(switches::kUseGL, use_gl); |
751 } | 745 } |
752 if (ui::GpuSwitchingManager::GetInstance()->SupportsDualGpus()) | 746 if (ui::GpuSwitchingManager::GetInstance()->SupportsDualGpus()) |
753 command_line->AppendSwitchASCII(switches::kSupportsDualGpus, "true"); | 747 command_line->AppendSwitchASCII(switches::kSupportsDualGpus, "true"); |
754 else | 748 else |
755 command_line->AppendSwitchASCII(switches::kSupportsDualGpus, "false"); | 749 command_line->AppendSwitchASCII(switches::kSupportsDualGpus, "false"); |
756 | 750 |
757 if (!swiftshader_path_.empty()) { | |
758 command_line->AppendSwitchPath(switches::kSwiftShaderPath, | |
759 swiftshader_path_); | |
760 } | |
761 | |
762 if (!gpu_driver_bugs_.empty()) { | 751 if (!gpu_driver_bugs_.empty()) { |
763 command_line->AppendSwitchASCII(switches::kGpuDriverBugWorkarounds, | 752 command_line->AppendSwitchASCII(switches::kGpuDriverBugWorkarounds, |
764 IntSetToString(gpu_driver_bugs_)); | 753 IntSetToString(gpu_driver_bugs_)); |
765 } | 754 } |
766 | 755 |
767 if (!disabled_extensions_.empty()) { | 756 if (!disabled_extensions_.empty()) { |
768 command_line->AppendSwitchASCII(switches::kDisableGLExtensions, | 757 command_line->AppendSwitchASCII(switches::kDisableGLExtensions, |
769 disabled_extensions_); | 758 disabled_extensions_); |
770 } | 759 } |
771 | 760 |
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1132 update_histograms_(true), | 1121 update_histograms_(true), |
1133 domain_blocking_enabled_(true), | 1122 domain_blocking_enabled_(true), |
1134 owner_(owner), | 1123 owner_(owner), |
1135 gpu_process_accessible_(true), | 1124 gpu_process_accessible_(true), |
1136 is_initialized_(false), | 1125 is_initialized_(false), |
1137 finalized_(false), | 1126 finalized_(false), |
1138 in_process_gpu_(false) { | 1127 in_process_gpu_(false) { |
1139 DCHECK(owner_); | 1128 DCHECK(owner_); |
1140 const base::CommandLine* command_line = | 1129 const base::CommandLine* command_line = |
1141 base::CommandLine::ForCurrentProcess(); | 1130 base::CommandLine::ForCurrentProcess(); |
1142 swiftshader_path_ = command_line->GetSwitchValuePath( | |
1143 switches::kSwiftShaderPath); | |
1144 if (ShouldDisableHardwareAcceleration()) | 1131 if (ShouldDisableHardwareAcceleration()) |
1145 DisableHardwareAcceleration(); | 1132 DisableHardwareAcceleration(); |
1146 | 1133 |
1147 if (command_line->HasSwitch(switches::kSingleProcess) || | 1134 if (command_line->HasSwitch(switches::kSingleProcess) || |
1148 command_line->HasSwitch(switches::kInProcessGPU)) { | 1135 command_line->HasSwitch(switches::kInProcessGPU)) { |
1149 in_process_gpu_ = true; | 1136 in_process_gpu_ = true; |
1150 } | 1137 } |
1151 | 1138 |
1152 #if defined(OS_MACOSX) | 1139 #if defined(OS_MACOSX) |
1153 CGDisplayRegisterReconfigurationCallback(DisplayReconfigCallback, owner_); | 1140 CGDisplayRegisterReconfigurationCallback(DisplayReconfigCallback, owner_); |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1238 gpu::InitializeDualGpusIfSupported(gpu_driver_bugs_); | 1225 gpu::InitializeDualGpusIfSupported(gpu_driver_bugs_); |
1239 } | 1226 } |
1240 | 1227 |
1241 void GpuDataManagerImplPrivate::NotifyGpuInfoUpdate() { | 1228 void GpuDataManagerImplPrivate::NotifyGpuInfoUpdate() { |
1242 observer_list_->Notify(FROM_HERE, &GpuDataManagerObserver::OnGpuInfoUpdate); | 1229 observer_list_->Notify(FROM_HERE, &GpuDataManagerObserver::OnGpuInfoUpdate); |
1243 } | 1230 } |
1244 | 1231 |
1245 void GpuDataManagerImplPrivate::EnableSwiftShaderIfNecessary() { | 1232 void GpuDataManagerImplPrivate::EnableSwiftShaderIfNecessary() { |
1246 if (!GpuAccessAllowed(NULL) || | 1233 if (!GpuAccessAllowed(NULL) || |
1247 blacklisted_features_.count(gpu::GPU_FEATURE_TYPE_WEBGL)) { | 1234 blacklisted_features_.count(gpu::GPU_FEATURE_TYPE_WEBGL)) { |
1248 if (!swiftshader_path_.empty() && | 1235 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( |
jbauman
2017/02/23 04:30:45
Check BUILDFLAG(ENABLE_SWIFTSHADER) here. Otherwis
sugoi
2017/02/28 16:45:09
Done.
| |
1249 !base::CommandLine::ForCurrentProcess()->HasSwitch( | 1236 switches::kDisableSoftwareRasterizer)) |
1250 switches::kDisableSoftwareRasterizer)) | |
1251 use_swiftshader_ = true; | 1237 use_swiftshader_ = true; |
1252 } | 1238 } |
1253 } | 1239 } |
1254 | 1240 |
1255 std::string GpuDataManagerImplPrivate::GetDomainFromURL( | 1241 std::string GpuDataManagerImplPrivate::GetDomainFromURL( |
1256 const GURL& url) const { | 1242 const GURL& url) const { |
1257 // For the moment, we just use the host, or its IP address, as the | 1243 // For the moment, we just use the host, or its IP address, as the |
1258 // entry in the set, rather than trying to figure out the top-level | 1244 // entry in the set, rather than trying to figure out the top-level |
1259 // domain. This does mean that a.foo.com and b.foo.com will be | 1245 // domain. This does mean that a.foo.com and b.foo.com will be |
1260 // treated independently in the blocking of a given domain, but it | 1246 // treated independently in the blocking of a given domain, but it |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1358 gpu_info_.context_info_state = gpu::kCollectInfoFatalFailure; | 1344 gpu_info_.context_info_state = gpu::kCollectInfoFatalFailure; |
1359 #if defined(OS_WIN) | 1345 #if defined(OS_WIN) |
1360 gpu_info_.dx_diagnostics_info_state = gpu::kCollectInfoFatalFailure; | 1346 gpu_info_.dx_diagnostics_info_state = gpu::kCollectInfoFatalFailure; |
1361 #endif | 1347 #endif |
1362 complete_gpu_info_already_requested_ = true; | 1348 complete_gpu_info_already_requested_ = true; |
1363 // Some observers might be waiting. | 1349 // Some observers might be waiting. |
1364 NotifyGpuInfoUpdate(); | 1350 NotifyGpuInfoUpdate(); |
1365 } | 1351 } |
1366 | 1352 |
1367 } // namespace content | 1353 } // namespace content |
OLD | NEW |