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 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 // Skia's software rendering is probably more efficient than going through | 302 // Skia's software rendering is probably more efficient than going through |
303 // software emulation of the GPU, so use that. | 303 // software emulation of the GPU, so use that. |
304 if (feature == gpu::GPU_FEATURE_TYPE_ACCELERATED_2D_CANVAS) | 304 if (feature == gpu::GPU_FEATURE_TYPE_ACCELERATED_2D_CANVAS) |
305 return true; | 305 return true; |
306 return false; | 306 return false; |
307 } | 307 } |
308 | 308 |
309 return (blacklisted_features_.count(feature) == 1); | 309 return (blacklisted_features_.count(feature) == 1); |
310 } | 310 } |
311 | 311 |
| 312 bool GpuDataManagerImplPrivate::IsFeatureEnabled(int feature) const { |
| 313 DCHECK_EQ(feature, gpu::GPU_FEATURE_TYPE_GPU_RASTERIZATION); |
| 314 return (enabled_features_.count(feature) == 1); |
| 315 } |
| 316 |
312 bool GpuDataManagerImplPrivate::IsDriverBugWorkaroundActive(int feature) const { | 317 bool GpuDataManagerImplPrivate::IsDriverBugWorkaroundActive(int feature) const { |
313 return (gpu_driver_bugs_.count(feature) == 1); | 318 return (gpu_driver_bugs_.count(feature) == 1); |
314 } | 319 } |
315 | 320 |
316 size_t GpuDataManagerImplPrivate::GetBlacklistedFeatureCount() const { | 321 size_t GpuDataManagerImplPrivate::GetBlacklistedFeatureCount() const { |
317 if (use_swiftshader_) | 322 if (use_swiftshader_) |
318 return 1; | 323 return 1; |
319 return blacklisted_features_.size(); | 324 return blacklisted_features_.size(); |
320 } | 325 } |
321 | 326 |
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
675 if (IsCompleteGpuInfoAvailable()) { | 680 if (IsCompleteGpuInfoAvailable()) { |
676 complete_gpu_info_already_requested_ = true; | 681 complete_gpu_info_already_requested_ = true; |
677 } else if (was_info_available) { | 682 } else if (was_info_available) { |
678 // Allow future requests to go through properly. | 683 // Allow future requests to go through properly. |
679 complete_gpu_info_already_requested_ = false; | 684 complete_gpu_info_already_requested_ = false; |
680 } | 685 } |
681 | 686 |
682 UpdateGpuInfoHelper(); | 687 UpdateGpuInfoHelper(); |
683 } | 688 } |
684 | 689 |
| 690 void GpuDataManagerImplPrivate::UpdateGpuFeatureStatus( |
| 691 const gpu::GPUFeatureStatus& gpu_feature_status) { |
| 692 if (gpu_blacklist_) { |
| 693 // Currently this duplicates the blacklist re-computation in |
| 694 // UpdateGpuInfoHelper. Ensure we get the expected value for the |
| 695 // GPU_RASTERIZATION feature, which is the only one in use here. |
| 696 DCHECK_EQ( |
| 697 gpu_feature_status.blacklisted_features.count( |
| 698 gpu::GPU_FEATURE_TYPE_GPU_RASTERIZATION), |
| 699 blacklisted_features_.count(gpu::GPU_FEATURE_TYPE_GPU_RASTERIZATION)); |
| 700 } |
| 701 |
| 702 // Copy the |enabled_features| member. |
| 703 enabled_features_ = gpu_feature_status.enabled_features; |
| 704 // This is currently only used for GPU rasterization. Ensure that this is the |
| 705 // only flag set (if set at all). |
| 706 DCHECK(enabled_features_.size() == |
| 707 enabled_features_.count(gpu::GPU_FEATURE_TYPE_GPU_RASTERIZATION)); |
| 708 } |
| 709 |
685 void GpuDataManagerImplPrivate::UpdateVideoMemoryUsageStats( | 710 void GpuDataManagerImplPrivate::UpdateVideoMemoryUsageStats( |
686 const gpu::VideoMemoryUsageStats& video_memory_usage_stats) { | 711 const gpu::VideoMemoryUsageStats& video_memory_usage_stats) { |
687 GpuDataManagerImpl::UnlockedSession session(owner_); | 712 GpuDataManagerImpl::UnlockedSession session(owner_); |
688 observer_list_->Notify(FROM_HERE, | 713 observer_list_->Notify(FROM_HERE, |
689 &GpuDataManagerObserver::OnVideoMemoryUsageStatsUpdate, | 714 &GpuDataManagerObserver::OnVideoMemoryUsageStatsUpdate, |
690 video_memory_usage_stats); | 715 video_memory_usage_stats); |
691 } | 716 } |
692 | 717 |
693 void GpuDataManagerImplPrivate::AppendRendererCommandLine( | 718 void GpuDataManagerImplPrivate::AppendRendererCommandLine( |
694 base::CommandLine* command_line) const { | 719 base::CommandLine* command_line) const { |
(...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1347 gpu_info_.context_info_state = gpu::kCollectInfoFatalFailure; | 1372 gpu_info_.context_info_state = gpu::kCollectInfoFatalFailure; |
1348 #if defined(OS_WIN) | 1373 #if defined(OS_WIN) |
1349 gpu_info_.dx_diagnostics_info_state = gpu::kCollectInfoFatalFailure; | 1374 gpu_info_.dx_diagnostics_info_state = gpu::kCollectInfoFatalFailure; |
1350 #endif | 1375 #endif |
1351 complete_gpu_info_already_requested_ = true; | 1376 complete_gpu_info_already_requested_ = true; |
1352 // Some observers might be waiting. | 1377 // Some observers might be waiting. |
1353 NotifyGpuInfoUpdate(); | 1378 NotifyGpuInfoUpdate(); |
1354 } | 1379 } |
1355 | 1380 |
1356 } // namespace content | 1381 } // namespace content |
OLD | NEW |