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

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

Issue 1830023002: Add some more logging to help diagnise component update issues. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@brand
Patch Set: Created 4 years, 9 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 | « no previous file | components/component_updater/default_component_installer.cc » ('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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/widevine_cdm_component_installer.h" 5 #include "chrome/browser/component_updater/widevine_cdm_component_installer.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 #include <string.h> 9 #include <string.h>
10 #include <string> 10 #include <string>
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 const base::FilePath& install_dir) { 273 const base::FilePath& install_dir) {
274 return true; 274 return true;
275 } 275 }
276 276
277 // Once the CDM is ready, check the CDM adapter. 277 // Once the CDM is ready, check the CDM adapter.
278 void WidevineCdmComponentInstallerTraits::ComponentReady( 278 void WidevineCdmComponentInstallerTraits::ComponentReady(
279 const base::Version& version, 279 const base::Version& version,
280 const base::FilePath& path, 280 const base::FilePath& path,
281 scoped_ptr<base::DictionaryValue> manifest) { 281 scoped_ptr<base::DictionaryValue> manifest) {
282 if (!IsCompatibleWithChrome(*manifest)) { 282 if (!IsCompatibleWithChrome(*manifest)) {
283 DLOG(WARNING) << "Installed Widevine CDM component is incompatible."; 283 VLOG(1) << "Installed Widevine CDM component is incompatible.";
284 return; 284 return;
285 } 285 }
286 286
287 BrowserThread::PostBlockingPoolTask( 287 BrowserThread::PostBlockingPoolTask(
288 FROM_HERE, 288 FROM_HERE,
289 base::Bind(&WidevineCdmComponentInstallerTraits::UpdateCdmAdapter, 289 base::Bind(&WidevineCdmComponentInstallerTraits::UpdateCdmAdapter,
290 base::Unretained(this), 290 base::Unretained(this),
291 version, 291 version,
292 path, 292 path,
293 base::Passed(&manifest))); 293 base::Passed(&manifest)));
294 } 294 }
295 295
296 bool WidevineCdmComponentInstallerTraits::VerifyInstallation( 296 bool WidevineCdmComponentInstallerTraits::VerifyInstallation(
297 const base::DictionaryValue& manifest, 297 const base::DictionaryValue& manifest,
298 const base::FilePath& install_dir) const { 298 const base::FilePath& install_dir) const {
299 return IsCompatibleWithChrome(manifest) && 299 return IsCompatibleWithChrome(manifest) &&
300 base::PathExists(GetPlatformDirectory(install_dir) 300 base::PathExists(GetPlatformDirectory(install_dir)
301 .AppendASCII(kWidevineCdmFileName)); 301 .AppendASCII(kWidevineCdmFileName));
xhwang 2016/03/24 00:22:54 Do we want to log if this returns false?
Sorin Jianu 2016/03/24 00:41:24 We do. It is logged by the implementation of the d
xhwang 2016/03/24 00:52:04 Got it. Thanks!
302 } 302 }
303 303
304 // The base directory on Windows looks like: 304 // The base directory on Windows looks like:
305 // <profile>\AppData\Local\Google\Chrome\User Data\WidevineCdm\. 305 // <profile>\AppData\Local\Google\Chrome\User Data\WidevineCdm\.
306 base::FilePath WidevineCdmComponentInstallerTraits::GetBaseDirectory() const { 306 base::FilePath WidevineCdmComponentInstallerTraits::GetBaseDirectory() const {
307 base::FilePath result; 307 base::FilePath result;
308 PathService::Get(chrome::DIR_COMPONENT_WIDEVINE_CDM, &result); 308 PathService::Get(chrome::DIR_COMPONENT_WIDEVINE_CDM, &result);
309 return result; 309 return result;
310 } 310 }
311 311
312 void WidevineCdmComponentInstallerTraits::GetHash( 312 void WidevineCdmComponentInstallerTraits::GetHash(
313 std::vector<uint8_t>* hash) const { 313 std::vector<uint8_t>* hash) const {
314 hash->assign(kSha2Hash, kSha2Hash + arraysize(kSha2Hash)); 314 hash->assign(kSha2Hash, kSha2Hash + arraysize(kSha2Hash));
315 } 315 }
316 316
317 std::string WidevineCdmComponentInstallerTraits::GetName() const { 317 std::string WidevineCdmComponentInstallerTraits::GetName() const {
318 return kWidevineCdmDisplayName; 318 return kWidevineCdmDisplayName;
319 } 319 }
320 320
321 void WidevineCdmComponentInstallerTraits::UpdateCdmAdapter( 321 void WidevineCdmComponentInstallerTraits::UpdateCdmAdapter(
322 const base::Version& cdm_version, 322 const base::Version& cdm_version,
323 const base::FilePath& cdm_install_dir, 323 const base::FilePath& cdm_install_dir,
324 scoped_ptr<base::DictionaryValue> manifest) { 324 scoped_ptr<base::DictionaryValue> manifest) {
325 const base::FilePath adapter_version_path = 325 const base::FilePath adapter_version_path =
326 GetPlatformDirectory(cdm_install_dir).AppendASCII(kCdmAdapterVersionName); 326 GetPlatformDirectory(cdm_install_dir).AppendASCII(kCdmAdapterVersionName);
327 const base::FilePath adapter_install_path = 327 const base::FilePath adapter_install_path =
328 GetPlatformDirectory(cdm_install_dir) 328 GetPlatformDirectory(cdm_install_dir)
329 .AppendASCII(kWidevineCdmAdapterFileName); 329 .AppendASCII(kWidevineCdmAdapterFileName);
330 330
331 VLOG(1) << "UpdateCdmAdapter: version" << cdm_version.GetString()
332 << " adapter_install_path=" << adapter_install_path.AsUTF8Unsafe()
333 << " adapter_version_path=" << adapter_version_path.AsUTF8Unsafe();
334
331 const std::string chrome_version = version_info::GetVersionNumber(); 335 const std::string chrome_version = version_info::GetVersionNumber();
332 DCHECK(!chrome_version.empty()); 336 DCHECK(!chrome_version.empty());
333 std::string adapter_version; 337 std::string adapter_version;
334 if (!base::ReadFileToString(adapter_version_path, &adapter_version) || 338 if (!base::ReadFileToString(adapter_version_path, &adapter_version) ||
335 adapter_version != chrome_version || 339 adapter_version != chrome_version ||
336 !base::PathExists(adapter_install_path)) { 340 !base::PathExists(adapter_install_path)) {
337 int bytes_written = base::WriteFile( 341 int bytes_written = base::WriteFile(
338 adapter_version_path, chrome_version.data(), chrome_version.size()); 342 adapter_version_path, chrome_version.data(), chrome_version.size());
339 if (bytes_written < 0 || 343 if (bytes_written < 0 ||
340 static_cast<size_t>(bytes_written) != chrome_version.size()) { 344 static_cast<size_t>(bytes_written) != chrome_version.size()) {
341 DLOG(WARNING) << "Failed to write Widevine CDM adapter version file."; 345 PLOG(WARNING) << "Failed to write Widevine CDM adapter version file.";
342 // Ignore version file writing failure and try to copy the CDM adapter. 346 // Ignore version file writing failure and try to copy the CDM adapter.
343 } 347 }
344 348
345 base::FilePath adapter_source_path; 349 base::FilePath adapter_source_path;
346 PathService::Get(chrome::FILE_WIDEVINE_CDM_ADAPTER, &adapter_source_path); 350 PathService::Get(chrome::FILE_WIDEVINE_CDM_ADAPTER, &adapter_source_path);
347 if (!base::CopyFile(adapter_source_path, adapter_install_path)) { 351 if (!base::CopyFile(adapter_source_path, adapter_install_path)) {
348 DLOG(WARNING) << "Failed to copy Widevine CDM adapter."; 352 PLOG(WARNING) << "Failed to copy Widevine CDM adapter.";
349 return; 353 return;
350 } 354 }
351 } 355 }
352 356
353 BrowserThread::PostTask(content::BrowserThread::UI, 357 BrowserThread::PostTask(content::BrowserThread::UI,
354 FROM_HERE, 358 FROM_HERE,
355 base::Bind(&RegisterWidevineCdmWithChrome, 359 base::Bind(&RegisterWidevineCdmWithChrome,
356 cdm_version, 360 cdm_version,
357 adapter_install_path, 361 adapter_install_path,
358 base::Passed(&manifest))); 362 base::Passed(&manifest)));
(...skipping 10 matching lines...) Expand all
369 scoped_ptr<ComponentInstallerTraits> traits( 373 scoped_ptr<ComponentInstallerTraits> traits(
370 new WidevineCdmComponentInstallerTraits); 374 new WidevineCdmComponentInstallerTraits);
371 // |cus| will take ownership of |installer| during installer->Register(cus). 375 // |cus| will take ownership of |installer| during installer->Register(cus).
372 DefaultComponentInstaller* installer = 376 DefaultComponentInstaller* installer =
373 new DefaultComponentInstaller(std::move(traits)); 377 new DefaultComponentInstaller(std::move(traits));
374 installer->Register(cus, base::Closure()); 378 installer->Register(cus, base::Closure());
375 #endif // defined(WIDEVINE_CDM_AVAILABLE) && defined(WIDEVINE_CDM_IS_COMPONENT) 379 #endif // defined(WIDEVINE_CDM_AVAILABLE) && defined(WIDEVINE_CDM_IS_COMPONENT)
376 } 380 }
377 381
378 } // namespace component_updater 382 } // namespace component_updater
OLDNEW
« no previous file with comments | « no previous file | components/component_updater/default_component_installer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698