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

Unified Diff: chrome/browser/extensions/webstore_standalone_installer.cc

Issue 298133007: Fixed leaks of WebstoreStandaloneInstallers in some code paths (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@install_base
Patch Set: Self nits Created 6 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: chrome/browser/extensions/webstore_standalone_installer.cc
diff --git a/chrome/browser/extensions/webstore_standalone_installer.cc b/chrome/browser/extensions/webstore_standalone_installer.cc
index 91662ea6750c4fd732d894f2b803da64b3c321f8..c8adc3b200226b343a31ccc71eb88c12fb1958f6 100644
--- a/chrome/browser/extensions/webstore_standalone_installer.cc
+++ b/chrome/browser/extensions/webstore_standalone_installer.cc
@@ -212,9 +212,6 @@ void WebstoreStandaloneInstaller::OnWebstoreParseSuccess(
ShowInstallUI();
// Control flow finishes up in InstallUIProceed or InstallUIAbort.
} else {
- // Balanced in InstallUIAbort or indirectly in InstallUIProceed via
- // OnExtensionInstallSuccess or OnExtensionInstallFailure.
- AddRef();
InstallUIProceed();
}
}
@@ -272,14 +269,12 @@ void WebstoreStandaloneInstaller::InstallUIProceed() {
void WebstoreStandaloneInstaller::InstallUIAbort(bool user_initiated) {
CompleteInstall(kUserCancelledError);
- Release(); // Balanced in ShowInstallUI.
}
void WebstoreStandaloneInstaller::OnExtensionInstallSuccess(
const std::string& id) {
CHECK_EQ(id_, id);
CompleteInstall(std::string());
- Release(); // Balanced in ShowInstallUI.
}
void WebstoreStandaloneInstaller::OnExtensionInstallFailure(
@@ -288,16 +283,16 @@ void WebstoreStandaloneInstaller::OnExtensionInstallFailure(
WebstoreInstaller::FailureReason cancelled) {
CHECK_EQ(id_, id);
CompleteInstall(error);
- Release(); // Balanced in ShowInstallUI.
}
void WebstoreStandaloneInstaller::AbortInstall() {
callback_.Reset();
+
// Abort any in-progress fetches.
- if (webstore_data_fetcher_) {
+ if (webstore_data_fetcher_)
webstore_data_fetcher_.reset();
- Release(); // Matches the AddRef in BeginInstall.
- }
+
+ Release(); // Matches the AddRef in BeginInstall.
}
void WebstoreStandaloneInstaller::InvokeCallback(const std::string& error) {
@@ -310,8 +305,7 @@ void WebstoreStandaloneInstaller::CompleteInstall(const std::string& error) {
Release(); // Matches the AddRef in BeginInstall.
}
-void
-WebstoreStandaloneInstaller::ShowInstallUI() {
+void WebstoreStandaloneInstaller::ShowInstallUI() {
std::string error;
localized_extension_for_display_ =
ExtensionInstallPrompt::GetLocalizedExtensionForDisplay(
@@ -326,11 +320,6 @@ WebstoreStandaloneInstaller::ShowInstallUI() {
return;
}
- // Keep this alive as long as the install prompt lives.
- // Balanced in InstallUIAbort or indirectly in InstallUIProceed via
- // OnExtensionInstallSuccess or OnExtensionInstallFailure.
- AddRef();
-
install_ui_ = CreateInstallUI();
install_ui_->ConfirmStandaloneInstall(
this, localized_extension_for_display_.get(), &icon_, *install_prompt_);
« 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