| 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 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 } | 69 } |
| 70 | 70 |
| 71 GpuDataManagerImpl::GpuDataManagerImpl() | 71 GpuDataManagerImpl::GpuDataManagerImpl() |
| 72 : complete_gpu_info_already_requested_(false), | 72 : complete_gpu_info_already_requested_(false), |
| 73 gpu_feature_type_(content::GPU_FEATURE_TYPE_UNKNOWN), | 73 gpu_feature_type_(content::GPU_FEATURE_TYPE_UNKNOWN), |
| 74 preliminary_gpu_feature_type_(content::GPU_FEATURE_TYPE_UNKNOWN), | 74 preliminary_gpu_feature_type_(content::GPU_FEATURE_TYPE_UNKNOWN), |
| 75 gpu_switching_(content::GPU_SWITCHING_OPTION_AUTOMATIC), | 75 gpu_switching_(content::GPU_SWITCHING_OPTION_AUTOMATIC), |
| 76 observer_list_(new GpuDataManagerObserverList), | 76 observer_list_(new GpuDataManagerObserverList), |
| 77 software_rendering_(false), | 77 software_rendering_(false), |
| 78 card_blacklisted_(false), | 78 card_blacklisted_(false), |
| 79 update_histograms_(true) { | 79 update_histograms_(true), |
| 80 window_count_(0) { |
| 80 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 81 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| 81 if (command_line->HasSwitch(switches::kDisableAcceleratedCompositing)) { | 82 if (command_line->HasSwitch(switches::kDisableAcceleratedCompositing)) { |
| 82 command_line->AppendSwitch(switches::kDisableAccelerated2dCanvas); | 83 command_line->AppendSwitch(switches::kDisableAccelerated2dCanvas); |
| 83 command_line->AppendSwitch(switches::kDisableAcceleratedLayers); | 84 command_line->AppendSwitch(switches::kDisableAcceleratedLayers); |
| 84 } | 85 } |
| 85 if (command_line->HasSwitch(switches::kDisableGpu)) | 86 if (command_line->HasSwitch(switches::kDisableGpu)) |
| 86 BlacklistCard(); | 87 BlacklistCard(); |
| 87 if (command_line->HasSwitch(switches::kGpuSwitching)) { | 88 if (command_line->HasSwitch(switches::kGpuSwitching)) { |
| 88 std::string option_string = command_line->GetSwitchValueASCII( | 89 std::string option_string = command_line->GetSwitchValueASCII( |
| 89 switches::kGpuSwitching); | 90 switches::kGpuSwitching); |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 } | 279 } |
| 279 | 280 |
| 280 void GpuDataManagerImpl::AddObserver(GpuDataManagerObserver* observer) { | 281 void GpuDataManagerImpl::AddObserver(GpuDataManagerObserver* observer) { |
| 281 observer_list_->AddObserver(observer); | 282 observer_list_->AddObserver(observer); |
| 282 } | 283 } |
| 283 | 284 |
| 284 void GpuDataManagerImpl::RemoveObserver(GpuDataManagerObserver* observer) { | 285 void GpuDataManagerImpl::RemoveObserver(GpuDataManagerObserver* observer) { |
| 285 observer_list_->RemoveObserver(observer); | 286 observer_list_->RemoveObserver(observer); |
| 286 } | 287 } |
| 287 | 288 |
| 289 void GpuDataManagerImpl::SetWindowCount(uint32 count) { |
| 290 { |
| 291 base::AutoLock auto_lock(gpu_info_lock_); |
| 292 window_count_ = count; |
| 293 } |
| 294 GpuProcessHost::SendOnIO( |
| 295 GpuProcessHost::GPU_PROCESS_KIND_SANDBOXED, |
| 296 content::CAUSE_FOR_GPU_LAUNCH_NO_LAUNCH, |
| 297 new GpuMsg_SetVideoMemoryWindowCount(count)); |
| 298 } |
| 299 |
| 300 uint32 GpuDataManagerImpl::GetWindowCount() const { |
| 301 base::AutoLock auto_lock(gpu_info_lock_); |
| 302 return window_count_; |
| 303 } |
| 304 |
| 288 void GpuDataManagerImpl::AppendRendererCommandLine( | 305 void GpuDataManagerImpl::AppendRendererCommandLine( |
| 289 CommandLine* command_line) const { | 306 CommandLine* command_line) const { |
| 290 DCHECK(command_line); | 307 DCHECK(command_line); |
| 291 | 308 |
| 292 uint32 flags = GetBlacklistedFeatures(); | 309 uint32 flags = GetBlacklistedFeatures(); |
| 293 if ((flags & content::GPU_FEATURE_TYPE_WEBGL)) { | 310 if ((flags & content::GPU_FEATURE_TYPE_WEBGL)) { |
| 294 #if !defined(OS_ANDROID) | 311 #if !defined(OS_ANDROID) |
| 295 if (!command_line->HasSwitch(switches::kDisableExperimentalWebGL)) | 312 if (!command_line->HasSwitch(switches::kDisableExperimentalWebGL)) |
| 296 command_line->AppendSwitch(switches::kDisableExperimentalWebGL); | 313 command_line->AppendSwitch(switches::kDisableExperimentalWebGL); |
| 297 #endif | 314 #endif |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 510 } | 527 } |
| 511 | 528 |
| 512 void GpuDataManagerImpl::BlacklistCard() { | 529 void GpuDataManagerImpl::BlacklistCard() { |
| 513 card_blacklisted_ = true; | 530 card_blacklisted_ = true; |
| 514 | 531 |
| 515 gpu_feature_type_ = content::GPU_FEATURE_TYPE_ALL; | 532 gpu_feature_type_ = content::GPU_FEATURE_TYPE_ALL; |
| 516 | 533 |
| 517 EnableSoftwareRenderingIfNecessary(); | 534 EnableSoftwareRenderingIfNecessary(); |
| 518 NotifyGpuInfoUpdate(); | 535 NotifyGpuInfoUpdate(); |
| 519 } | 536 } |
| OLD | NEW |