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

Side by Side Diff: chrome/browser/chrome_gpu_util.cc

Issue 10991032: Revert 158707 - Enable by default: (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 2 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 | « no previous file | chrome/browser/extensions/extension_tabs_apitest.cc » ('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 "chrome/browser/chrome_gpu_util.h" 5 #include "chrome/browser/chrome_gpu_util.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/metrics/field_trial.h" 8 #include "base/metrics/field_trial.h"
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/version.h" 10 #include "base/version.h"
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 if (trial) 64 if (trial)
65 trial->Disable(); 65 trial->Disable();
66 } 66 }
67 67
68 bool ShouldRunCompositingFieldTrial() { 68 bool ShouldRunCompositingFieldTrial() {
69 // Enable the field trial only on desktop OS's. 69 // Enable the field trial only on desktop OS's.
70 #if !(defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_LINUX)) 70 #if !(defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_LINUX))
71 return false; 71 return false;
72 #endif 72 #endif
73 73
74 // Necessary for linux_chromeos build since it defines both OS_LINUX
75 // and OS_CHROMEOS .
76 #if defined(OS_CHROMEOS)
77 return false;
78 #endif
79
80 #if defined(OS_WIN) 74 #if defined(OS_WIN)
81 // Don't run the trial on Windows XP. 75 // Don't run the trial on Windows XP.
82 if (base::win::GetVersion() < base::win::VERSION_VISTA) 76 if (base::win::GetVersion() < base::win::VERSION_VISTA)
83 return false; 77 return false;
84 #endif 78 #endif
85 79
86 // The performance of accelerated compositing is too low with software 80 // The performance of accelerated compositing is too low with software
87 // rendering. 81 // rendering.
88 if (content::GpuDataManager::GetInstance()->ShouldUseSoftwareRendering()) 82 if (content::GpuDataManager::GetInstance()->ShouldUseSoftwareRendering())
89 return false; 83 return false;
(...skipping 15 matching lines...) Expand all
105 // trial must call DisableCompositingFieldTrial() before returning. 99 // trial must call DisableCompositingFieldTrial() before returning.
106 void InitializeCompositingFieldTrial() { 100 void InitializeCompositingFieldTrial() {
107 // Early out in configurations that should not run the compositing 101 // Early out in configurations that should not run the compositing
108 // field trial. 102 // field trial.
109 if (!ShouldRunCompositingFieldTrial()) { 103 if (!ShouldRunCompositingFieldTrial()) {
110 DisableCompositingFieldTrial(); 104 DisableCompositingFieldTrial();
111 return; 105 return;
112 } 106 }
113 107
114 const base::FieldTrial::Probability kDivisor = 3; 108 const base::FieldTrial::Probability kDivisor = 3;
115 // Note: This field trial should be removed once we're comfortable with
116 // turning force compositing mode and threaded compositing on all relevant
117 // platforms (see crbug.com/149991).
118 scoped_refptr<base::FieldTrial> trial( 109 scoped_refptr<base::FieldTrial> trial(
119 base::FieldTrialList::FactoryGetFieldTrial( 110 base::FieldTrialList::FactoryGetFieldTrial(
120 content::kGpuCompositingFieldTrialName, kDivisor, 111 content::kGpuCompositingFieldTrialName, kDivisor,
121 "disable", 2013, 12, 31, NULL)); 112 "disable", 2012, 12, 31, NULL));
122 113
123 // Produce the same result on every run of this client. 114 // Produce the same result on every run of this client.
124 trial->UseOneTimeRandomization(); 115 trial->UseOneTimeRandomization();
125 116
126 // Note: The static field trial probabilities set here can be overwritten
127 // at runtime by Finch. Changing these static values won't have an effect
128 // if a Finch study is active.
129 base::FieldTrial::Probability force_compositing_mode_probability = 0; 117 base::FieldTrial::Probability force_compositing_mode_probability = 0;
130 base::FieldTrial::Probability threaded_compositing_probability = 0; 118 base::FieldTrial::Probability threaded_compositing_probability = 0;
131 119
132 // Threaded compositing mode isn't feature complete on mac or linux yet:
133 // http://crbug.com/133602 for mac
134 // http://crbug.com/140866 for linux
135
136 #if defined(OS_WIN)
137 // threaded-compositing turned on by default on Windows.
138 // (Windows XP is excluded explicitly in ShouldRunCompositingFieldTrial)
139 threaded_compositing_probability = 3;
140 #elif defined(OS_MACOSX)
141 // force-compositing-mode turned on by default on mac.
142 force_compositing_mode_probability = 3;
143 #elif defined(OS_LINUX)
144 chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel(); 120 chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel();
145 if (channel != chrome::VersionInfo::CHANNEL_STABLE && 121 if (channel == chrome::VersionInfo::CHANNEL_STABLE ||
146 channel != chrome::VersionInfo::CHANNEL_BETA) { 122 channel == chrome::VersionInfo::CHANNEL_BETA) {
147 // On channels < beta, force-compositing-mode and 123 // Stable and Beta channels: Non-threaded force-compositing-mode on by
124 // default (mac and windows only).
125 #if defined(OS_WIN) || defined(OS_MACOSX)
126 force_compositing_mode_probability = 3;
127 #endif
128 } else if (channel == chrome::VersionInfo::CHANNEL_DEV ||
129 channel == chrome::VersionInfo::CHANNEL_CANARY) {
130 // Dev and Canary channels: force-compositing-mode and
148 // threaded-compositing on with 1/3 probability each. 131 // threaded-compositing on with 1/3 probability each.
149 force_compositing_mode_probability = 1; 132 force_compositing_mode_probability = 1;
150 threaded_compositing_probability = 1; 133
134 #if defined(OS_MACOSX) || defined(OS_LINUX)
135 // Threaded compositing mode isn't feature complete on mac or linux yet:
136 // http://crbug.com/133602 for mac
137 // http://crbug.com/140866 for linux
138 threaded_compositing_probability = 0;
139 #else
140 if (!CommandLine::ForCurrentProcess()->HasSwitch(
141 switches::kDisableThreadedCompositing))
142 threaded_compositing_probability = 1;
143 #endif
151 } 144 }
152 #endif
153 145
154 int force_compositing_group = trial->AppendGroup( 146 int force_compositing_group = trial->AppendGroup(
155 content::kGpuCompositingFieldTrialForceCompositingEnabledName, 147 content::kGpuCompositingFieldTrialForceCompositingEnabledName,
156 force_compositing_mode_probability); 148 force_compositing_mode_probability);
157 int thread_group = trial->AppendGroup( 149 int thread_group = trial->AppendGroup(
158 content::kGpuCompositingFieldTrialThreadEnabledName, 150 content::kGpuCompositingFieldTrialThreadEnabledName,
159 threaded_compositing_probability); 151 threaded_compositing_probability);
160 152
161 bool force_compositing = (trial->group() == force_compositing_group); 153 bool force_compositing = (trial->group() == force_compositing_group);
162 bool thread = (trial->group() == thread_group); 154 bool thread = (trial->group() == thread_group);
163 UMA_HISTOGRAM_BOOLEAN("GPU.InForceCompositingModeFieldTrial", 155 UMA_HISTOGRAM_BOOLEAN("GPU.InForceCompositingModeFieldTrial",
164 force_compositing); 156 force_compositing);
165 UMA_HISTOGRAM_BOOLEAN("GPU.InCompositorThreadFieldTrial", thread); 157 UMA_HISTOGRAM_BOOLEAN("GPU.InCompositorThreadFieldTrial", thread);
166 } 158 }
167 159
168 } // namespace gpu_util; 160 } // namespace gpu_util;
169 161
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_tabs_apitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698