Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(214)

Side by Side Diff: content/browser/gpu/gpu_data_manager_impl.cc

Issue 10944037: Add field trial for enabling Stage3D in XP (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix browser_tests Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/test/gpu/gpu_feature_browsertest.cc ('k') | content/public/common/content_constants.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/string_piece.h" 12 #include "base/string_piece.h"
12 #include "base/stringprintf.h" 13 #include "base/stringprintf.h"
13 #include "base/sys_info.h" 14 #include "base/sys_info.h"
14 #include "base/values.h" 15 #include "base/values.h"
15 #include "base/version.h" 16 #include "base/version.h"
16 #include "content/browser/gpu/gpu_process_host.h" 17 #include "content/browser/gpu/gpu_process_host.h"
17 #include "content/browser/gpu/gpu_util.h" 18 #include "content/browser/gpu/gpu_util.h"
18 #include "content/common/gpu/gpu_messages.h" 19 #include "content/common/gpu/gpu_messages.h"
19 #include "content/gpu/gpu_info_collector.h" 20 #include "content/gpu/gpu_info_collector.h"
20 #include "content/public/browser/browser_thread.h" 21 #include "content/public/browser/browser_thread.h"
21 #include "content/public/browser/gpu_data_manager_observer.h" 22 #include "content/public/browser/gpu_data_manager_observer.h"
22 #include "content/public/common/content_client.h" 23 #include "content/public/common/content_client.h"
24 #include "content/public/common/content_constants.h"
23 #include "content/public/common/content_switches.h" 25 #include "content/public/common/content_switches.h"
24 #include "grit/content_resources.h" 26 #include "grit/content_resources.h"
25 #include "ui/base/ui_base_switches.h" 27 #include "ui/base/ui_base_switches.h"
26 #include "ui/gl/gl_implementation.h" 28 #include "ui/gl/gl_implementation.h"
27 #include "ui/gl/gl_switches.h" 29 #include "ui/gl/gl_switches.h"
28 #include "webkit/plugins/plugin_switches.h" 30 #include "webkit/plugins/plugin_switches.h"
29 31
30 #if defined(OS_WIN) 32 #if defined(OS_WIN)
31 #include "base/win/windows_version.h" 33 #include "base/win/windows_version.h"
32 #endif 34 #endif
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 void GpuDataManagerImpl::NotifyGpuInfoUpdate() { 416 void GpuDataManagerImpl::NotifyGpuInfoUpdate() {
415 observer_list_->Notify(&GpuDataManagerObserver::OnGpuInfoUpdate); 417 observer_list_->Notify(&GpuDataManagerObserver::OnGpuInfoUpdate);
416 } 418 }
417 419
418 void GpuDataManagerImpl::UpdateVideoMemoryUsageStats( 420 void GpuDataManagerImpl::UpdateVideoMemoryUsageStats(
419 const content::GPUVideoMemoryUsageStats& video_memory_usage_stats) { 421 const content::GPUVideoMemoryUsageStats& video_memory_usage_stats) {
420 observer_list_->Notify(&GpuDataManagerObserver::OnVideoMemoryUsageStatsUpdate, 422 observer_list_->Notify(&GpuDataManagerObserver::OnVideoMemoryUsageStatsUpdate,
421 video_memory_usage_stats); 423 video_memory_usage_stats);
422 } 424 }
423 425
426 // Experiment to determine whether Stage3D should be blacklisted on XP.
427 bool Stage3DBlacklisted() {
428 return base::FieldTrialList::FindFullName(content::kStage3DFieldTrialName) ==
429 content::kStage3DFieldTrialBlacklistedName;
430 }
431
424 void GpuDataManagerImpl::UpdateBlacklistedFeatures( 432 void GpuDataManagerImpl::UpdateBlacklistedFeatures(
425 GpuFeatureType features) { 433 GpuFeatureType features) {
426 CommandLine* command_line = CommandLine::ForCurrentProcess(); 434 CommandLine* command_line = CommandLine::ForCurrentProcess();
427 int flags = features; 435 int flags = features;
428 436
429 // Force disable using the GPU for these features, even if they would 437 // Force disable using the GPU for these features, even if they would
430 // otherwise be allowed. 438 // otherwise be allowed.
431 if (card_blacklisted_ || 439 if (card_blacklisted_ ||
432 command_line->HasSwitch(switches::kBlacklistAcceleratedCompositing)) { 440 command_line->HasSwitch(switches::kBlacklistAcceleratedCompositing)) {
433 flags |= content::GPU_FEATURE_TYPE_ACCELERATED_COMPOSITING; 441 flags |= content::GPU_FEATURE_TYPE_ACCELERATED_COMPOSITING;
434 } 442 }
435 if (card_blacklisted_ || 443 if (card_blacklisted_ ||
436 command_line->HasSwitch(switches::kBlacklistWebGL)) { 444 command_line->HasSwitch(switches::kBlacklistWebGL)) {
437 flags |= content::GPU_FEATURE_TYPE_WEBGL; 445 flags |= content::GPU_FEATURE_TYPE_WEBGL;
438 } 446 }
447 if (Stage3DBlacklisted()) {
448 flags |= content::GPU_FEATURE_TYPE_FLASH_STAGE3D;
449 }
439 gpu_feature_type_ = static_cast<GpuFeatureType>(flags); 450 gpu_feature_type_ = static_cast<GpuFeatureType>(flags);
440 451
441 EnableSoftwareRenderingIfNecessary(); 452 EnableSoftwareRenderingIfNecessary();
442 } 453 }
443 454
444 void GpuDataManagerImpl::RegisterSwiftShaderPath(const FilePath& path) { 455 void GpuDataManagerImpl::RegisterSwiftShaderPath(const FilePath& path) {
445 swiftshader_path_ = path; 456 swiftshader_path_ = path;
446 EnableSoftwareRenderingIfNecessary(); 457 EnableSoftwareRenderingIfNecessary();
447 } 458 }
448 459
(...skipping 15 matching lines...) Expand all
464 475
465 void GpuDataManagerImpl::BlacklistCard() { 476 void GpuDataManagerImpl::BlacklistCard() {
466 card_blacklisted_ = true; 477 card_blacklisted_ = true;
467 478
468 gpu_feature_type_ = content::GPU_FEATURE_TYPE_ALL; 479 gpu_feature_type_ = content::GPU_FEATURE_TYPE_ALL;
469 480
470 EnableSoftwareRenderingIfNecessary(); 481 EnableSoftwareRenderingIfNecessary();
471 NotifyGpuInfoUpdate(); 482 NotifyGpuInfoUpdate();
472 } 483 }
473 484
OLDNEW
« no previous file with comments | « chrome/test/gpu/gpu_feature_browsertest.cc ('k') | content/public/common/content_constants.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698