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

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

Issue 5430004: Refactored cookies persistent store clean-up on shutdown. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Style fixes. Created 10 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
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 003c302928d30b5142650cdfaa3420310291f0df..6e8c7c0de564bfcc6ecfd5434e3f6011a60ad48e 100644
--- a/chrome/browser/net/sqlite_persistent_cookie_store.cc
+++ b/chrome/browser/net/sqlite_persistent_cookie_store.cc
@@ -251,7 +251,8 @@ void SQLitePersistentCookieStore::Backend::InternalBackgroundClose() {
}
SQLitePersistentCookieStore::SQLitePersistentCookieStore(const FilePath& path)
- : path_(path) {
+ : path_(path),
+ clear_local_state_on_exit_(false) {
}
SQLitePersistentCookieStore::~SQLitePersistentCookieStore() {
@@ -261,6 +262,15 @@ SQLitePersistentCookieStore::~SQLitePersistentCookieStore() {
// background thread has not run Close() yet.
backend_ = NULL;
}
+ if (clear_local_state_on_exit_) {
+ // To avoid concurrent run with possibly not finished file close op on the
+ // DB thread we delete the file on the same thread as well.
+ BrowserThread::PostTask(
+ BrowserThread::DB,
+ FROM_HERE,
+ NewRunnableFunction<bool(*)(const FilePath&, bool), FilePath, bool>(
+ &file_util::Delete, path_, false));
Randy Smith (Not in Mondays) 2010/12/02 21:19:26 I'm willing to accept this interface, but I think
pastarmovj 2010/12/03 16:43:02 Obsoleted because of the moved logic to Backend.
+ }
}
// Version number of the database. In version 4, we migrated the time epoch.
@@ -439,9 +449,3 @@ void SQLitePersistentCookieStore::DeleteCookie(
if (backend_.get())
backend_->DeleteCookie(cc);
}
-
-// static
-void SQLitePersistentCookieStore::ClearLocalState(
- const FilePath& path) {
- file_util::Delete(path, false);
-}

Powered by Google App Engine
This is Rietveld 408576698