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

Unified Diff: webkit/database/database_tracker.h

Issue 7234014: Move code to clear web databases on shutdown to the database tracker (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: updates Created 9 years, 5 months 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
« no previous file with comments | « webkit/database/database_quota_client_unittest.cc ('k') | webkit/database/database_tracker.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/database/database_tracker.h
diff --git a/webkit/database/database_tracker.h b/webkit/database/database_tracker.h
index bbc308adfc33be0487f6c32931e201272da9816c..6c6abe04bfbabcbbb48bd18024f32ec7aaa48ec2 100644
--- a/webkit/database/database_tracker.h
+++ b/webkit/database/database_tracker.h
@@ -88,7 +88,9 @@ class DatabaseTracker
virtual ~Observer() {}
};
- DatabaseTracker(const FilePath& profile_path, bool is_incognito,
+ DatabaseTracker(const FilePath& profile_path,
+ bool is_incognito,
+ bool clear_local_state_on_exit,
quota::SpecialStoragePolicy* special_storage_policy,
quota::QuotaManagerProxy* quota_manager_proxy,
base::MessageLoopProxy* db_tracker_thread);
@@ -158,10 +160,10 @@ class DatabaseTracker
bool CloseIncognitoFileHandle(const string16& vfs_file_path);
bool HasSavedIncognitoFileHandle(const string16& vfs_file_path) const;
- // Deletes the directory that stores all DBs in incognito mode, if it exists.
- void DeleteIncognitoDBDirectory();
-
- static void ClearLocalState(const FilePath& profile_path);
+ // Shutdown the database tracker, deleting database files if the tracker is
+ // used for an incognito profile or |clear_local_state_on_exit_| is true.
+ void Shutdown();
+ void SetClearLocalStateOnExit(bool clear_local_state_on_exit);
private:
friend class base::RefCountedThreadSafe<DatabaseTracker>;
@@ -193,9 +195,21 @@ class DatabaseTracker
// virtual for unittesting only
virtual ~DatabaseTracker();
+ // Deletes the directory that stores all DBs in incognito mode, if it exists.
+ void DeleteIncognitoDBDirectory();
+
+ // Deletes databases not protected by the special storage policy if
+ // |clear_local_state_on_exit_| is true and blocks databases from being
+ // created/opened.
+ void ClearLocalState();
+
bool DeleteClosedDatabase(const string16& origin_identifier,
const string16& database_name);
- bool DeleteOrigin(const string16& origin_identifier);
+
+ // Delete all files belonging to the given origin given that no database
+ // connections within this origin are open, or if |force| is true, delete
+ // the meta data and rename the associated directory.
+ bool DeleteOrigin(const string16& origin_identifier, bool force);
void DeleteDatabaseIfNeeded(const string16& origin_identifier,
const string16& database_name);
@@ -228,6 +242,7 @@ class DatabaseTracker
bool is_initialized_;
const bool is_incognito_;
+ bool clear_local_state_on_exit_;
bool shutting_down_;
const FilePath profile_path_;
const FilePath db_dir_;
@@ -247,6 +262,9 @@ class DatabaseTracker
scoped_refptr<quota::QuotaManagerProxy> quota_manager_proxy_;
+ // The database tracker thread we're supposed to run file IO on.
+ scoped_refptr<base::MessageLoopProxy> db_tracker_thread_;
+
// When in incognito mode, store a DELETE_ON_CLOSE handle to each
// main DB and journal file that was accessed. When the incognito profile
// goes away (or when the browser crashes), all these handles will be
« no previous file with comments | « webkit/database/database_quota_client_unittest.cc ('k') | webkit/database/database_tracker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698