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

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: Added unit test and moved flag to the persistence store itself. 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..20701df9e815fae911caf13612f4ec9db69d58bf 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) {
jochen (gone - plz use gerrit) 2010/12/02 15:09:51 i'd push this even further down to the backend. in
pastarmovj 2010/12/02 16:29:07 The backend doesn't know the file name now and I d
}
SQLitePersistentCookieStore::~SQLitePersistentCookieStore() {
@@ -261,6 +262,14 @@ 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(
+ &file_util::Delete, path_, false));
+ }
}
// Version number of the database. In version 4, we migrated the time epoch.
@@ -439,9 +448,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