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 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 if (current_version_.CompareTo(version) >= 0) | 136 if (current_version_.CompareTo(version) >= 0) |
137 return false; | 137 return false; |
138 if (!file_util::PathExists(unpack_path.Append(kSwiftShaderEglName)) || | 138 if (!file_util::PathExists(unpack_path.Append(kSwiftShaderEglName)) || |
139 !file_util::PathExists(unpack_path.Append(kSwiftShaderGlesName))) | 139 !file_util::PathExists(unpack_path.Append(kSwiftShaderGlesName))) |
140 return false; | 140 return false; |
141 // Passed the basic tests. Time to install it. | 141 // Passed the basic tests. Time to install it. |
142 base::FilePath path = | 142 base::FilePath path = |
143 GetSwiftShaderBaseDirectory().AppendASCII(version.GetString()); | 143 GetSwiftShaderBaseDirectory().AppendASCII(version.GetString()); |
144 if (file_util::PathExists(path)) | 144 if (file_util::PathExists(path)) |
145 return false; | 145 return false; |
146 if (!file_util::Move(unpack_path, path)) | 146 if (!base::Move(unpack_path, path)) |
147 return false; | 147 return false; |
148 // Installation is done. Now tell the rest of chrome. | 148 // Installation is done. Now tell the rest of chrome. |
149 current_version_ = version; | 149 current_version_ = version; |
150 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, | 150 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
151 base::Bind(&RegisterSwiftShaderWithChrome, path)); | 151 base::Bind(&RegisterSwiftShaderWithChrome, path)); |
152 return true; | 152 return true; |
153 } | 153 } |
154 | 154 |
155 bool SwiftShaderComponentInstaller::GetInstalledFile( | 155 bool SwiftShaderComponentInstaller::GetInstalledFile( |
156 const std::string& file, base::FilePath* installed_file) { | 156 const std::string& file, base::FilePath* installed_file) { |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after 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 |