| 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 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 GetContentClient()->GetProduct()); | 166 GetContentClient()->GetProduct()); |
| 167 CHECK(!browser_version_string.empty()); | 167 CHECK(!browser_version_string.empty()); |
| 168 gpu_blacklist_.reset(new GpuBlacklist()); | 168 gpu_blacklist_.reset(new GpuBlacklist()); |
| 169 bool succeed = gpu_blacklist_->LoadGpuBlacklist( | 169 bool succeed = gpu_blacklist_->LoadGpuBlacklist( |
| 170 browser_version_string, | 170 browser_version_string, |
| 171 gpu_blacklist_json, | 171 gpu_blacklist_json, |
| 172 GpuBlacklist::kCurrentOsOnly); | 172 GpuBlacklist::kCurrentOsOnly); |
| 173 CHECK(succeed); | 173 CHECK(succeed); |
| 174 } | 174 } |
| 175 | 175 |
| 176 { | |
| 177 base::AutoLock auto_lock(gpu_info_lock_); | |
| 178 gpu_info_ = gpu_info; | |
| 179 } | |
| 180 UpdateGpuInfo(gpu_info); | 176 UpdateGpuInfo(gpu_info); |
| 181 UpdateGpuSwitchingManager(gpu_info); | 177 UpdateGpuSwitchingManager(gpu_info); |
| 182 UpdatePreliminaryBlacklistedFeatures(); | 178 UpdatePreliminaryBlacklistedFeatures(); |
| 183 } | 179 } |
| 184 | 180 |
| 185 GpuDataManagerImpl::~GpuDataManagerImpl() { | 181 GpuDataManagerImpl::~GpuDataManagerImpl() { |
| 186 #if defined(OS_MACOSX) | 182 #if defined(OS_MACOSX) |
| 187 CGDisplayRemoveReconfigurationCallback(DisplayReconfigCallback, this); | 183 CGDisplayRemoveReconfigurationCallback(DisplayReconfigCallback, this); |
| 188 #endif | 184 #endif |
| 189 } | 185 } |
| (...skipping 15 matching lines...) Expand all Loading... |
| 205 | 201 |
| 206 bool GpuDataManagerImpl::IsCompleteGpuInfoAvailable() const { | 202 bool GpuDataManagerImpl::IsCompleteGpuInfoAvailable() const { |
| 207 return gpu_info_.finalized; | 203 return gpu_info_.finalized; |
| 208 } | 204 } |
| 209 | 205 |
| 210 void GpuDataManagerImpl::UpdateGpuInfo(const GPUInfo& gpu_info) { | 206 void GpuDataManagerImpl::UpdateGpuInfo(const GPUInfo& gpu_info) { |
| 211 // No further update of gpu_info if falling back to software renderer. | 207 // No further update of gpu_info if falling back to software renderer. |
| 212 if (software_rendering_) | 208 if (software_rendering_) |
| 213 return; | 209 return; |
| 214 | 210 |
| 215 GPUInfo my_gpu_info; | 211 GetContentClient()->SetGpuInfo(gpu_info); |
| 216 { | |
| 217 base::AutoLock auto_lock(gpu_info_lock_); | |
| 218 gpu_info_collector::MergeGPUInfo(&gpu_info_, gpu_info); | |
| 219 complete_gpu_info_already_requested_ = | |
| 220 complete_gpu_info_already_requested_ || gpu_info_.finalized; | |
| 221 my_gpu_info = gpu_info_; | |
| 222 } | |
| 223 | |
| 224 GetContentClient()->SetGpuInfo(my_gpu_info); | |
| 225 | 212 |
| 226 if (gpu_blacklist_.get()) { | 213 if (gpu_blacklist_.get()) { |
| 227 GpuBlacklist::Decision decision = | 214 GpuBlacklist::Decision decision = |
| 228 gpu_blacklist_->MakeBlacklistDecision( | 215 gpu_blacklist_->MakeBlacklistDecision( |
| 229 GpuBlacklist::kOsAny, "", my_gpu_info); | 216 GpuBlacklist::kOsAny, "", gpu_info); |
| 230 if (update_histograms_) | 217 if (update_histograms_) |
| 231 UpdateStats(gpu_blacklist_.get(), decision.blacklisted_features); | 218 UpdateStats(gpu_blacklist_.get(), decision.blacklisted_features); |
| 232 | 219 |
| 233 UpdateBlacklistedFeatures(decision.blacklisted_features); | 220 UpdateBlacklistedFeatures(decision.blacklisted_features); |
| 234 if (decision.gpu_switching != GPU_SWITCHING_OPTION_UNKNOWN) { | 221 if (decision.gpu_switching != GPU_SWITCHING_OPTION_UNKNOWN) { |
| 235 // Blacklist decision should not overwrite commandline switch from users. | 222 // Blacklist decision should not overwrite commandline switch from users. |
| 236 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 223 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| 237 if (!command_line->HasSwitch(switches::kGpuSwitching)) | 224 if (!command_line->HasSwitch(switches::kGpuSwitching)) |
| 238 gpu_switching_ = decision.gpu_switching; | 225 gpu_switching_ = decision.gpu_switching; |
| 239 } | 226 } |
| 240 } | 227 } |
| 241 | 228 |
| 229 { |
| 230 base::AutoLock auto_lock(gpu_info_lock_); |
| 231 gpu_info_collector::MergeGPUInfo(&gpu_info_, gpu_info); |
| 232 complete_gpu_info_already_requested_ = |
| 233 complete_gpu_info_already_requested_ || gpu_info_.finalized; |
| 234 } |
| 235 |
| 242 // We have to update GpuFeatureType before notify all the observers. | 236 // We have to update GpuFeatureType before notify all the observers. |
| 243 NotifyGpuInfoUpdate(); | 237 NotifyGpuInfoUpdate(); |
| 244 } | 238 } |
| 245 | 239 |
| 246 GPUInfo GpuDataManagerImpl::GetGPUInfo() const { | 240 GPUInfo GpuDataManagerImpl::GetGPUInfo() const { |
| 247 GPUInfo gpu_info; | 241 GPUInfo gpu_info; |
| 248 { | 242 { |
| 249 base::AutoLock auto_lock(gpu_info_lock_); | 243 base::AutoLock auto_lock(gpu_info_lock_); |
| 250 gpu_info = gpu_info_; | 244 gpu_info = gpu_info_; |
| 251 } | 245 } |
| (...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 729 BLOCK_STATUS_MAX); | 723 BLOCK_STATUS_MAX); |
| 730 | 724 |
| 731 return DOMAIN_BLOCK_STATUS_NOT_BLOCKED; | 725 return DOMAIN_BLOCK_STATUS_NOT_BLOCKED; |
| 732 } | 726 } |
| 733 | 727 |
| 734 int64 GpuDataManagerImpl::GetBlockAllDomainsDurationInMs() const { | 728 int64 GpuDataManagerImpl::GetBlockAllDomainsDurationInMs() const { |
| 735 return kBlockAllDomainsMs; | 729 return kBlockAllDomainsMs; |
| 736 } | 730 } |
| 737 | 731 |
| 738 } // namespace content | 732 } // namespace content |
| OLD | NEW |