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

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

Issue 9235052: Fix race condition in utility process clients (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync to ToT Created 8 years, 11 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
Index: chrome/browser/extensions/webstore_install_helper.cc
diff --git a/chrome/browser/extensions/webstore_install_helper.cc b/chrome/browser/extensions/webstore_install_helper.cc
index e9199ed117cd07e29257857460e9ec811bf1aec8..2148937b2e02104d35f851deffadc11809a8f086 100644
--- a/chrome/browser/extensions/webstore_install_helper.cc
+++ b/chrome/browser/extensions/webstore_install_helper.cc
@@ -35,7 +35,6 @@ WebstoreInstallHelper::WebstoreInstallHelper(
icon_base64_data_(icon_data),
icon_url_(icon_url),
context_getter_(context_getter),
- utility_host_(NULL),
icon_decode_complete_(false),
manifest_parse_complete_(false),
parse_error_(Delegate::UNKNOWN_ERROR) {}
@@ -67,7 +66,8 @@ void WebstoreInstallHelper::Start() {
void WebstoreInstallHelper::StartWorkOnIOThread() {
CHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
- utility_host_ = new UtilityProcessHost(this, BrowserThread::IO);
+ utility_host_ =
+ (new UtilityProcessHost(this, BrowserThread::IO))->AsWeakPtr();
utility_host_->set_use_linux_zygote(true);
utility_host_->StartBatchMode();
@@ -172,8 +172,10 @@ void WebstoreInstallHelper::ReportResultsIfComplete() {
return;
// The utility_host_ will take care of deleting itself after this call.
- utility_host_->EndBatchMode();
- utility_host_ = NULL;
+ if (utility_host_) {
+ utility_host_->EndBatchMode();
+ utility_host_.reset();
+ }
BrowserThread::PostTask(
BrowserThread::UI,
« no previous file with comments | « chrome/browser/extensions/webstore_install_helper.h ('k') | chrome/browser/importer/external_process_importer_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698