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/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" |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 base::Bind(&FinishSwiftShaderUpdateRegistration, cus_, version)); | 202 base::Bind(&FinishSwiftShaderUpdateRegistration, cus_, version)); |
203 } | 203 } |
204 } | 204 } |
205 | 205 |
206 // Check if there already is a version of swiftshader installed, | 206 // Check if there already is a version of swiftshader installed, |
207 // and if so register it. | 207 // and if so register it. |
208 void RegisterSwiftShaderPath(ComponentUpdateService* cus) { | 208 void RegisterSwiftShaderPath(ComponentUpdateService* cus) { |
209 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 209 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
210 base::FilePath path = GetSwiftShaderBaseDirectory(); | 210 base::FilePath path = GetSwiftShaderBaseDirectory(); |
211 if (!base::PathExists(path)) { | 211 if (!base::PathExists(path)) { |
212 if (!file_util::CreateDirectory(path)) { | 212 if (!base::CreateDirectory(path)) { |
213 NOTREACHED() << "Could not create SwiftShader directory."; | 213 NOTREACHED() << "Could not create SwiftShader directory."; |
214 return; | 214 return; |
215 } | 215 } |
216 } | 216 } |
217 | 217 |
218 Version version(kNullVersion); | 218 Version version(kNullVersion); |
219 std::vector<base::FilePath> older_dirs; | 219 std::vector<base::FilePath> older_dirs; |
220 if (GetLatestSwiftShaderDirectory(&path, &version, &older_dirs)) | 220 if (GetLatestSwiftShaderDirectory(&path, &version, &older_dirs)) |
221 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, | 221 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
222 base::Bind(&RegisterSwiftShaderWithChrome, path)); | 222 base::Bind(&RegisterSwiftShaderWithChrome, path)); |
(...skipping 14 matching lines...) Expand all Loading... |
237 void RegisterSwiftShaderComponent(ComponentUpdateService* cus) { | 237 void RegisterSwiftShaderComponent(ComponentUpdateService* cus) { |
238 #if defined(ENABLE_SWIFTSHADER) | 238 #if defined(ENABLE_SWIFTSHADER) |
239 base::CPU cpu; | 239 base::CPU cpu; |
240 | 240 |
241 if (!cpu.has_sse2()) | 241 if (!cpu.has_sse2()) |
242 return; | 242 return; |
243 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, | 243 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, |
244 base::Bind(&RegisterSwiftShaderPath, cus)); | 244 base::Bind(&RegisterSwiftShaderPath, cus)); |
245 #endif | 245 #endif |
246 } | 246 } |
OLD | NEW |