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); |
-} |