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

Unified Diff: webkit/appcache/appcache_database.cc

Issue 7031065: AppCache + Quota integration (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 7 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
Index: webkit/appcache/appcache_database.cc
===================================================================
--- webkit/appcache/appcache_database.cc (revision 87543)
+++ webkit/appcache/appcache_database.cc (working copy)
@@ -182,6 +182,15 @@
ResetConnectionAndTables();
}
+// TODO(michaeln): remove me
+int64 AppCacheDatabase::GetOriginQuota(const GURL& origin) {
+ if (!LazyOpen(false))
+ return GetDefaultOriginQuota();
+ int64 quota = quota_table_->GetOriginQuota(
+ UTF8ToUTF16(origin.spec().c_str()));
+ return (quota >= 0) ? quota : GetDefaultOriginQuota();
+}
+
int64 AppCacheDatabase::GetOriginUsage(const GURL& origin) {
std::vector<CacheRecord> records;
if (!FindCachesForOrigin(origin, &records))
@@ -196,12 +205,15 @@
return origin_usage;
}
-int64 AppCacheDatabase::GetOriginQuota(const GURL& origin) {
- if (!LazyOpen(false))
- return GetDefaultOriginQuota();
- int64 quota = quota_table_->GetOriginQuota(
- UTF8ToUTF16(origin.spec().c_str()));
- return (quota >= 0) ? quota : GetDefaultOriginQuota();
+bool AppCacheDatabase::GetAllOriginUsage(std::map<GURL, int64>* usage_map) {
+ std::set<GURL> origins;
+ if (!FindOriginsWithGroups(&origins))
+ return false;
+ for (std::set<GURL>::const_iterator origin = origins.begin();
+ origin != origins.end(); ++origin) {
+ (*usage_map)[*origin] = GetOriginUsage(*origin);
+ }
+ return true;
}
bool AppCacheDatabase::FindOriginsWithGroups(std::set<GURL>* origins) {

Powered by Google App Engine
This is Rietveld 408576698