| 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 703 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 714 } else if (was_info_available) { | 714 } else if (was_info_available) { |
| 715 // Allow future requests to go through properly. | 715 // Allow future requests to go through properly. |
| 716 complete_gpu_info_already_requested_ = false; | 716 complete_gpu_info_already_requested_ = false; |
| 717 } | 717 } |
| 718 | 718 |
| 719 UpdateGpuInfoHelper(); | 719 UpdateGpuInfoHelper(); |
| 720 } | 720 } |
| 721 | 721 |
| 722 void GpuDataManagerImplPrivate::UpdateGpuFeatureInfo( | 722 void GpuDataManagerImplPrivate::UpdateGpuFeatureInfo( |
| 723 const gpu::GpuFeatureInfo& gpu_feature_info) { | 723 const gpu::GpuFeatureInfo& gpu_feature_info) { |
| 724 gpu_feature_info_ = gpu_feature_info; | 724 if (!use_swiftshader_) { |
| 725 gpu_feature_info_ = gpu_feature_info; |
| 726 } |
| 725 } | 727 } |
| 726 | 728 |
| 727 void GpuDataManagerImplPrivate::UpdateVideoMemoryUsageStats( | 729 void GpuDataManagerImplPrivate::UpdateVideoMemoryUsageStats( |
| 728 const gpu::VideoMemoryUsageStats& video_memory_usage_stats) { | 730 const gpu::VideoMemoryUsageStats& video_memory_usage_stats) { |
| 729 GpuDataManagerImpl::UnlockedSession session(owner_); | 731 GpuDataManagerImpl::UnlockedSession session(owner_); |
| 730 observer_list_->Notify(FROM_HERE, | 732 observer_list_->Notify(FROM_HERE, |
| 731 &GpuDataManagerObserver::OnVideoMemoryUsageStatsUpdate, | 733 &GpuDataManagerObserver::OnVideoMemoryUsageStatsUpdate, |
| 732 video_memory_usage_stats); | 734 video_memory_usage_stats); |
| 733 } | 735 } |
| 734 | 736 |
| (...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1270 ui::GpuSwitchingManager::GetInstance()->SetGpuVendorIds(vendor_ids); | 1272 ui::GpuSwitchingManager::GetInstance()->SetGpuVendorIds(vendor_ids); |
| 1271 gpu::InitializeDualGpusIfSupported(gpu_driver_bugs_); | 1273 gpu::InitializeDualGpusIfSupported(gpu_driver_bugs_); |
| 1272 } | 1274 } |
| 1273 | 1275 |
| 1274 void GpuDataManagerImplPrivate::NotifyGpuInfoUpdate() { | 1276 void GpuDataManagerImplPrivate::NotifyGpuInfoUpdate() { |
| 1275 observer_list_->Notify(FROM_HERE, &GpuDataManagerObserver::OnGpuInfoUpdate); | 1277 observer_list_->Notify(FROM_HERE, &GpuDataManagerObserver::OnGpuInfoUpdate); |
| 1276 } | 1278 } |
| 1277 | 1279 |
| 1278 void GpuDataManagerImplPrivate::EnableSwiftShaderIfNecessary() { | 1280 void GpuDataManagerImplPrivate::EnableSwiftShaderIfNecessary() { |
| 1279 #if BUILDFLAG(ENABLE_SWIFTSHADER) | 1281 #if BUILDFLAG(ENABLE_SWIFTSHADER) |
| 1280 if (!GpuAccessAllowed(nullptr) || | 1282 if ((!GpuAccessAllowed(nullptr) || |
| 1281 blacklisted_features_.count(gpu::GPU_FEATURE_TYPE_ACCELERATED_WEBGL)) { | 1283 blacklisted_features_.count(gpu::GPU_FEATURE_TYPE_ACCELERATED_WEBGL)) && |
| 1282 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( | 1284 !base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 1283 switches::kDisableSoftwareRasterizer)) | 1285 switches::kDisableSoftwareRasterizer)) { |
| 1284 use_swiftshader_ = true; | 1286 use_swiftshader_ = true; |
| 1287 |
| 1288 // Remove all previously recorded GPU info |
| 1289 gpu_info_ = gpu::GPUInfo(); |
| 1290 // Set some basic info to identify the GPU as SwiftShader |
| 1291 gpu_info_.gl_vendor = "Google Inc."; |
| 1292 gpu_info_.gl_renderer = "Google SwiftShader"; |
| 1293 gpu_info_.software_rendering = true; |
| 1294 |
| 1295 for (auto& status : gpu_feature_info_.status_values) |
| 1296 status = gpu::kGpuFeatureStatusBlacklisted; |
| 1285 } | 1297 } |
| 1286 #endif | 1298 #endif |
| 1287 } | 1299 } |
| 1288 | 1300 |
| 1289 std::string GpuDataManagerImplPrivate::GetDomainFromURL( | 1301 std::string GpuDataManagerImplPrivate::GetDomainFromURL( |
| 1290 const GURL& url) const { | 1302 const GURL& url) const { |
| 1291 // For the moment, we just use the host, or its IP address, as the | 1303 // For the moment, we just use the host, or its IP address, as the |
| 1292 // entry in the set, rather than trying to figure out the top-level | 1304 // entry in the set, rather than trying to figure out the top-level |
| 1293 // domain. This does mean that a.foo.com and b.foo.com will be | 1305 // domain. This does mean that a.foo.com and b.foo.com will be |
| 1294 // treated independently in the blocking of a given domain, but it | 1306 // treated independently in the blocking of a given domain, but it |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1392 gpu_info_.context_info_state = gpu::kCollectInfoFatalFailure; | 1404 gpu_info_.context_info_state = gpu::kCollectInfoFatalFailure; |
| 1393 #if defined(OS_WIN) | 1405 #if defined(OS_WIN) |
| 1394 gpu_info_.dx_diagnostics_info_state = gpu::kCollectInfoFatalFailure; | 1406 gpu_info_.dx_diagnostics_info_state = gpu::kCollectInfoFatalFailure; |
| 1395 #endif | 1407 #endif |
| 1396 complete_gpu_info_already_requested_ = true; | 1408 complete_gpu_info_already_requested_ = true; |
| 1397 // Some observers might be waiting. | 1409 // Some observers might be waiting. |
| 1398 NotifyGpuInfoUpdate(); | 1410 NotifyGpuInfoUpdate(); |
| 1399 } | 1411 } |
| 1400 | 1412 |
| 1401 } // namespace content | 1413 } // namespace content |
| OLD | NEW |