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

Unified Diff: chrome/browser/net/sqlite_persistent_cookie_store.cc

Issue 8855009: Abort in-flight load tasks if the DB has been closed. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years 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/net/sqlite_persistent_cookie_store.cc
diff --git a/chrome/browser/net/sqlite_persistent_cookie_store.cc b/chrome/browser/net/sqlite_persistent_cookie_store.cc
index 58f44cae81ae7ced0bea3a8dc2cdacccc4805650..ff77049b95a7188ad0260fab4a7e58c79addb593 100644
--- a/chrome/browser/net/sqlite_persistent_cookie_store.cc
+++ b/chrome/browser/net/sqlite_persistent_cookie_store.cc
@@ -432,7 +432,9 @@ bool SQLitePersistentCookieStore::Backend::InitializeDatabase() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB));
if (initialized_) {
- return true;
+ // Return false if we were previously initialized but the DB has since been
+ // closed.
+ return db_.get() ? true : false;
}
const FilePath dir = path_.DirName();
@@ -492,7 +494,10 @@ void SQLitePersistentCookieStore::Backend::ChainLoadCookies(
bool load_success = true;
- if (keys_to_load_.size() > 0) {
+ if (!db_.get()) {
+ // Close() has been called on this store.
+ load_success = false;
+ } else if (keys_to_load_.size() > 0) {
// Load cookies for the first domain key.
std::map<std::string, std::set<std::string> >::iterator
it = keys_to_load_.begin();
@@ -822,7 +827,7 @@ void SQLitePersistentCookieStore::Backend::Flush(Task* completion_task) {
}
// Fire off a close message to the background thread. We could still have a
-// pending commit timer that will be holding a reference on us, but if/when
+// pending commit timer or Load operations holding references on us, but if/when
// this fires we will already have been cleaned up and it will be ignored.
void SQLitePersistentCookieStore::Backend::Close() {
if (BrowserThread::CurrentlyOn(BrowserThread::DB)) {
« 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