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

Unified Diff: net/extras/sqlite/sqlite_persistent_cookie_store.cc

Issue 1231493002: mandoline filesystem: Save cookie data to the mojo:filesystem. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nits + observers Created 5 years, 5 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: net/extras/sqlite/sqlite_persistent_cookie_store.cc
diff --git a/net/extras/sqlite/sqlite_persistent_cookie_store.cc b/net/extras/sqlite/sqlite_persistent_cookie_store.cc
index 0af0b2aba406852d8667b818e4f624fa9d54c6dc..e97f27956f08ac17c4d0a100879e0de2d558ed3f 100644
--- a/net/extras/sqlite/sqlite_persistent_cookie_store.cc
+++ b/net/extras/sqlite/sqlite_persistent_cookie_store.cc
@@ -129,7 +129,7 @@ class SQLitePersistentCookieStore::Backend
// Commit any pending operations and close the database. This must be called
// before the object is destructed.
- void Close();
+ void Close(const base::Closure& callback);
// Post background delete of all cookies that match |cookies|.
void DeleteAllInList(const std::list<CookieOrigin>& cookies);
@@ -222,7 +222,7 @@ class SQLitePersistentCookieStore::Backend
// Commit our pending operations to the database.
void Commit();
// Close() executed on the background runner.
- void InternalBackgroundClose();
+ void InternalBackgroundClose(const base::Closure& callback);
void DeleteSessionCookiesOnStartup();
@@ -1178,17 +1178,19 @@ void SQLitePersistentCookieStore::Backend::Flush(
// Fire off a close message to the background runner. We could still have a
// 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() {
+void SQLitePersistentCookieStore::Backend::Close(
+ const base::Closure& callback) {
if (background_task_runner_->RunsTasksOnCurrentThread()) {
- InternalBackgroundClose();
+ InternalBackgroundClose(callback);
} else {
// Must close the backend on the background runner.
- PostBackgroundTask(FROM_HERE,
- base::Bind(&Backend::InternalBackgroundClose, this));
+ PostBackgroundTask(FROM_HERE, base::Bind(&Backend::InternalBackgroundClose,
+ this, callback));
}
}
-void SQLitePersistentCookieStore::Backend::InternalBackgroundClose() {
+void SQLitePersistentCookieStore::Backend::InternalBackgroundClose(
+ const base::Closure& callback) {
DCHECK(background_task_runner_->RunsTasksOnCurrentThread());
if (delete_session_cookies_at_shutdown_)
@@ -1199,6 +1201,10 @@ void SQLitePersistentCookieStore::Backend::InternalBackgroundClose() {
meta_table_.Reset();
db_.reset();
+
+ // We're clean now.
+ if (!callback.is_null())
+ callback.Run();
}
void SQLitePersistentCookieStore::Backend::DatabaseErrorCallback(
@@ -1364,6 +1370,10 @@ void SQLitePersistentCookieStore::DeleteAllInList(
backend_->DeleteAllInList(cookies);
}
+void SQLitePersistentCookieStore::Close(const base::Closure& callback) {
+ backend_->Close(callback);
+}
+
void SQLitePersistentCookieStore::Load(const LoadedCallback& loaded_callback) {
backend_->Load(loaded_callback);
}
@@ -1396,7 +1406,7 @@ void SQLitePersistentCookieStore::Flush(const base::Closure& callback) {
}
SQLitePersistentCookieStore::~SQLitePersistentCookieStore() {
- backend_->Close();
+ backend_->Close(base::Closure());
// We release our reference to the Backend, though it will probably still have
// a reference if the background runner has not run Close() yet.
}

Powered by Google App Engine
This is Rietveld 408576698