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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 scoped_refptr<base::FieldTrial> trial( | 74 scoped_refptr<base::FieldTrial> trial( |
75 base::FieldTrialList::FactoryGetFieldTrial( | 75 base::FieldTrialList::FactoryGetFieldTrial( |
76 content::kGpuCompositingFieldTrialName, kDivisor, | 76 content::kGpuCompositingFieldTrialName, kDivisor, |
77 "disable", 2012, 12, 31, NULL)); | 77 "disable", 2017, 12, 31, NULL)); |
Alexei Svitkine (slow)
2012/09/13 13:37:45
The goal of the expiry date is to set an expectati
| |
78 | 78 |
79 // Produce the same result on every run of this client. | 79 // Produce the same result on every run of this client. |
80 trial->UseOneTimeRandomization(); | 80 trial->UseOneTimeRandomization(); |
81 | 81 |
82 base::FieldTrial::Probability force_compositing_mode_probability = 0; | 82 base::FieldTrial::Probability force_compositing_mode_probability = 0; |
83 base::FieldTrial::Probability threaded_compositing_probability = 0; | 83 base::FieldTrial::Probability threaded_compositing_probability = 0; |
84 | 84 |
85 // Threaded compositing mode isn't feature complete on mac or linux yet: | |
86 // http://crbug.com/133602 for mac | |
87 // http://crbug.com/140866 for linux | |
88 | |
89 #if defined(OS_WIN) | |
90 // threaded-compositing turned on by default on Windows. | |
91 // (Windows XP is excluded explicitly in ShouldRunCompositingFieldTrial) | |
92 threaded_compositing_probability = 3; | |
Nico
2012/09/13 01:49:37
nit: Set this to kDivisor instead
| |
93 #elif defined(OS_MACOSX) | |
94 // force-compositing-mode turned on by default on mac. | |
95 force_compositing_mode_probability = 3; | |
Nico
2012/09/13 01:49:37
same
| |
96 #elif defined(OS_LINUX) | |
85 chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel(); | 97 chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel(); |
86 if (channel == chrome::VersionInfo::CHANNEL_STABLE || | 98 if (channel != chrome::VersionInfo::CHANNEL_STABLE && |
87 channel == chrome::VersionInfo::CHANNEL_BETA) { | 99 channel != chrome::VersionInfo::CHANNEL_BETA) { |
88 // Stable and Beta channels: Non-threaded force-compositing-mode on by | 100 // 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. | 101 // threaded-compositing on with 1/3 probability each. |
97 force_compositing_mode_probability = 1; | 102 force_compositing_mode_probability = 1; |
98 | 103 threaded_compositing_mode_probability = 1; |
Alexei Svitkine (slow)
2012/09/13 13:37:45
The variable name you use elsewhere is |threaded_c
| |
99 #if defined(OS_MACOSX) || defined(OS_LINUX) | 104 } |
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 | 105 #endif |
109 } | |
110 | 106 |
111 int force_compositing_group = trial->AppendGroup( | 107 int force_compositing_group = trial->AppendGroup( |
112 content::kGpuCompositingFieldTrialForceCompositingEnabledName, | 108 content::kGpuCompositingFieldTrialForceCompositingEnabledName, |
113 force_compositing_mode_probability); | 109 force_compositing_mode_probability); |
114 int thread_group = trial->AppendGroup( | 110 int thread_group = trial->AppendGroup( |
115 content::kGpuCompositingFieldTrialThreadEnabledName, | 111 content::kGpuCompositingFieldTrialThreadEnabledName, |
116 threaded_compositing_probability); | 112 threaded_compositing_probability); |
117 | 113 |
118 bool force_compositing = (trial->group() == force_compositing_group); | 114 bool force_compositing = (trial->group() == force_compositing_group); |
119 bool thread = (trial->group() == thread_group); | 115 bool thread = (trial->group() == thread_group); |
(...skipping 19 matching lines...) Expand all Loading... | |
139 ResourceBundle::GetSharedInstance().GetRawDataResource( | 135 ResourceBundle::GetSharedInstance().GetRawDataResource( |
140 IDR_GPU_BLACKLIST, ui::SCALE_FACTOR_NONE)); | 136 IDR_GPU_BLACKLIST, ui::SCALE_FACTOR_NONE)); |
141 gpu_blacklist_json_string = gpu_blacklist_json.as_string(); | 137 gpu_blacklist_json_string = gpu_blacklist_json.as_string(); |
142 } | 138 } |
143 content::GpuDataManager::GetInstance()->Initialize( | 139 content::GpuDataManager::GetInstance()->Initialize( |
144 chrome_version_string, gpu_blacklist_json_string); | 140 chrome_version_string, gpu_blacklist_json_string); |
145 } | 141 } |
146 | 142 |
147 } // namespace gpu_util; | 143 } // namespace gpu_util; |
148 | 144 |
OLD | NEW |