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

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

Issue 14320035: Minor code cleanup of component updater. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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 | « chrome/browser/component_updater/recovery_component_installer.cc ('k') | no next file » | 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 "content/public/common/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 sha2_hash[] = {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,
33 0x52, 0x47, 0x62, 0xed, 0x12, 0xca, 0xcc, 0x6a}; 33 0x52, 0x47, 0x62, 0xed, 0x12, 0xca, 0xcc, 0x6a};
34 34
35 // File name of the internal SwiftShader plugin on different platforms. 35 // File name of the internal SwiftShader plugin on different platforms.
36 const base::FilePath::CharType kSwiftShaderEglName[] = 36 const base::FilePath::CharType kSwiftShaderEglName[] =
37 FILE_PATH_LITERAL("libegl.dll"); 37 FILE_PATH_LITERAL("libegl.dll");
38 const base::FilePath::CharType kSwiftShaderGlesName[] = 38 const base::FilePath::CharType kSwiftShaderGlesName[] =
39 FILE_PATH_LITERAL("libglesv2.dll"); 39 FILE_PATH_LITERAL("libglesv2.dll");
40 40
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 } 148 }
149 149
150 void FinishSwiftShaderUpdateRegistration(ComponentUpdateService* cus, 150 void FinishSwiftShaderUpdateRegistration(ComponentUpdateService* cus,
151 const Version& version) { 151 const Version& version) {
152 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 152 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
153 153
154 CrxComponent swiftshader; 154 CrxComponent swiftshader;
155 swiftshader.name = "Swift Shader"; 155 swiftshader.name = "Swift Shader";
156 swiftshader.installer = new SwiftShaderComponentInstaller(version); 156 swiftshader.installer = new SwiftShaderComponentInstaller(version);
157 swiftshader.version = version; 157 swiftshader.version = version;
158 swiftshader.pk_hash.assign(sha2_hash, &sha2_hash[sizeof(sha2_hash)]); 158 swiftshader.pk_hash.assign(kSha2Hash, &kSha2Hash[sizeof(kSha2Hash)]);
159 if (cus->RegisterComponent(swiftshader) != ComponentUpdateService::kOk) { 159 if (cus->RegisterComponent(swiftshader) != ComponentUpdateService::kOk) {
160 NOTREACHED() << "SwiftShader component registration fail"; 160 NOTREACHED() << "SwiftShader component registration fail";
161 } 161 }
162 } 162 }
163 163
164 class UpdateChecker : public content::GpuDataManagerObserver { 164 class UpdateChecker : public content::GpuDataManagerObserver {
165 public: 165 public:
166 explicit UpdateChecker(ComponentUpdateService* cus); 166 explicit UpdateChecker(ComponentUpdateService* cus);
167 167
168 virtual void OnGpuInfoUpdate() OVERRIDE; 168 virtual void OnGpuInfoUpdate() OVERRIDE;
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 void RegisterSwiftShaderComponent(ComponentUpdateService* cus) { 227 void RegisterSwiftShaderComponent(ComponentUpdateService* cus) {
228 #if defined(ENABLE_SWIFTSHADER) 228 #if defined(ENABLE_SWIFTSHADER)
229 base::CPU cpu; 229 base::CPU cpu;
230 230
231 if (!cpu.has_sse2()) 231 if (!cpu.has_sse2())
232 return; 232 return;
233 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, 233 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE,
234 base::Bind(&RegisterSwiftShaderPath, cus)); 234 base::Bind(&RegisterSwiftShaderPath, cus));
235 #endif 235 #endif
236 } 236 }
OLDNEW
« no previous file with comments | « chrome/browser/component_updater/recovery_component_installer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698