| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef WEBKIT_APPCACHE_APPCACHE_ENTRY_H_ | 5 #ifndef WEBKIT_APPCACHE_APPCACHE_ENTRY_H_ |
| 6 #define WEBKIT_APPCACHE_APPCACHE_ENTRY_H_ | 6 #define WEBKIT_APPCACHE_APPCACHE_ENTRY_H_ |
| 7 | 7 |
| 8 #include "webkit/appcache/appcache_interfaces.h" |
| 9 |
| 8 namespace appcache { | 10 namespace appcache { |
| 9 | 11 |
| 10 // A cached entry is identified by a URL and is classified into one | 12 // A cached entry is identified by a URL and is classified into one |
| 11 // (or more) categories. URL is not stored here as this class is stored | 13 // (or more) categories. URL is not stored here as this class is stored |
| 12 // with the URL as a map key or the user of this class already knows the URL. | 14 // with the URL as a map key or the user of this class already knows the URL. |
| 13 class AppCacheEntry { | 15 class AppCacheEntry { |
| 14 public: | 16 public: |
| 15 | 17 |
| 16 // An entry can be of more than one type so use a bitmask. | 18 // An entry can be of more than one type so use a bitmask. |
| 17 enum Type { | 19 enum Type { |
| 18 MASTER = 1 << 0, | 20 MASTER = 1 << 0, |
| 19 MANIFEST = 1 << 1, | 21 MANIFEST = 1 << 1, |
| 20 EXPLICIT = 1 << 2, | 22 EXPLICIT = 1 << 2, |
| 21 FOREIGN = 1 << 3, | 23 FOREIGN = 1 << 3, |
| 22 FALLBACK = 1 << 4, | 24 FALLBACK = 1 << 4, |
| 23 }; | 25 }; |
| 24 | 26 |
| 25 explicit AppCacheEntry(int type) : types_(type) {} | 27 AppCacheEntry() : types_(0), response_id_(kNoResponseId) {} |
| 28 |
| 29 explicit AppCacheEntry(int type) |
| 30 : types_(type), response_id_(kNoResponseId) {} |
| 31 |
| 32 AppCacheEntry(int type, int64 response_id) |
| 33 : types_(type), response_id_(response_id) {} |
| 26 | 34 |
| 27 int types() const { return types_; } | 35 int types() const { return types_; } |
| 28 void add_types(int added_types) { types_ |= added_types; } | 36 void add_types(int added_types) { types_ |= added_types; } |
| 29 bool IsMaster() const { return (types_ & MASTER) != 0; } | 37 bool IsMaster() const { return (types_ & MASTER) != 0; } |
| 30 bool IsManifest() const { return (types_ & MANIFEST) != 0; } | 38 bool IsManifest() const { return (types_ & MANIFEST) != 0; } |
| 31 bool IsExplicit() const { return (types_ & EXPLICIT) != 0; } | 39 bool IsExplicit() const { return (types_ & EXPLICIT) != 0; } |
| 32 bool IsForeign() const { return (types_ & FOREIGN) != 0; } | 40 bool IsForeign() const { return (types_ & FOREIGN) != 0; } |
| 33 bool IsFallback() const { return (types_ & FALLBACK) != 0; } | 41 bool IsFallback() const { return (types_ & FALLBACK) != 0; } |
| 34 | 42 |
| 43 int64 response_id() const { return response_id_; } |
| 44 void set_response_id(int64 id) { response_id_ = id; } |
| 45 |
| 35 private: | 46 private: |
| 36 int types_; | 47 int types_; |
| 37 | 48 int64 response_id_; |
| 38 // TODO(jennb): response storage key | |
| 39 }; | 49 }; |
| 40 | 50 |
| 41 } // namespace appcache | 51 } // namespace appcache |
| 42 | 52 |
| 43 #endif // WEBKIT_APPCACHE_APPCACHE_RESOURCE_H_ | 53 #endif // WEBKIT_APPCACHE_APPCACHE_RESOURCE_H_ |
| OLD | NEW |