| 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 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 356 { | 356 { |
| 357 base::AutoLock auto_lock(gpu_info_lock_); | 357 base::AutoLock auto_lock(gpu_info_lock_); |
| 358 gpu_info_collector::MergeGPUInfo(&gpu_info_, gpu_info); | 358 gpu_info_collector::MergeGPUInfo(&gpu_info_, gpu_info); |
| 359 complete_gpu_info_already_requested_ = | 359 complete_gpu_info_already_requested_ = |
| 360 complete_gpu_info_already_requested_ || gpu_info_.finalized; | 360 complete_gpu_info_already_requested_ || gpu_info_.finalized; |
| 361 my_gpu_info = gpu_info_; | 361 my_gpu_info = gpu_info_; |
| 362 } | 362 } |
| 363 | 363 |
| 364 GetContentClient()->SetGpuInfo(my_gpu_info); | 364 GetContentClient()->SetGpuInfo(my_gpu_info); |
| 365 | 365 |
| 366 if (gpu_blacklist_.get()) { | 366 if (gpu_blacklist_) { |
| 367 std::set<int> features = gpu_blacklist_->MakeDecision( | 367 std::set<int> features = gpu_blacklist_->MakeDecision( |
| 368 GpuControlList::kOsAny, std::string(), my_gpu_info); | 368 GpuControlList::kOsAny, std::string(), my_gpu_info); |
| 369 if (update_histograms_) | 369 if (update_histograms_) |
| 370 UpdateStats(gpu_blacklist_.get(), features); | 370 UpdateStats(gpu_blacklist_.get(), features); |
| 371 | 371 |
| 372 UpdateBlacklistedFeatures(features); | 372 UpdateBlacklistedFeatures(features); |
| 373 } | 373 } |
| 374 if (gpu_switching_list_.get()) { | 374 if (gpu_switching_list_) { |
| 375 std::set<int> option = gpu_switching_list_->MakeDecision( | 375 std::set<int> option = gpu_switching_list_->MakeDecision( |
| 376 GpuControlList::kOsAny, std::string(), my_gpu_info); | 376 GpuControlList::kOsAny, std::string(), my_gpu_info); |
| 377 if (option.size() == 1) { | 377 if (option.size() == 1) { |
| 378 // Blacklist decision should not overwrite commandline switch from users. | 378 // Blacklist decision should not overwrite commandline switch from users. |
| 379 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 379 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| 380 if (!command_line->HasSwitch(switches::kGpuSwitching)) | 380 if (!command_line->HasSwitch(switches::kGpuSwitching)) |
| 381 gpu_switching_ = static_cast<GpuSwitchingOption>(*(option.begin())); | 381 gpu_switching_ = static_cast<GpuSwitchingOption>(*(option.begin())); |
| 382 } | 382 } |
| 383 } | 383 } |
| 384 if (gpu_driver_bug_list_.get()) | 384 if (gpu_driver_bug_list_) |
| 385 gpu_driver_bugs_ = gpu_driver_bug_list_->MakeDecision( | 385 gpu_driver_bugs_ = gpu_driver_bug_list_->MakeDecision( |
| 386 GpuControlList::kOsAny, std::string(), my_gpu_info); | 386 GpuControlList::kOsAny, std::string(), my_gpu_info); |
| 387 | 387 |
| 388 // We have to update GpuFeatureType before notify all the observers. | 388 // We have to update GpuFeatureType before notify all the observers. |
| 389 NotifyGpuInfoUpdate(); | 389 NotifyGpuInfoUpdate(); |
| 390 } | 390 } |
| 391 | 391 |
| 392 void GpuDataManagerImpl::UpdateVideoMemoryUsageStats( | 392 void GpuDataManagerImpl::UpdateVideoMemoryUsageStats( |
| 393 const GPUVideoMemoryUsageStats& video_memory_usage_stats) { | 393 const GPUVideoMemoryUsageStats& video_memory_usage_stats) { |
| 394 observer_list_->Notify(&GpuDataManagerObserver::OnVideoMemoryUsageStatsUpdate, | 394 observer_list_->Notify(&GpuDataManagerObserver::OnVideoMemoryUsageStatsUpdate, |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 581 card_blacklisted_ = true; | 581 card_blacklisted_ = true; |
| 582 | 582 |
| 583 for (int i = 0; i < NUMBER_OF_GPU_FEATURE_TYPES; ++i) | 583 for (int i = 0; i < NUMBER_OF_GPU_FEATURE_TYPES; ++i) |
| 584 blacklisted_features_.insert(i); | 584 blacklisted_features_.insert(i); |
| 585 | 585 |
| 586 EnableSoftwareRenderingIfNecessary(); | 586 EnableSoftwareRenderingIfNecessary(); |
| 587 NotifyGpuInfoUpdate(); | 587 NotifyGpuInfoUpdate(); |
| 588 } | 588 } |
| 589 | 589 |
| 590 std::string GpuDataManagerImpl::GetBlacklistVersion() const { | 590 std::string GpuDataManagerImpl::GetBlacklistVersion() const { |
| 591 if (gpu_blacklist_.get()) | 591 if (gpu_blacklist_) |
| 592 return gpu_blacklist_->version(); | 592 return gpu_blacklist_->version(); |
| 593 return "0"; | 593 return "0"; |
| 594 } | 594 } |
| 595 | 595 |
| 596 base::ListValue* GpuDataManagerImpl::GetBlacklistReasons() const { | 596 base::ListValue* GpuDataManagerImpl::GetBlacklistReasons() const { |
| 597 ListValue* reasons = new ListValue(); | 597 ListValue* reasons = new ListValue(); |
| 598 if (gpu_blacklist_.get()) | 598 if (gpu_blacklist_) |
| 599 gpu_blacklist_->GetReasons(reasons); | 599 gpu_blacklist_->GetReasons(reasons); |
| 600 return reasons; | 600 return reasons; |
| 601 } | 601 } |
| 602 | 602 |
| 603 void GpuDataManagerImpl::AddLogMessage( | 603 void GpuDataManagerImpl::AddLogMessage( |
| 604 int level, const std::string& header, const std::string& message) { | 604 int level, const std::string& header, const std::string& message) { |
| 605 base::AutoLock auto_lock(log_messages_lock_); | 605 base::AutoLock auto_lock(log_messages_lock_); |
| 606 DictionaryValue* dict = new DictionaryValue(); | 606 DictionaryValue* dict = new DictionaryValue(); |
| 607 dict->SetInteger("level", level); | 607 dict->SetInteger("level", level); |
| 608 dict->SetString("header", header); | 608 dict->SetString("header", header); |
| (...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 906 | 906 |
| 907 void GpuDataManagerImpl::Notify3DAPIBlocked(const GURL& url, | 907 void GpuDataManagerImpl::Notify3DAPIBlocked(const GURL& url, |
| 908 int render_process_id, | 908 int render_process_id, |
| 909 int render_view_id, | 909 int render_view_id, |
| 910 ThreeDAPIType requester) { | 910 ThreeDAPIType requester) { |
| 911 observer_list_->Notify(&GpuDataManagerObserver::DidBlock3DAPIs, | 911 observer_list_->Notify(&GpuDataManagerObserver::DidBlock3DAPIs, |
| 912 url, render_process_id, render_view_id, requester); | 912 url, render_process_id, render_view_id, requester); |
| 913 } | 913 } |
| 914 | 914 |
| 915 } // namespace content | 915 } // namespace content |
| OLD | NEW |