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" |
11 #include "base/metrics/field_trial.h" | |
11 #include "base/stringprintf.h" | 12 #include "base/stringprintf.h" |
12 #include "base/sys_info.h" | 13 #include "base/sys_info.h" |
13 #include "base/values.h" | 14 #include "base/values.h" |
14 #include "base/version.h" | 15 #include "base/version.h" |
15 #include "content/browser/gpu/gpu_process_host.h" | 16 #include "content/browser/gpu/gpu_process_host.h" |
16 #include "content/browser/gpu/gpu_util.h" | 17 #include "content/browser/gpu/gpu_util.h" |
17 #include "content/common/gpu/gpu_messages.h" | 18 #include "content/common/gpu/gpu_messages.h" |
18 #include "content/gpu/gpu_info_collector.h" | 19 #include "content/gpu/gpu_info_collector.h" |
19 #include "content/public/browser/browser_thread.h" | 20 #include "content/public/browser/browser_thread.h" |
20 #include "content/public/browser/gpu_data_manager_observer.h" | 21 #include "content/public/browser/gpu_data_manager_observer.h" |
21 #include "content/public/common/content_client.h" | 22 #include "content/public/common/content_client.h" |
23 #include "content/public/common/content_constants.h" | |
22 #include "content/public/common/content_switches.h" | 24 #include "content/public/common/content_switches.h" |
23 #include "ui/base/ui_base_switches.h" | 25 #include "ui/base/ui_base_switches.h" |
24 #include "ui/gl/gl_implementation.h" | 26 #include "ui/gl/gl_implementation.h" |
25 #include "ui/gl/gl_switches.h" | 27 #include "ui/gl/gl_switches.h" |
26 #include "webkit/plugins/plugin_switches.h" | 28 #include "webkit/plugins/plugin_switches.h" |
27 | 29 |
28 #if defined(OS_WIN) | 30 #if defined(OS_WIN) |
29 #include "base/win/windows_version.h" | 31 #include "base/win/windows_version.h" |
30 #endif | 32 #endif |
31 | 33 |
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
376 void GpuDataManagerImpl::NotifyGpuInfoUpdate() { | 378 void GpuDataManagerImpl::NotifyGpuInfoUpdate() { |
377 observer_list_->Notify(&GpuDataManagerObserver::OnGpuInfoUpdate); | 379 observer_list_->Notify(&GpuDataManagerObserver::OnGpuInfoUpdate); |
378 } | 380 } |
379 | 381 |
380 void GpuDataManagerImpl::UpdateVideoMemoryUsageStats( | 382 void GpuDataManagerImpl::UpdateVideoMemoryUsageStats( |
381 const content::GPUVideoMemoryUsageStats& video_memory_usage_stats) { | 383 const content::GPUVideoMemoryUsageStats& video_memory_usage_stats) { |
382 observer_list_->Notify(&GpuDataManagerObserver::OnVideoMemoryUsageStatsUpdate, | 384 observer_list_->Notify(&GpuDataManagerObserver::OnVideoMemoryUsageStatsUpdate, |
383 video_memory_usage_stats); | 385 video_memory_usage_stats); |
384 } | 386 } |
385 | 387 |
388 // Experiment to determine whether Stage3D should be blacklisted on XP. | |
389 bool Stage3DBlacklisted() { | |
390 #if !defined(OS_WIN) | |
391 return false; | |
392 #else | |
393 if (base::win::GetVersion() >= base::win::VERSION_VISTA) | |
394 return false; | |
395 base::FieldTrial* trial = | |
396 base::FieldTrialList::Find(content::kStage3DFieldTrialName); | |
397 return !trial || | |
398 trial->group_name() == content::kStage3DFieldTrialBlacklistedName; | |
Alexei Svitkine (slow)
2012/09/19 20:33:16
Nit: You can just use:
return base::FieldTrialLis
| |
399 #endif | |
400 } | |
401 | |
386 void GpuDataManagerImpl::UpdateBlacklistedFeatures( | 402 void GpuDataManagerImpl::UpdateBlacklistedFeatures( |
387 GpuFeatureType features) { | 403 GpuFeatureType features) { |
388 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 404 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
389 int flags = features; | 405 int flags = features; |
390 | 406 |
391 // Force disable using the GPU for these features, even if they would | 407 // Force disable using the GPU for these features, even if they would |
392 // otherwise be allowed. | 408 // otherwise be allowed. |
393 if (card_blacklisted_ || | 409 if (card_blacklisted_ || |
394 command_line->HasSwitch(switches::kBlacklistAcceleratedCompositing)) { | 410 command_line->HasSwitch(switches::kBlacklistAcceleratedCompositing)) { |
395 flags |= content::GPU_FEATURE_TYPE_ACCELERATED_COMPOSITING; | 411 flags |= content::GPU_FEATURE_TYPE_ACCELERATED_COMPOSITING; |
396 } | 412 } |
397 if (card_blacklisted_ || | 413 if (card_blacklisted_ || |
398 command_line->HasSwitch(switches::kBlacklistWebGL)) { | 414 command_line->HasSwitch(switches::kBlacklistWebGL)) { |
399 flags |= content::GPU_FEATURE_TYPE_WEBGL; | 415 flags |= content::GPU_FEATURE_TYPE_WEBGL; |
400 } | 416 } |
417 if (Stage3DBlacklisted()) { | |
418 flags |= content::GPU_FEATURE_TYPE_FLASH_STAGE3D; | |
419 } | |
401 gpu_feature_type_ = static_cast<GpuFeatureType>(flags); | 420 gpu_feature_type_ = static_cast<GpuFeatureType>(flags); |
402 | 421 |
403 EnableSoftwareRenderingIfNecessary(); | 422 EnableSoftwareRenderingIfNecessary(); |
404 } | 423 } |
405 | 424 |
406 void GpuDataManagerImpl::RegisterSwiftShaderPath(const FilePath& path) { | 425 void GpuDataManagerImpl::RegisterSwiftShaderPath(const FilePath& path) { |
407 swiftshader_path_ = path; | 426 swiftshader_path_ = path; |
408 EnableSoftwareRenderingIfNecessary(); | 427 EnableSoftwareRenderingIfNecessary(); |
409 } | 428 } |
410 | 429 |
(...skipping 15 matching lines...) Expand all Loading... | |
426 | 445 |
427 void GpuDataManagerImpl::BlacklistCard() { | 446 void GpuDataManagerImpl::BlacklistCard() { |
428 card_blacklisted_ = true; | 447 card_blacklisted_ = true; |
429 | 448 |
430 gpu_feature_type_ = content::GPU_FEATURE_TYPE_ALL; | 449 gpu_feature_type_ = content::GPU_FEATURE_TYPE_ALL; |
431 | 450 |
432 EnableSoftwareRenderingIfNecessary(); | 451 EnableSoftwareRenderingIfNecessary(); |
433 NotifyGpuInfoUpdate(); | 452 NotifyGpuInfoUpdate(); |
434 } | 453 } |
435 | 454 |
OLD | NEW |