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