diff options
author | michaeln@google.com <michaeln@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-24 21:42:25 +0000 |
---|---|---|
committer | michaeln@google.com <michaeln@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-24 21:42:25 +0000 |
commit | 550890ec7f1cf968abc4544b170e97a67f919902 (patch) | |
tree | 632dec32bed5266837a2668a9225d303303e3160 /webkit/appcache/appcache_entry.h | |
parent | ed249ab7916d438b0bdb650a796aaf709f6ae1ae (diff) | |
download | chromium_src-550890ec7f1cf968abc4544b170e97a67f919902.zip chromium_src-550890ec7f1cf968abc4544b170e97a67f919902.tar.gz chromium_src-550890ec7f1cf968abc4544b170e97a67f919902.tar.bz2 |
MockAppCacheStorage implemention
This is a quick and easy 'mock' implementation of the storage interface
that doesn't put anything to disk.
We simply add an extra reference to objects when they're put in storage,
and remove the extra reference when they are removed from storage.
Responses are never really removed from the in-memory disk cache.
Delegate callbacks are made asyncly to appropiately mimic what will
happen with a real disk-backed storage impl that involves IO on a
background thread.
This is for use in unit tests and to initially bring up the appcache
related layout tests.
TEST=mock_appcache_storage_unittest.cc
BUG=none
Review URL: http://codereview.chromium.org/300043
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@30017 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/appcache/appcache_entry.h')
-rw-r--r-- | webkit/appcache/appcache_entry.h | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/webkit/appcache/appcache_entry.h b/webkit/appcache/appcache_entry.h index 434568a..c57ab6b 100644 --- a/webkit/appcache/appcache_entry.h +++ b/webkit/appcache/appcache_entry.h @@ -5,6 +5,8 @@ #ifndef WEBKIT_APPCACHE_APPCACHE_ENTRY_H_ #define WEBKIT_APPCACHE_APPCACHE_ENTRY_H_ +#include "webkit/appcache/appcache_interfaces.h" + namespace appcache { // A cached entry is identified by a URL and is classified into one @@ -22,7 +24,13 @@ class AppCacheEntry { FALLBACK = 1 << 4, }; - explicit AppCacheEntry(int type) : types_(type) {} + AppCacheEntry() : types_(0), response_id_(kNoResponseId) {} + + explicit AppCacheEntry(int type) + : types_(type), response_id_(kNoResponseId) {} + + AppCacheEntry(int type, int64 response_id) + : types_(type), response_id_(response_id) {} int types() const { return types_; } void add_types(int added_types) { types_ |= added_types; } @@ -32,10 +40,12 @@ class AppCacheEntry { bool IsForeign() const { return (types_ & FOREIGN) != 0; } bool IsFallback() const { return (types_ & FALLBACK) != 0; } + int64 response_id() const { return response_id_; } + void set_response_id(int64 id) { response_id_ = id; } + private: int types_; - - // TODO(jennb): response storage key + int64 response_id_; }; } // namespace appcache |