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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 public: | 98 public: |
99 explicit SwiftShaderComponentInstaller(const Version& version); | 99 explicit SwiftShaderComponentInstaller(const Version& version); |
100 | 100 |
101 virtual ~SwiftShaderComponentInstaller() {} | 101 virtual ~SwiftShaderComponentInstaller() {} |
102 | 102 |
103 virtual void OnUpdateError(int error) OVERRIDE; | 103 virtual void OnUpdateError(int error) OVERRIDE; |
104 | 104 |
105 virtual bool Install(const base::DictionaryValue& manifest, | 105 virtual bool Install(const base::DictionaryValue& manifest, |
106 const base::FilePath& unpack_path) OVERRIDE; | 106 const base::FilePath& unpack_path) OVERRIDE; |
107 | 107 |
| 108 virtual bool GetInstalledFile(const std::string& file, |
| 109 base::FilePath* installed_file) OVERRIDE; |
| 110 |
108 private: | 111 private: |
109 Version current_version_; | 112 Version current_version_; |
110 }; | 113 }; |
111 | 114 |
112 SwiftShaderComponentInstaller::SwiftShaderComponentInstaller( | 115 SwiftShaderComponentInstaller::SwiftShaderComponentInstaller( |
113 const Version& version) : current_version_(version) { | 116 const Version& version) : current_version_(version) { |
114 DCHECK(version.IsValid()); | 117 DCHECK(version.IsValid()); |
115 } | 118 } |
116 | 119 |
117 void SwiftShaderComponentInstaller::OnUpdateError(int error) { | 120 void SwiftShaderComponentInstaller::OnUpdateError(int error) { |
(...skipping 24 matching lines...) Expand all Loading... |
142 return false; | 145 return false; |
143 if (!file_util::Move(unpack_path, path)) | 146 if (!file_util::Move(unpack_path, path)) |
144 return false; | 147 return false; |
145 // Installation is done. Now tell the rest of chrome. | 148 // Installation is done. Now tell the rest of chrome. |
146 current_version_ = version; | 149 current_version_ = version; |
147 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, | 150 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
148 base::Bind(&RegisterSwiftShaderWithChrome, path)); | 151 base::Bind(&RegisterSwiftShaderWithChrome, path)); |
149 return true; | 152 return true; |
150 } | 153 } |
151 | 154 |
| 155 bool SwiftShaderComponentInstaller::GetInstalledFile( |
| 156 const std::string& file, base::FilePath* installed_file) { |
| 157 return false; |
| 158 } |
| 159 |
152 void FinishSwiftShaderUpdateRegistration(ComponentUpdateService* cus, | 160 void FinishSwiftShaderUpdateRegistration(ComponentUpdateService* cus, |
153 const Version& version) { | 161 const Version& version) { |
154 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 162 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
155 | 163 |
156 CrxComponent swiftshader; | 164 CrxComponent swiftshader; |
157 swiftshader.name = "Swift Shader"; | 165 swiftshader.name = "Swift Shader"; |
158 swiftshader.installer = new SwiftShaderComponentInstaller(version); | 166 swiftshader.installer = new SwiftShaderComponentInstaller(version); |
159 swiftshader.version = version; | 167 swiftshader.version = version; |
160 swiftshader.pk_hash.assign(kSha2Hash, &kSha2Hash[sizeof(kSha2Hash)]); | 168 swiftshader.pk_hash.assign(kSha2Hash, &kSha2Hash[sizeof(kSha2Hash)]); |
161 if (cus->RegisterComponent(swiftshader) != ComponentUpdateService::kOk) { | 169 if (cus->RegisterComponent(swiftshader) != ComponentUpdateService::kOk) { |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 void RegisterSwiftShaderComponent(ComponentUpdateService* cus) { | 237 void RegisterSwiftShaderComponent(ComponentUpdateService* cus) { |
230 #if defined(ENABLE_SWIFTSHADER) | 238 #if defined(ENABLE_SWIFTSHADER) |
231 base::CPU cpu; | 239 base::CPU cpu; |
232 | 240 |
233 if (!cpu.has_sse2()) | 241 if (!cpu.has_sse2()) |
234 return; | 242 return; |
235 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, | 243 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, |
236 base::Bind(&RegisterSwiftShaderPath, cus)); | 244 base::Bind(&RegisterSwiftShaderPath, cus)); |
237 #endif | 245 #endif |
238 } | 246 } |
OLD | NEW |