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" |
11 #if defined(OS_WIN) | 11 #if defined(OS_WIN) |
12 #include "base/win/windows_version.h" | 12 #include "base/win/windows_version.h" |
13 #endif | 13 #endif |
14 #include "chrome/common/chrome_switches.h" | 14 #include "chrome/common/chrome_switches.h" |
15 #include "chrome/common/chrome_version_info.h" | 15 #include "chrome/common/chrome_version_info.h" |
16 #include "content/public/browser/gpu_data_manager.h" | 16 #include "content/public/browser/gpu_data_manager.h" |
17 #include "content/public/common/content_constants.h" | 17 #include "content/public/common/content_constants.h" |
18 #include "content/public/common/content_switches.h" | 18 #include "content/public/common/content_switches.h" |
19 #include "grit/browser_resources.h" | |
20 #include "ui/base/resource/resource_bundle.h" | |
21 | 19 |
22 using content::GpuDataManager; | 20 using content::GpuDataManager; |
23 | 21 |
24 namespace gpu_util { | 22 namespace gpu_util { |
25 | 23 |
26 void DisableCompositingFieldTrial() { | 24 void DisableCompositingFieldTrial() { |
27 base::FieldTrial* trial = | 25 base::FieldTrial* trial = |
28 base::FieldTrialList::Find(content::kGpuCompositingFieldTrialName); | 26 base::FieldTrialList::Find(content::kGpuCompositingFieldTrialName); |
29 if (trial) | 27 if (trial) |
30 trial->Disable(); | 28 trial->Disable(); |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 content::kGpuCompositingFieldTrialThreadEnabledName, | 113 content::kGpuCompositingFieldTrialThreadEnabledName, |
116 threaded_compositing_probability); | 114 threaded_compositing_probability); |
117 | 115 |
118 bool force_compositing = (trial->group() == force_compositing_group); | 116 bool force_compositing = (trial->group() == force_compositing_group); |
119 bool thread = (trial->group() == thread_group); | 117 bool thread = (trial->group() == thread_group); |
120 UMA_HISTOGRAM_BOOLEAN("GPU.InForceCompositingModeFieldTrial", | 118 UMA_HISTOGRAM_BOOLEAN("GPU.InForceCompositingModeFieldTrial", |
121 force_compositing); | 119 force_compositing); |
122 UMA_HISTOGRAM_BOOLEAN("GPU.InCompositorThreadFieldTrial", thread); | 120 UMA_HISTOGRAM_BOOLEAN("GPU.InCompositorThreadFieldTrial", thread); |
123 } | 121 } |
124 | 122 |
125 // Load GPU Blacklist, collect preliminary gpu info, and compute preliminary | |
126 // gpu feature flags. | |
127 void InitializeGpuDataManager(const CommandLine& command_line) { | |
128 if (command_line.HasSwitch(switches::kSkipGpuDataLoading)) | |
129 return; | |
130 | |
131 std::string chrome_version_string = "0"; | |
132 std::string gpu_blacklist_json_string; | |
133 if (!command_line.HasSwitch(switches::kIgnoreGpuBlacklist)) { | |
134 chrome::VersionInfo chrome_version_info; | |
135 if (chrome_version_info.is_valid()) | |
136 chrome_version_string = chrome_version_info.Version(); | |
137 | |
138 const base::StringPiece gpu_blacklist_json( | |
139 ResourceBundle::GetSharedInstance().GetRawDataResource( | |
140 IDR_GPU_BLACKLIST, ui::SCALE_FACTOR_NONE)); | |
141 gpu_blacklist_json_string = gpu_blacklist_json.as_string(); | |
142 } | |
143 content::GpuDataManager::GetInstance()->Initialize( | |
144 chrome_version_string, gpu_blacklist_json_string); | |
145 } | |
146 | |
147 } // namespace gpu_util; | 123 } // namespace gpu_util; |
148 | 124 |
OLD | NEW |