Chromium Code Reviews| 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); |
| -} |