summaryrefslogtreecommitdiffstats
path: root/webkit/appcache/appcache_storage_impl.cc
diff options
context:
space:
mode:
authormichaeln@chromium.org <michaeln@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-04 20:01:37 +0000
committermichaeln@chromium.org <michaeln@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-04 20:01:37 +0000
commitbae3069e31b61b1555f65272ec8973b2f4c56df5 (patch)
tree6edca4e598e62e1bbc87fc0a96ba99293d103686 /webkit/appcache/appcache_storage_impl.cc
parent5fd7738372b76c4a1951e6b842e6387cd09d2521 (diff)
downloadchromium_src-bae3069e31b61b1555f65272ec8973b2f4c56df5.zip
chromium_src-bae3069e31b61b1555f65272ec8973b2f4c56df5.tar.gz
chromium_src-bae3069e31b61b1555f65272ec8973b2f4c56df5.tar.bz2
AppCache: Provide a way to override the default quota for an origin. The intent is to use this to support the 'unlimited_storage' privilege of Chrome Applications.
BUG=49993 TEST=AppCacheStorageImplTest.FailStoreGroup Review URL: http://codereview.chromium.org/3083014 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@54949 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/appcache/appcache_storage_impl.cc')
-rw-r--r--webkit/appcache/appcache_storage_impl.cc12
1 files changed, 9 insertions, 3 deletions
diff --git a/webkit/appcache/appcache_storage_impl.cc b/webkit/appcache/appcache_storage_impl.cc
index c715863..2231234 100644
--- a/webkit/appcache/appcache_storage_impl.cc
+++ b/webkit/appcache/appcache_storage_impl.cc
@@ -402,13 +402,16 @@ class AppCacheStorageImpl::StoreGroupAndCacheTask : public StoreOrLoadTask {
scoped_refptr<AppCache> cache_;
bool success_;
bool would_exceed_quota_;
+ int64 quota_override_;
std::vector<int64> newly_deletable_response_ids_;
};
AppCacheStorageImpl::StoreGroupAndCacheTask::StoreGroupAndCacheTask(
AppCacheStorageImpl* storage, AppCacheGroup* group, AppCache* newest_cache)
: StoreOrLoadTask(storage), group_(group), cache_(newest_cache),
- success_(false), would_exceed_quota_(false) {
+ success_(false), would_exceed_quota_(false),
+ quota_override_(
+ storage->GetOriginQuotaInMemory(group->manifest_url().GetOrigin())) {
group_record_.group_id = group->group_id();
group_record_.manifest_url = group->manifest_url();
group_record_.origin = group_record_.manifest_url.GetOrigin();
@@ -485,8 +488,11 @@ void AppCacheStorageImpl::StoreGroupAndCacheTask::Run() {
if (!success_)
return;
- if (database_->GetOriginUsage(group_record_.origin) >
- database_->GetOriginQuota(group_record_.origin)) {
+ int64 quota = (quota_override_ >= 0) ?
+ quota_override_ :
+ database_->GetOriginQuota(group_record_.origin);
+
+ if (database_->GetOriginUsage(group_record_.origin) > quota) {
would_exceed_quota_ = true;
success_ = false;
return;