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