Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(29)

Side by Side Diff: content/browser/gpu/gpu_data_manager_impl_private.cc

Issue 2715563002: Moving SwiftShader from component to bundled library (Closed)
Patch Set: Update past extension test fixes Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 25 matching lines...) Expand all
36 #include "gpu/config/gpu_control_list_jsons.h" 36 #include "gpu/config/gpu_control_list_jsons.h"
37 #include "gpu/config/gpu_driver_bug_workaround_type.h" 37 #include "gpu/config/gpu_driver_bug_workaround_type.h"
38 #include "gpu/config/gpu_feature_type.h" 38 #include "gpu/config/gpu_feature_type.h"
39 #include "gpu/config/gpu_info_collector.h" 39 #include "gpu/config/gpu_info_collector.h"
40 #include "gpu/config/gpu_switches.h" 40 #include "gpu/config/gpu_switches.h"
41 #include "gpu/config/gpu_util.h" 41 #include "gpu/config/gpu_util.h"
42 #include "gpu/ipc/common/memory_stats.h" 42 #include "gpu/ipc/common/memory_stats.h"
43 #include "gpu/ipc/service/switches.h" 43 #include "gpu/ipc/service/switches.h"
44 #include "media/media_features.h" 44 #include "media/media_features.h"
45 #include "ui/base/ui_base_switches.h" 45 #include "ui/base/ui_base_switches.h"
46 #include "ui/gl/gl_features.h"
46 #include "ui/gl/gl_implementation.h" 47 #include "ui/gl/gl_implementation.h"
47 #include "ui/gl/gl_switches.h" 48 #include "ui/gl/gl_switches.h"
48 #include "ui/gl/gpu_switching_manager.h" 49 #include "ui/gl/gpu_switching_manager.h"
49 50
50 #if defined(USE_OZONE) 51 #if defined(USE_OZONE)
51 #include "ui/ozone/public/ozone_switches.h" 52 #include "ui/ozone/public/ozone_switches.h"
52 #endif 53 #endif
53 #if defined(OS_MACOSX) 54 #if defined(OS_MACOSX)
54 #include <ApplicationServices/ApplicationServices.h> 55 #include <ApplicationServices/ApplicationServices.h>
55 #endif // OS_MACOSX 56 #endif // OS_MACOSX
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after
445 void GpuDataManagerImplPrivate::RequestVideoMemoryUsageStatsUpdate() const { 446 void GpuDataManagerImplPrivate::RequestVideoMemoryUsageStatsUpdate() const {
446 GpuProcessHost::CallOnIO(GpuProcessHost::GPU_PROCESS_KIND_SANDBOXED, 447 GpuProcessHost::CallOnIO(GpuProcessHost::GPU_PROCESS_KIND_SANDBOXED,
447 false /* force_create */, 448 false /* force_create */,
448 base::Bind(&RequestVideoMemoryUsageStats)); 449 base::Bind(&RequestVideoMemoryUsageStats));
449 } 450 }
450 451
451 bool GpuDataManagerImplPrivate::ShouldUseSwiftShader() const { 452 bool GpuDataManagerImplPrivate::ShouldUseSwiftShader() const {
452 return use_swiftshader_; 453 return use_swiftshader_;
453 } 454 }
454 455
455 void GpuDataManagerImplPrivate::RegisterSwiftShaderPath(
456 const base::FilePath& path) {
457 swiftshader_path_ = path;
458 EnableSwiftShaderIfNecessary();
459 }
460
461 void GpuDataManagerImplPrivate::AddObserver(GpuDataManagerObserver* observer) { 456 void GpuDataManagerImplPrivate::AddObserver(GpuDataManagerObserver* observer) {
462 GpuDataManagerImpl::UnlockedSession session(owner_); 457 GpuDataManagerImpl::UnlockedSession session(owner_);
463 observer_list_->AddObserver(observer); 458 observer_list_->AddObserver(observer);
464 } 459 }
465 460
466 void GpuDataManagerImplPrivate::RemoveObserver( 461 void GpuDataManagerImplPrivate::RemoveObserver(
467 GpuDataManagerObserver* observer) { 462 GpuDataManagerObserver* observer) {
468 GpuDataManagerImpl::UnlockedSession session(owner_); 463 GpuDataManagerImpl::UnlockedSession session(owner_);
469 observer_list_->RemoveObserver(observer); 464 observer_list_->RemoveObserver(observer);
470 } 465 }
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
759 switches::kUseGL, 754 switches::kUseGL,
760 gl::GetGLImplementationName(gl::GetSoftwareGLImplementation())); 755 gl::GetGLImplementationName(gl::GetSoftwareGLImplementation()));
761 } else if (!use_gl.empty()) { 756 } else if (!use_gl.empty()) {
762 command_line->AppendSwitchASCII(switches::kUseGL, use_gl); 757 command_line->AppendSwitchASCII(switches::kUseGL, use_gl);
763 } 758 }
764 if (ui::GpuSwitchingManager::GetInstance()->SupportsDualGpus()) 759 if (ui::GpuSwitchingManager::GetInstance()->SupportsDualGpus())
765 command_line->AppendSwitchASCII(switches::kSupportsDualGpus, "true"); 760 command_line->AppendSwitchASCII(switches::kSupportsDualGpus, "true");
766 else 761 else
767 command_line->AppendSwitchASCII(switches::kSupportsDualGpus, "false"); 762 command_line->AppendSwitchASCII(switches::kSupportsDualGpus, "false");
768 763
769 if (!swiftshader_path_.empty()) {
770 command_line->AppendSwitchPath(switches::kSwiftShaderPath,
771 swiftshader_path_);
772 }
773
774 if (!gpu_driver_bugs_.empty()) { 764 if (!gpu_driver_bugs_.empty()) {
775 command_line->AppendSwitchASCII(switches::kGpuDriverBugWorkarounds, 765 command_line->AppendSwitchASCII(switches::kGpuDriverBugWorkarounds,
776 IntSetToString(gpu_driver_bugs_)); 766 IntSetToString(gpu_driver_bugs_));
777 } 767 }
778 768
779 if (!disabled_extensions_.empty()) { 769 if (!disabled_extensions_.empty()) {
780 command_line->AppendSwitchASCII(switches::kDisableGLExtensions, 770 command_line->AppendSwitchASCII(switches::kDisableGLExtensions,
781 disabled_extensions_); 771 disabled_extensions_);
782 } 772 }
783 773
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after
1145 update_histograms_(true), 1135 update_histograms_(true),
1146 domain_blocking_enabled_(true), 1136 domain_blocking_enabled_(true),
1147 owner_(owner), 1137 owner_(owner),
1148 gpu_process_accessible_(true), 1138 gpu_process_accessible_(true),
1149 is_initialized_(false), 1139 is_initialized_(false),
1150 finalized_(false), 1140 finalized_(false),
1151 in_process_gpu_(false) { 1141 in_process_gpu_(false) {
1152 DCHECK(owner_); 1142 DCHECK(owner_);
1153 const base::CommandLine* command_line = 1143 const base::CommandLine* command_line =
1154 base::CommandLine::ForCurrentProcess(); 1144 base::CommandLine::ForCurrentProcess();
1155 swiftshader_path_ = command_line->GetSwitchValuePath(
1156 switches::kSwiftShaderPath);
1157 if (ShouldDisableHardwareAcceleration()) 1145 if (ShouldDisableHardwareAcceleration())
1158 DisableHardwareAcceleration(); 1146 DisableHardwareAcceleration();
1159 1147
1160 if (command_line->HasSwitch(switches::kSingleProcess) || 1148 if (command_line->HasSwitch(switches::kSingleProcess) ||
1161 command_line->HasSwitch(switches::kInProcessGPU)) { 1149 command_line->HasSwitch(switches::kInProcessGPU)) {
1162 in_process_gpu_ = true; 1150 in_process_gpu_ = true;
1163 } 1151 }
1164 1152
1165 #if defined(OS_MACOSX) 1153 #if defined(OS_MACOSX)
1166 CGDisplayRegisterReconfigurationCallback(DisplayReconfigCallback, owner_); 1154 CGDisplayRegisterReconfigurationCallback(DisplayReconfigCallback, owner_);
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
1251 } 1239 }
1252 ui::GpuSwitchingManager::GetInstance()->SetGpuVendorIds(vendor_ids); 1240 ui::GpuSwitchingManager::GetInstance()->SetGpuVendorIds(vendor_ids);
1253 gpu::InitializeDualGpusIfSupported(gpu_driver_bugs_); 1241 gpu::InitializeDualGpusIfSupported(gpu_driver_bugs_);
1254 } 1242 }
1255 1243
1256 void GpuDataManagerImplPrivate::NotifyGpuInfoUpdate() { 1244 void GpuDataManagerImplPrivate::NotifyGpuInfoUpdate() {
1257 observer_list_->Notify(FROM_HERE, &GpuDataManagerObserver::OnGpuInfoUpdate); 1245 observer_list_->Notify(FROM_HERE, &GpuDataManagerObserver::OnGpuInfoUpdate);
1258 } 1246 }
1259 1247
1260 void GpuDataManagerImplPrivate::EnableSwiftShaderIfNecessary() { 1248 void GpuDataManagerImplPrivate::EnableSwiftShaderIfNecessary() {
1261 if (!GpuAccessAllowed(NULL) || 1249 #if BUILDFLAG(ENABLE_SWIFTSHADER)
1250 if (!GpuAccessAllowed(nullptr) ||
1262 blacklisted_features_.count(gpu::GPU_FEATURE_TYPE_ACCELERATED_WEBGL)) { 1251 blacklisted_features_.count(gpu::GPU_FEATURE_TYPE_ACCELERATED_WEBGL)) {
1263 if (!swiftshader_path_.empty() && 1252 if (!base::CommandLine::ForCurrentProcess()->HasSwitch(
1264 !base::CommandLine::ForCurrentProcess()->HasSwitch( 1253 switches::kDisableSoftwareRasterizer))
1265 switches::kDisableSoftwareRasterizer))
1266 use_swiftshader_ = true; 1254 use_swiftshader_ = true;
1267 } 1255 }
1256 #endif
1268 } 1257 }
1269 1258
1270 std::string GpuDataManagerImplPrivate::GetDomainFromURL( 1259 std::string GpuDataManagerImplPrivate::GetDomainFromURL(
1271 const GURL& url) const { 1260 const GURL& url) const {
1272 // For the moment, we just use the host, or its IP address, as the 1261 // For the moment, we just use the host, or its IP address, as the
1273 // entry in the set, rather than trying to figure out the top-level 1262 // entry in the set, rather than trying to figure out the top-level
1274 // domain. This does mean that a.foo.com and b.foo.com will be 1263 // domain. This does mean that a.foo.com and b.foo.com will be
1275 // treated independently in the blocking of a given domain, but it 1264 // treated independently in the blocking of a given domain, but it
1276 // would require a third-party library to reliably figure out the 1265 // would require a third-party library to reliably figure out the
1277 // top-level domain from a URL. 1266 // top-level domain from a URL.
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
1373 gpu_info_.context_info_state = gpu::kCollectInfoFatalFailure; 1362 gpu_info_.context_info_state = gpu::kCollectInfoFatalFailure;
1374 #if defined(OS_WIN) 1363 #if defined(OS_WIN)
1375 gpu_info_.dx_diagnostics_info_state = gpu::kCollectInfoFatalFailure; 1364 gpu_info_.dx_diagnostics_info_state = gpu::kCollectInfoFatalFailure;
1376 #endif 1365 #endif
1377 complete_gpu_info_already_requested_ = true; 1366 complete_gpu_info_already_requested_ = true;
1378 // Some observers might be waiting. 1367 // Some observers might be waiting.
1379 NotifyGpuInfoUpdate(); 1368 NotifyGpuInfoUpdate();
1380 } 1369 }
1381 1370
1382 } // namespace content 1371 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/gpu/gpu_data_manager_impl_private.h ('k') | content/browser/gpu/gpu_data_manager_impl_private_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698