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

Unified Diff: content/browser/indexed_db/idbbindingutilities_browsertest.cc

Issue 9235052: Fix race condition in utility process clients (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: added warning comment 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: content/browser/indexed_db/idbbindingutilities_browsertest.cc
diff --git a/content/browser/indexed_db/idbbindingutilities_browsertest.cc b/content/browser/indexed_db/idbbindingutilities_browsertest.cc
index 0793e0bd94a184864441d9534a09b8f235674d7b..3bcc69d64f7448659fd1ac09deda10f182467781 100644
--- a/content/browser/indexed_db/idbbindingutilities_browsertest.cc
+++ b/content/browser/indexed_db/idbbindingutilities_browsertest.cc
@@ -86,7 +86,6 @@ class IDBKeyPathHelper : public UtilityProcessHost::Client {
public:
IDBKeyPathHelper()
: expected_id_(0),
- utility_process_host_(NULL),
value_for_key_path_failed_(false) {
}
@@ -99,7 +98,7 @@ class IDBKeyPathHelper : public UtilityProcessHost::Client {
}
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
utility_process_host_ =
- new UtilityProcessHost(this, BrowserThread::IO);
+ (new UtilityProcessHost(this, BrowserThread::IO))->AsWeakPtr();
utility_process_host_->set_use_linux_zygote(true);
utility_process_host_->StartBatchMode();
BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
@@ -115,7 +114,7 @@ class IDBKeyPathHelper : public UtilityProcessHost::Client {
}
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
utility_process_host_->EndBatchMode();
- utility_process_host_ = NULL;
+ utility_process_host_.reset();
BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
MessageLoop::QuitClosure());
}
@@ -217,7 +216,7 @@ class IDBKeyPathHelper : public UtilityProcessHost::Client {
private:
int expected_id_;
std::vector<IndexedDBKey> expected_keys_;
- UtilityProcessHost* utility_process_host_;
+ base::WeakPtr<UtilityProcessHost> utility_process_host_;
bool value_for_key_path_failed_;
content::SerializedScriptValue expected_value_;
};

Powered by Google App Engine
This is Rietveld 408576698