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

Unified Diff: webkit/quota/usage_tracker.h

Issue 7606011: Track usage per-origin at the lowest level instead of per-host. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 4 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/quota/quota_manager.cc ('k') | webkit/quota/usage_tracker.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/quota/usage_tracker.h
===================================================================
--- webkit/quota/usage_tracker.h (revision 96443)
+++ webkit/quota/usage_tracker.h (working copy)
@@ -87,34 +87,44 @@
void GetGlobalUsage(GlobalUsageCallback* callback);
void GetHostUsage(const std::string& host, HostUsageCallback* callback);
- void DetermineOriginsToGetUsage(const std::set<GURL>& origins,
- std::set<GURL>* origins_to_process);
void UpdateUsageCache(const GURL& origin, int64 delta);
+ void GetCachedOrigins(std::set<GURL>* origins) const;
- const std::set<GURL>& cached_origins() const { return cached_origins_; }
+ private:
+ typedef std::set<std::string> HostSet;
+ typedef std::map<GURL, int64> UsageMap;
+ typedef std::map<std::string, UsageMap> HostUsageMap;
- private:
class GatherUsageTaskBase;
class GatherGlobalUsageTask;
class GatherHostUsageTask;
- void DidGetGlobalUsage(const std::map<GURL, int64>& origin_usage_map);
- void DidGetHostUsage(const std::string& host,
- const std::map<GURL, int64>& origin_usage_map);
+ // Methods used by our GatherUsage tasks, as a task makes progress
+ // origins and hosts are added incrementally to the cache.
+ void AddCachedOrigin(const GURL& origin, int64 usage);
+ void AddCachedHost(const std::string& host);
+ void GatherGlobalUsageComplete();
+ void GatherHostUsageComplete(const std::string& host);
+
+ int64 GetCachedHostUsage(const std::string& host);
+
+ void NoopHostUsageCallback(
+ const std::string& host, StorageType type, int64 usage);
+
bool IsStorageUnlimited(const GURL& origin) const;
UsageTracker* tracker_;
QuotaClient* client_;
const StorageType type_;
- std::set<GURL> cached_origins_;
int64 global_usage_;
int64 global_unlimited_usage_;
bool global_usage_retrieved_;
+ HostSet cached_hosts_;
+ HostUsageMap cached_usage_;
+
GatherGlobalUsageTask* global_usage_task_;
GlobalUsageCallbackQueue global_usage_callback_;
-
- std::map<std::string, int64> host_usage_map_;
std::map<std::string, GatherHostUsageTask*> host_usage_tasks_;
HostUsageCallbackMap host_usage_callbacks_;
« no previous file with comments | « webkit/quota/quota_manager.cc ('k') | webkit/quota/usage_tracker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698