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

Side by Side Diff: chrome/browser/component_updater/swiftshader_component_installer.cc

Issue 15745014: Move GPU device/driver info related code from content to gpu. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: rebase Created 7 years, 7 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 | « ash/shell.cc ('k') | chrome/browser/extensions/api/webstore_private/webstore_private_api.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/component_updater/swiftshader_component_installer.h" 5 #include "chrome/browser/component_updater/swiftshader_component_installer.h"
6 6
7 #include "base/base_paths.h" 7 #include "base/base_paths.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/cpu.h" 10 #include "base/cpu.h"
11 #include "base/file_util.h" 11 #include "base/file_util.h"
12 #include "base/files/file_path.h" 12 #include "base/files/file_path.h"
13 #include "base/logging.h" 13 #include "base/logging.h"
14 #include "base/path_service.h" 14 #include "base/path_service.h"
15 #include "base/string_util.h" 15 #include "base/string_util.h"
16 #include "base/values.h" 16 #include "base/values.h"
17 #include "chrome/browser/component_updater/component_updater_service.h" 17 #include "chrome/browser/component_updater/component_updater_service.h"
18 #include "chrome/common/chrome_paths.h" 18 #include "chrome/common/chrome_paths.h"
19 #include "content/public/browser/browser_thread.h" 19 #include "content/public/browser/browser_thread.h"
20 #include "content/public/browser/gpu_data_manager.h" 20 #include "content/public/browser/gpu_data_manager.h"
21 #include "content/public/browser/gpu_data_manager_observer.h" 21 #include "content/public/browser/gpu_data_manager_observer.h"
22 #include "content/public/common/gpu_feature_type.h" 22 #include "gpu/config/gpu_feature_type.h"
23 23
24 using content::BrowserThread; 24 using content::BrowserThread;
25 using content::GpuDataManager; 25 using content::GpuDataManager;
26 26
27 namespace { 27 namespace {
28 28
29 // CRX hash. The extension id is: nhfgdggnnopgbfdlpeoalgcjdgfafocg. 29 // CRX hash. The extension id is: nhfgdggnnopgbfdlpeoalgcjdgfafocg.
30 const uint8 kSha2Hash[] = {0xd7, 0x56, 0x36, 0x6d, 0xde, 0xf6, 0x15, 0x3b, 30 const uint8 kSha2Hash[] = {0xd7, 0x56, 0x36, 0x6d, 0xde, 0xf6, 0x15, 0x3b,
31 0xf4, 0xe0, 0xb6, 0x29, 0x36, 0x50, 0x5e, 0x26, 31 0xf4, 0xe0, 0xb6, 0x29, 0x36, 0x50, 0x5e, 0x26,
32 0xbd, 0x77, 0x8b, 0x8e, 0x35, 0xc2, 0x7e, 0x43, 32 0xbd, 0x77, 0x8b, 0x8e, 0x35, 0xc2, 0x7e, 0x43,
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 }; 173 };
174 174
175 UpdateChecker::UpdateChecker(ComponentUpdateService* cus) 175 UpdateChecker::UpdateChecker(ComponentUpdateService* cus)
176 : cus_(cus) { 176 : cus_(cus) {
177 } 177 }
178 178
179 void UpdateChecker::OnGpuInfoUpdate() { 179 void UpdateChecker::OnGpuInfoUpdate() {
180 GpuDataManager *gpu_data_manager = GpuDataManager::GetInstance(); 180 GpuDataManager *gpu_data_manager = GpuDataManager::GetInstance();
181 181
182 if (!gpu_data_manager->GpuAccessAllowed(NULL) || 182 if (!gpu_data_manager->GpuAccessAllowed(NULL) ||
183 gpu_data_manager->IsFeatureBlacklisted(content::GPU_FEATURE_TYPE_WEBGL) || 183 gpu_data_manager->IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_WEBGL) ||
184 gpu_data_manager->ShouldUseSwiftShader()) { 184 gpu_data_manager->ShouldUseSwiftShader()) {
185 gpu_data_manager->RemoveObserver(this); 185 gpu_data_manager->RemoveObserver(this);
186 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); 186 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
187 base::FilePath path = GetSwiftShaderBaseDirectory(); 187 base::FilePath path = GetSwiftShaderBaseDirectory();
188 188
189 Version version(kNullVersion); 189 Version version(kNullVersion);
190 GetLatestSwiftShaderDirectory(&path, &version, NULL); 190 GetLatestSwiftShaderDirectory(&path, &version, NULL);
191 191
192 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, 192 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
193 base::Bind(&FinishSwiftShaderUpdateRegistration, cus_, version)); 193 base::Bind(&FinishSwiftShaderUpdateRegistration, cus_, version));
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 void RegisterSwiftShaderComponent(ComponentUpdateService* cus) { 228 void RegisterSwiftShaderComponent(ComponentUpdateService* cus) {
229 #if defined(ENABLE_SWIFTSHADER) 229 #if defined(ENABLE_SWIFTSHADER)
230 base::CPU cpu; 230 base::CPU cpu;
231 231
232 if (!cpu.has_sse2()) 232 if (!cpu.has_sse2())
233 return; 233 return;
234 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, 234 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE,
235 base::Bind(&RegisterSwiftShaderPath, cus)); 235 base::Bind(&RegisterSwiftShaderPath, cus));
236 #endif 236 #endif
237 } 237 }
OLDNEW
« no previous file with comments | « ash/shell.cc ('k') | chrome/browser/extensions/api/webstore_private/webstore_private_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698