Chromium Code Reviews| Index: content/browser/gpu/gpu_data_manager_impl.cc |
| =================================================================== |
| --- content/browser/gpu/gpu_data_manager_impl.cc (revision 155054) |
| +++ content/browser/gpu/gpu_data_manager_impl.cc (working copy) |
| @@ -13,6 +13,7 @@ |
| #include "base/values.h" |
| #include "base/version.h" |
| #include "content/browser/gpu/gpu_process_host.h" |
| +#include "content/browser/gpu/gpu_util.h" |
| #include "content/common/gpu/gpu_messages.h" |
| #include "content/gpu/gpu_info_collector.h" |
| #include "content/public/browser/browser_thread.h" |
| @@ -58,14 +59,24 @@ |
| BlacklistCard(); |
| } |
| -void GpuDataManagerImpl::InitializeGpuInfo() { |
| +void GpuDataManagerImpl::Initialize( |
| + const std::string& browser_version_string, |
| + const std::string& gpu_blacklist_json) { |
| content::GPUInfo gpu_info; |
| - if (!CommandLine::ForCurrentProcess()->HasSwitch( |
| - switches::kSkipGpuDataLoading)) |
|
jbates
2012/09/06 00:50:41
Just making sure you meant to remove the kSkipGpuD
Zhenyao Mo
2012/09/06 00:59:45
Yes, it's taken care of from the caller side.
|
| - gpu_info_collector::CollectPreliminaryGraphicsInfo(&gpu_info); |
| - else |
| - gpu_info.finalized = true; |
| + gpu_info_collector::CollectPreliminaryGraphicsInfo(&gpu_info); |
| + |
| + if (!gpu_blacklist_json.empty()) { |
| + CHECK(!browser_version_string.empty()); |
| + gpu_blacklist_.reset(new GpuBlacklist()); |
| + bool succeed = gpu_blacklist_->LoadGpuBlacklist( |
| + browser_version_string, |
| + gpu_blacklist_json, |
| + GpuBlacklist::kCurrentOsOnly); |
| + CHECK(succeed); |
| + } |
| + |
| UpdateGpuInfo(gpu_info); |
| + UpdatePreliminaryBlacklistedFeatures(); |
| } |
| GpuDataManagerImpl::~GpuDataManagerImpl() { |
| @@ -92,6 +103,15 @@ |
| content::GetContentClient()->SetGpuInfo(gpu_info); |
| + if (gpu_blacklist_.get()) { |
| + GpuFeatureType feature_type = gpu_blacklist_->DetermineGpuFeatureType( |
| + GpuBlacklist::kOsAny, |
| + NULL, |
| + GpuDataManager::GetInstance()->GetGPUInfo()); |
| + gpu_util::UpdateStats(gpu_blacklist_.get(), feature_type); |
| + UpdateBlacklistedFeatures(feature_type); |
| + } |
| + |
| { |
| base::AutoLock auto_lock(gpu_info_lock_); |
| gpu_info_ = gpu_info; |
| @@ -142,6 +162,12 @@ |
| return value; |
| } |
| +std::string GpuDataManagerImpl::GetBlacklistVersion() const { |
| + if (gpu_blacklist_.get()) |
| + return gpu_blacklist_->GetVersion(); |
| + return "0"; |
| +} |
| + |
| GpuFeatureType GpuDataManagerImpl::GetBlacklistedFeatures() const { |
| if (software_rendering_) { |
| GpuFeatureType flags; |
| @@ -155,6 +181,13 @@ |
| return gpu_feature_type_; |
| } |
| +base::ListValue* GpuDataManagerImpl::GetBlacklistReasons() const { |
| + ListValue* reasons = new ListValue(); |
| + if (gpu_blacklist_.get()) |
| + gpu_blacklist_->GetBlacklistReasons(reasons); |
| + return reasons; |
| +} |
| + |
| bool GpuDataManagerImpl::GpuAccessAllowed() const { |
| if (software_rendering_) |
| return true; |
| @@ -305,9 +338,7 @@ |
| #endif |
| } |
| -void GpuDataManagerImpl::SetPreliminaryBlacklistedFeatures( |
| - GpuFeatureType feature_type) { |
| - UpdateBlacklistedFeatures(feature_type); |
| +void GpuDataManagerImpl::UpdatePreliminaryBlacklistedFeatures() { |
| preliminary_gpu_feature_type_ = gpu_feature_type_; |
| } |