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

Unified Diff: webkit/appcache/appcache_storage.cc

Issue 7031065: AppCache + Quota integration (Closed) Base URL: svn://chrome-svn/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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webkit/appcache/appcache_storage.h ('k') | webkit/appcache/appcache_storage_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/appcache/appcache_storage.cc
===================================================================
--- webkit/appcache/appcache_storage.cc (revision 88615)
+++ webkit/appcache/appcache_storage.cc (working copy)
@@ -6,6 +6,9 @@
#include "base/stl_util-inl.h"
#include "webkit/appcache/appcache_response.h"
+#include "webkit/appcache/appcache_service.h"
+#include "webkit/quota/quota_client.h"
+#include "webkit/quota/quota_manager.h"
namespace appcache {
@@ -87,5 +90,42 @@
info_load->StartIfNeeded();
}
+void AppCacheStorage::UpdateUsageMapAndNotify(
+ const GURL& origin, int64 new_usage) {
+ DCHECK_GE(new_usage, 0);
+ int64 old_usage = usage_map_[origin];
+ if (new_usage > 0)
+ usage_map_[origin] = new_usage;
+ else
+ usage_map_.erase(origin);
+ if (new_usage != old_usage && service()->quota_manager_proxy()) {
+ service()->quota_manager_proxy()->NotifyStorageModified(
+ quota::QuotaClient::kAppcache,
+ origin, quota::kStorageTypeTemporary,
+ new_usage - old_usage);
+ }
+}
+
+void AppCacheStorage::ClearUsageMapAndNotify() {
+ if (service()->quota_manager_proxy()) {
+ for (UsageMap::const_iterator iter = usage_map_.begin();
+ iter != usage_map_.end(); ++iter) {
+ service()->quota_manager_proxy()->NotifyStorageModified(
+ quota::QuotaClient::kAppcache,
+ iter->first, quota::kStorageTypeTemporary,
+ -(iter->second));
+ }
+ }
+ usage_map_.clear();
+}
+
+void AppCacheStorage::NotifyStorageAccessed(const GURL& origin) {
+ if (service()->quota_manager_proxy() &&
+ usage_map_.find(origin) != usage_map_.end())
+ service()->quota_manager_proxy()->NotifyStorageAccessed(
+ quota::QuotaClient::kAppcache,
+ origin, quota::kStorageTypeTemporary);
+}
+
} // namespace appcache
« no previous file with comments | « webkit/appcache/appcache_storage.h ('k') | webkit/appcache/appcache_storage_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698