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 "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 Loading... |
64 // trial must call DisableCompositingFieldTrial() before returning. | 64 // trial must call DisableCompositingFieldTrial() before returning. |
65 void InitializeCompositingFieldTrial() { | 65 void InitializeCompositingFieldTrial() { |
66 // Early out in configurations that should not run the compositing | 66 // Early out in configurations that should not run the compositing |
67 // field trial. | 67 // field trial. |
68 if (!ShouldRunCompositingFieldTrial()) { | 68 if (!ShouldRunCompositingFieldTrial()) { |
69 DisableCompositingFieldTrial(); | 69 DisableCompositingFieldTrial(); |
70 return; | 70 return; |
71 } | 71 } |
72 | 72 |
73 const base::FieldTrial::Probability kDivisor = 3; | 73 const base::FieldTrial::Probability kDivisor = 3; |
| 74 // Note: This field trial should be removed once we're comfortable with |
| 75 // turning force compositing mode and threaded compositing on all relevant |
| 76 // platforms (see crbug.com/149991). |
74 scoped_refptr<base::FieldTrial> trial( | 77 scoped_refptr<base::FieldTrial> trial( |
75 base::FieldTrialList::FactoryGetFieldTrial( | 78 base::FieldTrialList::FactoryGetFieldTrial( |
76 content::kGpuCompositingFieldTrialName, kDivisor, | 79 content::kGpuCompositingFieldTrialName, kDivisor, |
77 "disable", 2012, 12, 31, NULL)); | 80 "disable", 2013, 12, 31, NULL)); |
78 | 81 |
79 // Produce the same result on every run of this client. | 82 // Produce the same result on every run of this client. |
80 trial->UseOneTimeRandomization(); | 83 trial->UseOneTimeRandomization(); |
81 | 84 |
| 85 // Note: The static field trial probabilities set here can be overwritten |
| 86 // at runtime by Finch. Changing these static values won't have an effect |
| 87 // if a Finch study is active. |
82 base::FieldTrial::Probability force_compositing_mode_probability = 0; | 88 base::FieldTrial::Probability force_compositing_mode_probability = 0; |
83 base::FieldTrial::Probability threaded_compositing_probability = 0; | 89 base::FieldTrial::Probability threaded_compositing_probability = 0; |
84 | 90 |
| 91 // Threaded compositing mode isn't feature complete on mac or linux yet: |
| 92 // http://crbug.com/133602 for mac |
| 93 // http://crbug.com/140866 for linux |
| 94 |
| 95 #if defined(OS_WIN) |
| 96 // threaded-compositing turned on by default on Windows. |
| 97 // (Windows XP is excluded explicitly in ShouldRunCompositingFieldTrial) |
| 98 threaded_compositing_probability = 3; |
| 99 #elif defined(OS_MACOSX) |
| 100 // force-compositing-mode turned on by default on mac. |
| 101 force_compositing_mode_probability = 3; |
| 102 #elif defined(OS_LINUX) |
85 chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel(); | 103 chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel(); |
86 if (channel == chrome::VersionInfo::CHANNEL_STABLE || | 104 if (channel != chrome::VersionInfo::CHANNEL_STABLE && |
87 channel == chrome::VersionInfo::CHANNEL_BETA) { | 105 channel != chrome::VersionInfo::CHANNEL_BETA) { |
88 // Stable and Beta channels: Non-threaded force-compositing-mode on by | 106 // On channels < beta, force-compositing-mode and |
89 // default (mac and windows only). | |
90 #if defined(OS_WIN) || defined(OS_MACOSX) | |
91 force_compositing_mode_probability = 3; | |
92 #endif | |
93 } else if (channel == chrome::VersionInfo::CHANNEL_DEV || | |
94 channel == chrome::VersionInfo::CHANNEL_CANARY) { | |
95 // Dev and Canary channels: force-compositing-mode and | |
96 // threaded-compositing on with 1/3 probability each. | 107 // threaded-compositing on with 1/3 probability each. |
97 force_compositing_mode_probability = 1; | 108 force_compositing_mode_probability = 1; |
98 | 109 threaded_compositing_probability = 1; |
99 #if defined(OS_MACOSX) || defined(OS_LINUX) | 110 } |
100 // Threaded compositing mode isn't feature complete on mac or linux yet: | |
101 // http://crbug.com/133602 for mac | |
102 // http://crbug.com/140866 for linux | |
103 threaded_compositing_probability = 0; | |
104 #else | |
105 if (!CommandLine::ForCurrentProcess()->HasSwitch( | |
106 switches::kDisableThreadedCompositing)) | |
107 threaded_compositing_probability = 1; | |
108 #endif | 111 #endif |
109 } | |
110 | 112 |
111 int force_compositing_group = trial->AppendGroup( | 113 int force_compositing_group = trial->AppendGroup( |
112 content::kGpuCompositingFieldTrialForceCompositingEnabledName, | 114 content::kGpuCompositingFieldTrialForceCompositingEnabledName, |
113 force_compositing_mode_probability); | 115 force_compositing_mode_probability); |
114 int thread_group = trial->AppendGroup( | 116 int thread_group = trial->AppendGroup( |
115 content::kGpuCompositingFieldTrialThreadEnabledName, | 117 content::kGpuCompositingFieldTrialThreadEnabledName, |
116 threaded_compositing_probability); | 118 threaded_compositing_probability); |
117 | 119 |
118 bool force_compositing = (trial->group() == force_compositing_group); | 120 bool force_compositing = (trial->group() == force_compositing_group); |
119 bool thread = (trial->group() == thread_group); | 121 bool thread = (trial->group() == thread_group); |
(...skipping 19 matching lines...) Expand all Loading... |
139 ResourceBundle::GetSharedInstance().GetRawDataResource( | 141 ResourceBundle::GetSharedInstance().GetRawDataResource( |
140 IDR_GPU_BLACKLIST, ui::SCALE_FACTOR_NONE)); | 142 IDR_GPU_BLACKLIST, ui::SCALE_FACTOR_NONE)); |
141 gpu_blacklist_json_string = gpu_blacklist_json.as_string(); | 143 gpu_blacklist_json_string = gpu_blacklist_json.as_string(); |
142 } | 144 } |
143 content::GpuDataManager::GetInstance()->Initialize( | 145 content::GpuDataManager::GetInstance()->Initialize( |
144 chrome_version_string, gpu_blacklist_json_string); | 146 chrome_version_string, gpu_blacklist_json_string); |
145 } | 147 } |
146 | 148 |
147 } // namespace gpu_util; | 149 } // namespace gpu_util; |
148 | 150 |
OLD | NEW |