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 88b7bb9bc8026b7d4fa938ca72fe20b5c694789d..cbdb36fc2f42d0adefa21968212e787bc87ca14c 100644 |
--- a/chrome/browser/net/sqlite_persistent_cookie_store.cc |
+++ b/chrome/browser/net/sqlite_persistent_cookie_store.cc |
@@ -31,7 +31,8 @@ class SQLitePersistentCookieStore::Backend |
explicit Backend(const FilePath& path) |
: path_(path), |
db_(NULL), |
- num_pending_(0) { |
+ num_pending_(0), |
+ clear_local_state_on_exit_(false) { |
} |
// Creates or load the SQLite database. |
@@ -50,6 +51,10 @@ class SQLitePersistentCookieStore::Backend |
// before the object is destructed. |
void Close(); |
+ void SetClearLocalStateOnExit(bool clear_local_state) { |
+ clear_local_state_on_exit_ = clear_local_state; |
+ } |
+ |
private: |
friend class base::RefCountedThreadSafe<SQLitePersistentCookieStore::Backend>; |
@@ -99,6 +104,8 @@ class SQLitePersistentCookieStore::Backend |
PendingOperationsList pending_; |
PendingOperationsList::size_type num_pending_; |
Lock pending_lock_; // Guard pending_ and num_pending_ |
+ // True if the persistent store should be deleted upon destruction. |
+ bool clear_local_state_on_exit_; |
DISALLOW_COPY_AND_ASSIGN(Backend); |
}; |
@@ -420,6 +427,9 @@ void SQLitePersistentCookieStore::Backend::InternalBackgroundClose() { |
Commit(); |
db_.reset(); |
+ |
+ if (clear_local_state_on_exit_) |
+ file_util::Delete(path_, false); |
} |
SQLitePersistentCookieStore::SQLitePersistentCookieStore(const FilePath& path) |
@@ -458,8 +468,8 @@ void SQLitePersistentCookieStore::DeleteCookie( |
backend_->DeleteCookie(cc); |
} |
-// static |
-void SQLitePersistentCookieStore::ClearLocalState( |
- const FilePath& path) { |
- file_util::Delete(path, false); |
+void SQLitePersistentCookieStore::SetClearLocalStateOnExit( |
+ bool clear_local_state) { |
+ if (backend_.get()) |
+ backend_->SetClearLocalStateOnExit(clear_local_state); |
Randy Smith (Not in Mondays)
2010/12/03 18:42:27
Could you protect this with the lock (and modify t
pastarmovj
2010/12/06 08:57:40
Done. I had exactly the same thoughts and didn't p
|
} |