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

Unified Diff: chrome/browser/autocomplete/network_action_predictor_database.cc

Issue 8566018: Cope with a race condition in NetworkActionPredictor and NetworkActionPredictorDB initialization. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Adding newline for consistency. Created 9 years, 1 month 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 | « chrome/browser/autocomplete/autocomplete_browsertest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/autocomplete/network_action_predictor_database.cc
diff --git a/chrome/browser/autocomplete/network_action_predictor_database.cc b/chrome/browser/autocomplete/network_action_predictor_database.cc
index 09b34fb9fa206b6e90b2160256bdddbdd15acf64..4362e57560c13a94ee6e99ced7e5aea5618f4ccf 100644
--- a/chrome/browser/autocomplete/network_action_predictor_database.cc
+++ b/chrome/browser/autocomplete/network_action_predictor_database.cc
@@ -89,7 +89,10 @@ NetworkActionPredictorDatabase::~NetworkActionPredictorDatabase() {
void NetworkActionPredictorDatabase::Initialize() {
CHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::DB));
- CHECK(!canceled_.IsSet());
+
+ if (canceled_.IsSet())
+ return;
+
db_.set_exclusive_locking();
if (!db_.Open(db_path_)) {
canceled_.Set();
« no previous file with comments | « chrome/browser/autocomplete/autocomplete_browsertest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698