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

Side by Side 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: Created 9 years, 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef WEBKIT_DATABASE_DATABASE_TRACKER_H_ 5 #ifndef WEBKIT_DATABASE_DATABASE_TRACKER_H_
6 #define WEBKIT_DATABASE_DATABASE_TRACKER_H_ 6 #define WEBKIT_DATABASE_DATABASE_TRACKER_H_
7 7
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 10
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 public: 81 public:
82 virtual void OnDatabaseSizeChanged(const string16& origin_identifier, 82 virtual void OnDatabaseSizeChanged(const string16& origin_identifier,
83 const string16& database_name, 83 const string16& database_name,
84 int64 database_size) = 0; 84 int64 database_size) = 0;
85 virtual void OnDatabaseScheduledForDeletion( 85 virtual void OnDatabaseScheduledForDeletion(
86 const string16& origin_identifier, 86 const string16& origin_identifier,
87 const string16& database_name) = 0; 87 const string16& database_name) = 0;
88 virtual ~Observer() {} 88 virtual ~Observer() {}
89 }; 89 };
90 90
91 DatabaseTracker(const FilePath& profile_path, bool is_incognito, 91 DatabaseTracker(const FilePath& profile_path,
92 bool is_incognito,
93 bool clear_local_state_on_exit,
92 quota::SpecialStoragePolicy* special_storage_policy, 94 quota::SpecialStoragePolicy* special_storage_policy,
93 quota::QuotaManagerProxy* quota_manager_proxy, 95 quota::QuotaManagerProxy* quota_manager_proxy,
94 base::MessageLoopProxy* db_tracker_thread); 96 base::MessageLoopProxy* db_tracker_thread);
95 97
96 void DatabaseOpened(const string16& origin_identifier, 98 void DatabaseOpened(const string16& origin_identifier,
97 const string16& database_name, 99 const string16& database_name,
98 const string16& database_details, 100 const string16& database_details,
99 int64 estimated_size, 101 int64 estimated_size,
100 int64* database_size); 102 int64* database_size);
101 void DatabaseModified(const string16& origin_identifier, 103 void DatabaseModified(const string16& origin_identifier,
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 void GetIncognitoFileHandle(const string16& vfs_file_path, 156 void GetIncognitoFileHandle(const string16& vfs_file_path,
155 base::PlatformFile* file_handle) const; 157 base::PlatformFile* file_handle) const;
156 void SaveIncognitoFileHandle(const string16& vfs_file_path, 158 void SaveIncognitoFileHandle(const string16& vfs_file_path,
157 const base::PlatformFile& file_handle); 159 const base::PlatformFile& file_handle);
158 bool CloseIncognitoFileHandle(const string16& vfs_file_path); 160 bool CloseIncognitoFileHandle(const string16& vfs_file_path);
159 bool HasSavedIncognitoFileHandle(const string16& vfs_file_path) const; 161 bool HasSavedIncognitoFileHandle(const string16& vfs_file_path) const;
160 162
161 // Deletes the directory that stores all DBs in incognito mode, if it exists. 163 // Deletes the directory that stores all DBs in incognito mode, if it exists.
162 void DeleteIncognitoDBDirectory(); 164 void DeleteIncognitoDBDirectory();
163 165
164 static void ClearLocalState(const FilePath& profile_path); 166 void SetClearLocalStateOnExit(bool clear_local_state_on_exit);
165 167
166 private: 168 private:
167 friend class base::RefCountedThreadSafe<DatabaseTracker>; 169 friend class base::RefCountedThreadSafe<DatabaseTracker>;
168 friend class MockDatabaseTracker; // for testing 170 friend class MockDatabaseTracker; // for testing
169 171
170 typedef std::map<string16, std::set<string16> > DatabaseSet; 172 typedef std::map<string16, std::set<string16> > DatabaseSet;
171 typedef std::map<net::CompletionCallback*, DatabaseSet> PendingCompletionMap; 173 typedef std::map<net::CompletionCallback*, DatabaseSet> PendingCompletionMap;
172 typedef std::map<string16, base::PlatformFile> FileHandlesMap; 174 typedef std::map<string16, base::PlatformFile> FileHandlesMap;
173 typedef std::map<string16, string16> OriginDirectoriesMap; 175 typedef std::map<string16, string16> OriginDirectoriesMap;
174 176
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 // Schedule a set of open databases for deletion. If non-null, callback is 223 // Schedule a set of open databases for deletion. If non-null, callback is
222 // invoked upon completion. 224 // invoked upon completion.
223 void ScheduleDatabasesForDeletion(const DatabaseSet& databases, 225 void ScheduleDatabasesForDeletion(const DatabaseSet& databases,
224 net::CompletionCallback* callback); 226 net::CompletionCallback* callback);
225 227
226 // Returns the directory where all DB files for the given origin are stored. 228 // Returns the directory where all DB files for the given origin are stored.
227 string16 GetOriginDirectory(const string16& origin_identifier); 229 string16 GetOriginDirectory(const string16& origin_identifier);
228 230
229 bool is_initialized_; 231 bool is_initialized_;
230 const bool is_incognito_; 232 const bool is_incognito_;
233 bool clear_local_state_on_exit_;
231 bool shutting_down_; 234 bool shutting_down_;
232 const FilePath profile_path_; 235 const FilePath profile_path_;
233 const FilePath db_dir_; 236 const FilePath db_dir_;
234 scoped_ptr<sql::Connection> db_; 237 scoped_ptr<sql::Connection> db_;
235 scoped_ptr<DatabasesTable> databases_table_; 238 scoped_ptr<DatabasesTable> databases_table_;
236 scoped_ptr<sql::MetaTable> meta_table_; 239 scoped_ptr<sql::MetaTable> meta_table_;
237 ObserverList<Observer, true> observers_; 240 ObserverList<Observer, true> observers_;
238 std::map<string16, CachedOriginInfo> origins_info_map_; 241 std::map<string16, CachedOriginInfo> origins_info_map_;
239 DatabaseConnections database_connections_; 242 DatabaseConnections database_connections_;
240 243
(...skipping 19 matching lines...) Expand all
260 // this map to assign directory names that do not reveal this information. 263 // this map to assign directory names that do not reveal this information.
261 OriginDirectoriesMap incognito_origin_directories_; 264 OriginDirectoriesMap incognito_origin_directories_;
262 int incognito_origin_directories_generator_; 265 int incognito_origin_directories_generator_;
263 266
264 FRIEND_TEST_ALL_PREFIXES(DatabaseTracker, TestHelper); 267 FRIEND_TEST_ALL_PREFIXES(DatabaseTracker, TestHelper);
265 }; 268 };
266 269
267 } // namespace webkit_database 270 } // namespace webkit_database
268 271
269 #endif // WEBKIT_DATABASE_DATABASE_TRACKER_H_ 272 #endif // WEBKIT_DATABASE_DATABASE_TRACKER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698