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

Unified Diff: components/component_updater/default_component_installer.cc

Issue 2022273002: Add logging in DefaultComponentInstaller to help investigate a bug (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/component_updater/default_component_installer.cc
diff --git a/components/component_updater/default_component_installer.cc b/components/component_updater/default_component_installer.cc
index 61a0d783b7f942ed4cf773804a30173d1339588a..094b34b3f8f91da131acb9cc43c54f18d3710751 100644
--- a/components/component_updater/default_component_installer.cc
+++ b/components/component_updater/default_component_installer.cc
@@ -152,23 +152,51 @@ bool DefaultComponentInstaller::Uninstall() {
return true;
}
+// TODO(xhwang): The following LOG(WARNING) messages are added to help
+// investigate http://crbug.com/614745. Remove redundant checks or convent them
+// to VLOG(1) after investigation is completed.
bool DefaultComponentInstaller::FindPreinstallation() {
base::FilePath path;
- if (!PathService::Get(DIR_COMPONENT_PREINSTALLED, &path))
+ if (!PathService::Get(DIR_COMPONENT_PREINSTALLED, &path)) {
+ LOG(WARNING) << "DIR_COMPONENT_PREINSTALLED does not exist.";
return false;
+ }
+
path = path.Append(installer_traits_->GetRelativeInstallDir());
- if (!base::PathExists(path))
+ if (!base::PathExists(path)) {
+ LOG(WARNING) << "Relative install dir does not exist: "
+ << path.MaybeAsASCII();
return false;
+ }
+
std::unique_ptr<base::DictionaryValue> manifest =
update_client::ReadManifest(path);
- if (!manifest || !installer_traits_->VerifyInstallation(*manifest, path))
+ if (!manifest) {
+ LOG(WARNING) << "Manifest does not exist: " << path.MaybeAsASCII();
return false;
+ }
+
+ if (!installer_traits_->VerifyInstallation(*manifest, path)) {
+ LOG(WARNING) << "Installation verification failed: " << path.MaybeAsASCII();
+ return false;
+ }
+
std::string version_lexical;
- if (!manifest->GetStringASCII("version", &version_lexical))
+ if (!manifest->GetStringASCII("version", &version_lexical)) {
+ LOG(WARNING) << "Failed to get component version from the manifest.";
return false;
+ }
+
const base::Version version(version_lexical);
- if (!version.IsValid())
+ if (!version.IsValid()) {
+ LOG(WARNING) << "Version in the manifest is invalid:" << version_lexical;
return false;
+ }
+
+ LOG(WARNING) << "Preinstalled component found for "
+ << installer_traits_->GetName() << " at " << path.MaybeAsASCII()
+ << " with version " << version << ".";
+
current_install_dir_ = path;
current_manifest_ = std::move(manifest);
current_version_ = version;
@@ -176,6 +204,7 @@ bool DefaultComponentInstaller::FindPreinstallation() {
}
void DefaultComponentInstaller::StartRegistration(ComponentUpdateService* cus) {
+ LOG(WARNING) << __FUNCTION__ << " for " << installer_traits_->GetName();
DCHECK(task_runner_.get());
DCHECK(task_runner_->RunsTasksOnCurrentThread());
@@ -291,7 +320,9 @@ void DefaultComponentInstaller::UninstallOnTaskRunner() {
void DefaultComponentInstaller::FinishRegistration(
ComponentUpdateService* cus,
const base::Closure& callback) {
+ LOG(WARNING) << __FUNCTION__ << " for " << installer_traits_->GetName();
DCHECK(thread_checker_.CalledOnValidThread());
+
if (installer_traits_->CanAutoUpdate()) {
CrxComponent crx;
crx.name = installer_traits_->GetName();
@@ -302,7 +333,7 @@ void DefaultComponentInstaller::FinishRegistration(
crx.fingerprint = current_fingerprint_;
installer_traits_->GetHash(&crx.pk_hash);
if (!cus->RegisterComponent(crx)) {
- NOTREACHED() << "Component registration failed for "
+ LOG(WARNING) << "Component registration failed for "
<< installer_traits_->GetName();
return;
}
@@ -311,8 +342,10 @@ void DefaultComponentInstaller::FinishRegistration(
callback.Run();
}
- if (!current_manifest_)
+ if (!current_manifest_) {
+ LOG(WARNING) << "No component found for " << installer_traits_->GetName();
return;
+ }
std::unique_ptr<base::DictionaryValue> manifest_copy(
current_manifest_->DeepCopy());
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698