OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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.h" | 5 #include "content/browser/gpu/gpu_data_manager_impl.h" |
6 | 6 |
7 #if defined(OS_MACOSX) | 7 #if defined(OS_MACOSX) |
8 #include <ApplicationServices/ApplicationServices.h> | 8 #include <ApplicationServices/ApplicationServices.h> |
9 #endif // OS_MACOSX | 9 #endif // OS_MACOSX |
10 | 10 |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 GpuDataManagerImpl* GpuDataManagerImpl::GetInstance() { | 110 GpuDataManagerImpl* GpuDataManagerImpl::GetInstance() { |
111 return Singleton<GpuDataManagerImpl>::get(); | 111 return Singleton<GpuDataManagerImpl>::get(); |
112 } | 112 } |
113 | 113 |
114 void GpuDataManagerImpl::InitializeForTesting( | 114 void GpuDataManagerImpl::InitializeForTesting( |
115 const std::string& gpu_blacklist_json, | 115 const std::string& gpu_blacklist_json, |
116 const GPUInfo& gpu_info) { | 116 const GPUInfo& gpu_info) { |
117 // This function is for testing only, so disable histograms. | 117 // This function is for testing only, so disable histograms. |
118 update_histograms_ = false; | 118 update_histograms_ = false; |
119 | 119 |
120 InitializeImpl(gpu_blacklist_json, "", "", gpu_info); | 120 InitializeImpl(gpu_blacklist_json, std::string(), std::string(), gpu_info); |
121 } | 121 } |
122 | 122 |
123 bool GpuDataManagerImpl::IsFeatureBlacklisted(int feature) const { | 123 bool GpuDataManagerImpl::IsFeatureBlacklisted(int feature) const { |
124 if (software_rendering_) { | 124 if (software_rendering_) { |
125 // Skia's software rendering is probably more efficient than going through | 125 // Skia's software rendering is probably more efficient than going through |
126 // software emulation of the GPU, so use that. | 126 // software emulation of the GPU, so use that. |
127 if (feature == GPU_FEATURE_TYPE_ACCELERATED_2D_CANVAS) | 127 if (feature == GPU_FEATURE_TYPE_ACCELERATED_2D_CANVAS) |
128 return true; | 128 return true; |
129 return false; | 129 return false; |
130 } | 130 } |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
343 gpu_info_collector::MergeGPUInfo(&gpu_info_, gpu_info); | 343 gpu_info_collector::MergeGPUInfo(&gpu_info_, gpu_info); |
344 complete_gpu_info_already_requested_ = | 344 complete_gpu_info_already_requested_ = |
345 complete_gpu_info_already_requested_ || gpu_info_.finalized; | 345 complete_gpu_info_already_requested_ || gpu_info_.finalized; |
346 my_gpu_info = gpu_info_; | 346 my_gpu_info = gpu_info_; |
347 } | 347 } |
348 | 348 |
349 GetContentClient()->SetGpuInfo(my_gpu_info); | 349 GetContentClient()->SetGpuInfo(my_gpu_info); |
350 | 350 |
351 if (gpu_blacklist_.get()) { | 351 if (gpu_blacklist_.get()) { |
352 std::set<int> features = gpu_blacklist_->MakeDecision( | 352 std::set<int> features = gpu_blacklist_->MakeDecision( |
353 GpuControlList::kOsAny, "", my_gpu_info); | 353 GpuControlList::kOsAny, std::string(), my_gpu_info); |
354 if (update_histograms_) | 354 if (update_histograms_) |
355 UpdateStats(gpu_blacklist_.get(), features); | 355 UpdateStats(gpu_blacklist_.get(), features); |
356 | 356 |
357 UpdateBlacklistedFeatures(features); | 357 UpdateBlacklistedFeatures(features); |
358 } | 358 } |
359 if (gpu_switching_list_.get()) { | 359 if (gpu_switching_list_.get()) { |
360 std::set<int> option = gpu_switching_list_->MakeDecision( | 360 std::set<int> option = gpu_switching_list_->MakeDecision( |
361 GpuControlList::kOsAny, "", my_gpu_info); | 361 GpuControlList::kOsAny, std::string(), my_gpu_info); |
362 if (option.size() == 1) { | 362 if (option.size() == 1) { |
363 // Blacklist decision should not overwrite commandline switch from users. | 363 // Blacklist decision should not overwrite commandline switch from users. |
364 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 364 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
365 if (!command_line->HasSwitch(switches::kGpuSwitching)) | 365 if (!command_line->HasSwitch(switches::kGpuSwitching)) |
366 gpu_switching_ = static_cast<GpuSwitchingOption>(*(option.begin())); | 366 gpu_switching_ = static_cast<GpuSwitchingOption>(*(option.begin())); |
367 } | 367 } |
368 } | 368 } |
369 if (gpu_driver_bug_list_.get()) | 369 if (gpu_driver_bug_list_.get()) |
370 gpu_driver_bugs_ = gpu_driver_bug_list_->MakeDecision( | 370 gpu_driver_bugs_ = gpu_driver_bug_list_->MakeDecision( |
371 GpuControlList::kOsAny, "", my_gpu_info); | 371 GpuControlList::kOsAny, std::string(), my_gpu_info); |
372 | 372 |
373 // We have to update GpuFeatureType before notify all the observers. | 373 // We have to update GpuFeatureType before notify all the observers. |
374 NotifyGpuInfoUpdate(); | 374 NotifyGpuInfoUpdate(); |
375 } | 375 } |
376 | 376 |
377 void GpuDataManagerImpl::UpdateVideoMemoryUsageStats( | 377 void GpuDataManagerImpl::UpdateVideoMemoryUsageStats( |
378 const GPUVideoMemoryUsageStats& video_memory_usage_stats) { | 378 const GPUVideoMemoryUsageStats& video_memory_usage_stats) { |
379 observer_list_->Notify(&GpuDataManagerObserver::OnVideoMemoryUsageStatsUpdate, | 379 observer_list_->Notify(&GpuDataManagerObserver::OnVideoMemoryUsageStatsUpdate, |
380 video_memory_usage_stats); | 380 video_memory_usage_stats); |
381 } | 381 } |
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
892 | 892 |
893 void GpuDataManagerImpl::Notify3DAPIBlocked(const GURL& url, | 893 void GpuDataManagerImpl::Notify3DAPIBlocked(const GURL& url, |
894 int render_process_id, | 894 int render_process_id, |
895 int render_view_id, | 895 int render_view_id, |
896 ThreeDAPIType requester) { | 896 ThreeDAPIType requester) { |
897 observer_list_->Notify(&GpuDataManagerObserver::DidBlock3DAPIs, | 897 observer_list_->Notify(&GpuDataManagerObserver::DidBlock3DAPIs, |
898 url, render_process_id, render_view_id, requester); | 898 url, render_process_id, render_view_id, requester); |
899 } | 899 } |
900 | 900 |
901 } // namespace content | 901 } // namespace content |
OLD | NEW |