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

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

Issue 2337243003: Fix ENABLE_SWIFTSHADER flag. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: disable by default Created 4 years, 3 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
« no previous file with comments | « chrome/browser/about_flags.cc ('k') | ui/gl/BUILD.gn » ('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 <stdint.h> 7 #include <stdint.h>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/base_paths.h" 11 #include "base/base_paths.h"
12 #include "base/bind.h" 12 #include "base/bind.h"
13 #include "base/files/file_enumerator.h" 13 #include "base/files/file_enumerator.h"
14 #include "base/files/file_path.h" 14 #include "base/files/file_path.h"
15 #include "base/files/file_util.h" 15 #include "base/files/file_util.h"
16 #include "base/logging.h" 16 #include "base/logging.h"
17 #include "base/path_service.h" 17 #include "base/path_service.h"
18 #include "base/strings/string_util.h" 18 #include "base/strings/string_util.h"
19 #include "base/values.h" 19 #include "base/values.h"
20 #include "build/build_config.h" 20 #include "build/build_config.h"
21 #include "components/component_updater/component_updater_paths.h" 21 #include "components/component_updater/component_updater_paths.h"
22 #include "components/component_updater/component_updater_service.h" 22 #include "components/component_updater/component_updater_service.h"
23 #include "components/update_client/update_client.h" 23 #include "components/update_client/update_client.h"
24 #include "content/public/browser/browser_thread.h" 24 #include "content/public/browser/browser_thread.h"
25 #include "content/public/browser/gpu_data_manager.h" 25 #include "content/public/browser/gpu_data_manager.h"
26 #include "content/public/browser/gpu_data_manager_observer.h" 26 #include "content/public/browser/gpu_data_manager_observer.h"
27 #include "gpu/config/gpu_feature_type.h" 27 #include "gpu/config/gpu_feature_type.h"
28 #include "ui/gl/gl_features.h"
28 29
29 using content::BrowserThread; 30 using content::BrowserThread;
30 using content::GpuDataManager; 31 using content::GpuDataManager;
31 32
32 namespace component_updater { 33 namespace component_updater {
33 34
34 namespace { 35 namespace {
35 36
36 // CRX hash. The extension id is: nhfgdggnnopgbfdlpeoalgcjdgfafocg. 37 // CRX hash. The extension id is: nhfgdggnnopgbfdlpeoalgcjdgfafocg.
37 const uint8_t kSha2Hash[] = {0xd7, 0x56, 0x36, 0x6d, 0xde, 0xf6, 0x15, 0x3b, 38 const uint8_t kSha2Hash[] = {0xd7, 0x56, 0x36, 0x6d, 0xde, 0xf6, 0x15, 0x3b,
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 base::Version version(kNullVersion); 212 base::Version version(kNullVersion);
212 GetLatestSwiftShaderDirectory(&path, &version, NULL); 213 GetLatestSwiftShaderDirectory(&path, &version, NULL);
213 214
214 BrowserThread::PostTask( 215 BrowserThread::PostTask(
215 BrowserThread::UI, 216 BrowserThread::UI,
216 FROM_HERE, 217 FROM_HERE,
217 base::Bind(&FinishSwiftShaderUpdateRegistration, cus_, version)); 218 base::Bind(&FinishSwiftShaderUpdateRegistration, cus_, version));
218 } 219 }
219 } 220 }
220 221
221 #if defined(ENABLE_SWIFTSHADER) 222 #if BUILDFLAG(ENABLE_SWIFTSHADER)
222 223
223 // Check if there already is a version of swiftshader installed, 224 // Check if there already is a version of swiftshader installed,
224 // and if so register it. 225 // and if so register it.
225 void RegisterSwiftShaderPath(ComponentUpdateService* cus) { 226 void RegisterSwiftShaderPath(ComponentUpdateService* cus) {
226 DCHECK_CURRENTLY_ON(BrowserThread::FILE); 227 DCHECK_CURRENTLY_ON(BrowserThread::FILE);
227 base::FilePath path = GetSwiftShaderBaseDirectory(); 228 base::FilePath path = GetSwiftShaderBaseDirectory();
228 if (!base::PathExists(path)) { 229 if (!base::PathExists(path)) {
229 if (!base::CreateDirectory(path)) { 230 if (!base::CreateDirectory(path)) {
230 NOTREACHED() << "Could not create SwiftShader directory."; 231 NOTREACHED() << "Could not create SwiftShader directory.";
231 return; 232 return;
(...skipping 19 matching lines...) Expand all
251 ++iter) { 252 ++iter) {
252 base::DeleteFile(*iter, true); 253 base::DeleteFile(*iter, true);
253 } 254 }
254 } 255 }
255 256
256 #endif // ENABLE_SWIFTSHADER 257 #endif // ENABLE_SWIFTSHADER
257 258
258 } // namespace 259 } // namespace
259 260
260 void RegisterSwiftShaderComponent(ComponentUpdateService* cus) { 261 void RegisterSwiftShaderComponent(ComponentUpdateService* cus) {
261 #if defined(ENABLE_SWIFTSHADER) && defined(ARCH_CPU_X86) 262 #if BUILDFLAG(ENABLE_SWIFTSHADER) && defined(ARCH_CPU_X86)
262 BrowserThread::PostTask(BrowserThread::FILE, 263 BrowserThread::PostTask(BrowserThread::FILE,
263 FROM_HERE, 264 FROM_HERE,
264 base::Bind(&RegisterSwiftShaderPath, cus)); 265 base::Bind(&RegisterSwiftShaderPath, cus));
265 #endif 266 #endif
266 } 267 }
267 268
268 } // namespace component_updater 269 } // namespace component_updater
OLDNEW
« no previous file with comments | « chrome/browser/about_flags.cc ('k') | ui/gl/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698