diff options
author | jennb@chromium.org <jennb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-16 17:11:05 +0000 |
---|---|---|
committer | jennb@chromium.org <jennb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-16 17:11:05 +0000 |
commit | 43fdd14f0a15825532820cd6b12c233f2fd7be5a (patch) | |
tree | 29672c6892763c08989853392345758e03a84cf7 /webkit/appcache/appcache.h | |
parent | 46739a21804b7ee71eb8368609e2c3592334bc79 (diff) | |
download | chromium_src-43fdd14f0a15825532820cd6b12c233f2fd7be5a.zip chromium_src-43fdd14f0a15825532820cd6b12c233f2fd7be5a.tar.gz chromium_src-43fdd14f0a15825532820cd6b12c233f2fd7be5a.tar.bz2 |
Implement cancelling an appcache update. An update is cancelled when its application cache group is no longer in use. Refcounting of caches and groups changed to make cancelling an update work.
TEST=updated existing tests, verify deleting group cancels update, verify new refcounting behavior
BUG=none
Review URL: http://codereview.chromium.org/274013
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@29291 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/appcache/appcache.h')
-rw-r--r-- | webkit/appcache/appcache.h | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/webkit/appcache/appcache.h b/webkit/appcache/appcache.h index c80cafd..203b582 100644 --- a/webkit/appcache/appcache.h +++ b/webkit/appcache/appcache.h @@ -29,6 +29,7 @@ class AppCacheService; class AppCache : public base::RefCounted<AppCache> { public: typedef std::map<GURL, AppCacheEntry> EntryMap; + typedef std::set<AppCacheHost*> AppCacheHosts; AppCache(AppCacheService *service, int64 cache_id); ~AppCache(); @@ -36,7 +37,6 @@ class AppCache : public base::RefCounted<AppCache> { int64 cache_id() const { return cache_id_; } AppCacheGroup* owning_group() const { return owning_group_; } - void set_owning_group(AppCacheGroup* group) { owning_group_ = group; } bool is_complete() const { return is_complete_; } void set_complete(bool value) { is_complete_ = value; } @@ -55,9 +55,7 @@ class AppCache : public base::RefCounted<AppCache> { const EntryMap& entries() const { return entries_; } - const std::set<AppCacheHost*>& associated_hosts() const { - return associated_hosts_; - } + AppCacheHosts& associated_hosts() { return associated_hosts_; } bool IsNewerThan(AppCache* cache) const { if (update_time_ > cache->update_time_) @@ -79,9 +77,13 @@ class AppCache : public base::RefCounted<AppCache> { void InitializeWithManifest(Manifest* manifest); private: + friend class AppCacheGroup; friend class AppCacheHost; friend class AppCacheUpdateJobTest; + // Use AppCacheGroup::Add/RemoveCache() to manipulate owning group. + void set_owning_group(AppCacheGroup* group) { owning_group_ = group; } + // Use AppCacheHost::AssociateCache() to manipulate host association. void AssociateHost(AppCacheHost* host) { associated_hosts_.insert(host); @@ -89,8 +91,8 @@ class AppCache : public base::RefCounted<AppCache> { void UnassociateHost(AppCacheHost* host); const int64 cache_id_; - AppCacheGroup* owning_group_; - std::set<AppCacheHost*> associated_hosts_; + scoped_refptr<AppCacheGroup> owning_group_; + AppCacheHosts associated_hosts_; EntryMap entries_; // contains entries of all types |