summaryrefslogtreecommitdiffstats
path: root/webkit/appcache/appcache_database.h
diff options
context:
space:
mode:
authormichaeln@chromium.org <michaeln@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-21 02:39:40 +0000
committermichaeln@chromium.org <michaeln@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-21 02:39:40 +0000
commit9b7a0c551268395816959eb8df1c44086583824e (patch)
tree2be7bdf092e8776b0161b0eff83c0122626dc5bf /webkit/appcache/appcache_database.h
parent6f526b9ac1ec6fb252d3cfe1f625a694d76f643f (diff)
downloadchromium_src-9b7a0c551268395816959eb8df1c44086583824e.zip
chromium_src-9b7a0c551268395816959eb8df1c44086583824e.tar.gz
chromium_src-9b7a0c551268395816959eb8df1c44086583824e.tar.bz2
Enforce a hard coded 5MB per origin quota for appcache storage.
TEST=yes BUG=none Review URL: http://codereview.chromium.org/554008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@36723 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/appcache/appcache_database.h')
-rw-r--r--webkit/appcache/appcache_database.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/webkit/appcache/appcache_database.h b/webkit/appcache/appcache_database.h
index 89fc330..97ed9e2 100644
--- a/webkit/appcache/appcache_database.h
+++ b/webkit/appcache/appcache_database.h
@@ -22,6 +22,10 @@ class Statement;
class StatementID;
}
+namespace webkit_database {
+class QuotaTable;
+}
+
namespace appcache {
class AppCacheDatabase {
@@ -73,6 +77,10 @@ class AppCacheDatabase {
void Disable();
bool is_disabled() const { return is_disabled_; }
+ int64 GetDefaultOriginQuota() { return 5 * 1024 * 1024; }
+ int64 GetOriginUsage(const GURL& origin);
+ int64 GetOriginQuota(const GURL& origin);
+
bool FindOriginsWithGroups(std::set<GURL>* origins);
bool FindLastStorageIds(
int64* last_group_id, int64* last_cache_id, int64* last_response_id,
@@ -88,6 +96,8 @@ class AppCacheDatabase {
bool FindCache(int64 cache_id, CacheRecord* record);
bool FindCacheForGroup(int64 group_id, CacheRecord* record);
+ bool FindCachesForOrigin(
+ const GURL& origin, std::vector<CacheRecord>* records);
bool InsertCache(const CacheRecord* record);
bool DeleteCache(int64 cache_id);
@@ -167,6 +177,8 @@ class AppCacheDatabase {
bool CreateSchema();
bool UpgradeSchema();
+ void ResetConnectionAndTables();
+
// Deletes the existing database file and the entire directory containing
// the database file including the disk cache in which response headers
// and bodies are stored, and then creates a new database file.
@@ -175,6 +187,7 @@ class AppCacheDatabase {
FilePath db_file_path_;
scoped_ptr<sql::Connection> db_;
scoped_ptr<sql::MetaTable> meta_table_;
+ scoped_ptr<webkit_database::QuotaTable> quota_table_;
bool is_disabled_;
bool is_recreating_;
@@ -186,6 +199,7 @@ class AppCacheDatabase {
FRIEND_TEST(AppCacheDatabaseTest, OnlineWhiteListRecords);
FRIEND_TEST(AppCacheDatabaseTest, ReCreate);
FRIEND_TEST(AppCacheDatabaseTest, DeletableResponseIds);
+ FRIEND_TEST(AppCacheDatabaseTest, Quotas);
DISALLOW_COPY_AND_ASSIGN(AppCacheDatabase);
};