| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 void RemoveObserver(Observer* observer); | 117 void RemoveObserver(Observer* observer); |
| 118 | 118 |
| 119 void CloseTrackerDatabaseAndClearCaches(); | 119 void CloseTrackerDatabaseAndClearCaches(); |
| 120 | 120 |
| 121 const FilePath& DatabaseDirectory() const { return db_dir_; } | 121 const FilePath& DatabaseDirectory() const { return db_dir_; } |
| 122 FilePath GetFullDBFilePath(const string16& origin_identifier, | 122 FilePath GetFullDBFilePath(const string16& origin_identifier, |
| 123 const string16& database_name) const; | 123 const string16& database_name) const; |
| 124 | 124 |
| 125 bool GetAllOriginsInfo(std::vector<OriginInfo>* origins_info); | 125 bool GetAllOriginsInfo(std::vector<OriginInfo>* origins_info); |
| 126 void SetOriginQuota(const string16& origin_identifier, int64 new_quota); | 126 void SetOriginQuota(const string16& origin_identifier, int64 new_quota); |
| 127 void SetOriginQuotaInMemory(const string16& origin_identifier, |
| 128 int64 new_quota); |
| 127 | 129 |
| 130 int64 GetDefaultQuota() { return default_quota_; } |
| 128 // Sets the default quota for all origins. Should be used in tests only. | 131 // Sets the default quota for all origins. Should be used in tests only. |
| 129 void SetDefaultQuota(int64 quota); | 132 void SetDefaultQuota(int64 quota); |
| 130 | 133 |
| 131 bool IsDatabaseScheduledForDeletion(const string16& origin_identifier, | 134 bool IsDatabaseScheduledForDeletion(const string16& origin_identifier, |
| 132 const string16& database_name); | 135 const string16& database_name); |
| 133 | 136 |
| 134 // Deletes a single database. Returns net::OK on success, net::FAILED on | 137 // Deletes a single database. Returns net::OK on success, net::FAILED on |
| 135 // failure, or net::ERR_IO_PENDING and |callback| is invoked upon completion, | 138 // failure, or net::ERR_IO_PENDING and |callback| is invoked upon completion, |
| 136 // if non-NULL. | 139 // if non-NULL. |
| 137 int DeleteDatabase(const string16& origin_identifier, | 140 int DeleteDatabase(const string16& origin_identifier, |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 std::map<string16, CachedOriginInfo> origins_info_map_; | 212 std::map<string16, CachedOriginInfo> origins_info_map_; |
| 210 DatabaseConnections database_connections_; | 213 DatabaseConnections database_connections_; |
| 211 | 214 |
| 212 // The set of databases that should be deleted but are still opened | 215 // The set of databases that should be deleted but are still opened |
| 213 DatabaseSet dbs_to_be_deleted_; | 216 DatabaseSet dbs_to_be_deleted_; |
| 214 PendingCompletionMap deletion_callbacks_; | 217 PendingCompletionMap deletion_callbacks_; |
| 215 | 218 |
| 216 // Default quota for all origins; changed only by tests | 219 // Default quota for all origins; changed only by tests |
| 217 int64 default_quota_; | 220 int64 default_quota_; |
| 218 | 221 |
| 222 // Store quotas for extensions in memory, in order to prevent writing a row |
| 223 // to quota_table_ every time an extention is loaded. |
| 224 std::map<string16, int64> in_memory_quotas_; |
| 225 |
| 219 FRIEND_TEST(DatabaseTrackerTest, TestIt); | 226 FRIEND_TEST(DatabaseTrackerTest, TestIt); |
| 220 }; | 227 }; |
| 221 | 228 |
| 222 } // namespace webkit_database | 229 } // namespace webkit_database |
| 223 | 230 |
| 224 #endif // WEBKIT_DATABASE_DATABASE_TRACKER_H_ | 231 #endif // WEBKIT_DATABASE_DATABASE_TRACKER_H_ |
| OLD | NEW |