diff options
author | jennb@chromium.org <jennb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-06 17:19:37 +0000 |
---|---|---|
committer | jennb@chromium.org <jennb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-06 17:19:37 +0000 |
commit | ae3c0b266d4a3f7f2f121589e24e76528d44f4f7 (patch) | |
tree | 85af04a19120db4a75b1ad07ca2a6e1473f1767e /webkit/appcache/appcache.h | |
parent | ff9cfce7ec2ae06df4ac413cfde3bfd7ae503677 (diff) | |
download | chromium_src-ae3c0b266d4a3f7f2f121589e24e76528d44f4f7.zip chromium_src-ae3c0b266d4a3f7f2f121589e24e76528d44f4f7.tar.gz chromium_src-ae3c0b266d4a3f7f2f121589e24e76528d44f4f7.tar.bz2 |
Implementation of application cache update algorithm.
Does not include storage nor processing of pending master entries.
TEST=verify update functionality
BUG=none
Review URL: http://codereview.chromium.org/201070
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@28123 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/appcache/appcache.h')
-rw-r--r-- | webkit/appcache/appcache.h | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/webkit/appcache/appcache.h b/webkit/appcache/appcache.h index fcfa9d1..08fdd1b 100644 --- a/webkit/appcache/appcache.h +++ b/webkit/appcache/appcache.h @@ -13,6 +13,7 @@ #include "base/ref_counted.h" #include "base/time.h" #include "googleurl/src/gurl.h" +#include "testing/gtest/include/gtest/gtest_prod.h" #include "webkit/appcache/appcache_entry.h" #include "webkit/appcache/manifest_parser.h" @@ -27,6 +28,8 @@ class AppCacheService; // cache is being created during an appcache upate. class AppCache : public base::RefCounted<AppCache> { public: + typedef std::map<GURL, AppCacheEntry> EntryMap; + AppCache(AppCacheService *service, int64 cache_id); ~AppCache(); @@ -50,19 +53,27 @@ class AppCache : public base::RefCounted<AppCache> { // Do not store the returned object as it could be deleted anytime. AppCacheEntry* GetEntry(const GURL& url); - typedef std::map<GURL, AppCacheEntry> EntryMap; const EntryMap& entries() const { return entries_; } + const std::set<AppCacheHost*>& associated_hosts() const { + return associated_hosts_; + } + bool IsNewerThan(AppCache* cache) const { return update_time_ > cache->update_time_; } - void set_update_time(base::TimeTicks ticks = base::TimeTicks::Now()) { + void set_update_time(base::TimeTicks ticks) { update_time_ = ticks; } + // Initializes the cache with information in the manifest. + // Do not use the manifest after this call. + void InitializeWithManifest(Manifest* manifest); + private: friend class AppCacheHost; + friend class AppCacheUpdateJobTest; // Use AppCacheHost::AssociateCache() to manipulate host association. void AssociateHost(AppCacheHost* host) { @@ -71,7 +82,6 @@ class AppCache : public base::RefCounted<AppCache> { void UnassociateHost(AppCacheHost* host); const int64 cache_id_; - AppCacheEntry* manifest_; // also in entry map AppCacheGroup* owning_group_; std::set<AppCacheHost*> associated_hosts_; @@ -88,6 +98,9 @@ class AppCache : public base::RefCounted<AppCache> { // to notify service when cache is deleted AppCacheService* service_; + + FRIEND_TEST(AppCacheTest, InitializeWithManifest); + DISALLOW_COPY_AND_ASSIGN(AppCache); }; } // namespace appcache |