| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CONTENT_BROWSER_APPCACHE_APPCACHE_STORAGE_H_ | 5 #ifndef CONTENT_BROWSER_APPCACHE_APPCACHE_STORAGE_H_ |
| 6 #define CONTENT_BROWSER_APPCACHE_APPCACHE_STORAGE_H_ | 6 #define CONTENT_BROWSER_APPCACHE_APPCACHE_STORAGE_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | |
| 12 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 13 #include "base/gtest_prod_util.h" | 12 #include "base/gtest_prod_util.h" |
| 13 #include "base/macros.h" |
| 14 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
| 15 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
| 16 #include "content/browser/appcache/appcache_working_set.h" | 16 #include "content/browser/appcache/appcache_working_set.h" |
| 17 #include "content/common/content_export.h" | 17 #include "content/common/content_export.h" |
| 18 #include "net/base/completion_callback.h" | 18 #include "net/base/completion_callback.h" |
| 19 | 19 |
| 20 class GURL; | 20 class GURL; |
| 21 | 21 |
| 22 namespace content { | 22 namespace content { |
| 23 FORWARD_DECLARE_TEST(AppCacheStorageTest, DelegateReferences); | 23 FORWARD_DECLARE_TEST(AppCacheStorageTest, DelegateReferences); |
| 24 FORWARD_DECLARE_TEST(AppCacheStorageTest, UsageMap); | 24 FORWARD_DECLARE_TEST(AppCacheStorageTest, UsageMap); |
| 25 class AppCache; | 25 class AppCache; |
| 26 class AppCacheEntry; | 26 class AppCacheEntry; |
| 27 class AppCacheGroup; | 27 class AppCacheGroup; |
| 28 class AppCacheQuotaClientTest; | 28 class AppCacheQuotaClientTest; |
| 29 class AppCacheResponseMetadataWriter; | 29 class AppCacheResponseMetadataWriter; |
| 30 class AppCacheResponseReader; | 30 class AppCacheResponseReader; |
| 31 class AppCacheResponseTest; | 31 class AppCacheResponseTest; |
| 32 class AppCacheResponseWriter; | 32 class AppCacheResponseWriter; |
| 33 class AppCacheServiceImpl; | 33 class AppCacheServiceImpl; |
| 34 class AppCacheStorageTest; | 34 class AppCacheStorageTest; |
| 35 struct AppCacheInfoCollection; | 35 struct AppCacheInfoCollection; |
| 36 struct HttpResponseInfoIOBuffer; | 36 struct HttpResponseInfoIOBuffer; |
| 37 | 37 |
| 38 class CONTENT_EXPORT AppCacheStorage { | 38 class CONTENT_EXPORT AppCacheStorage { |
| 39 public: | 39 public: |
| 40 typedef std::map<GURL, int64> UsageMap; | 40 typedef std::map<GURL, int64_t> UsageMap; |
| 41 | 41 |
| 42 class CONTENT_EXPORT Delegate { | 42 class CONTENT_EXPORT Delegate { |
| 43 public: | 43 public: |
| 44 // If retrieval fails, 'collection' will be NULL. | 44 // If retrieval fails, 'collection' will be NULL. |
| 45 virtual void OnAllInfo(AppCacheInfoCollection* collection) {} | 45 virtual void OnAllInfo(AppCacheInfoCollection* collection) {} |
| 46 | 46 |
| 47 // If a load fails the 'cache' will be NULL. | 47 // If a load fails the 'cache' will be NULL. |
| 48 virtual void OnCacheLoaded(AppCache* cache, int64 cache_id) {} | 48 virtual void OnCacheLoaded(AppCache* cache, int64_t cache_id) {} |
| 49 | 49 |
| 50 // If a load fails the 'group' will be NULL. | 50 // If a load fails the 'group' will be NULL. |
| 51 virtual void OnGroupLoaded( | 51 virtual void OnGroupLoaded( |
| 52 AppCacheGroup* group, const GURL& manifest_url) {} | 52 AppCacheGroup* group, const GURL& manifest_url) {} |
| 53 | 53 |
| 54 // If successfully stored 'success' will be true. | 54 // If successfully stored 'success' will be true. |
| 55 virtual void OnGroupAndNewestCacheStored( | 55 virtual void OnGroupAndNewestCacheStored( |
| 56 AppCacheGroup* group, AppCache* newest_cache, bool success, | 56 AppCacheGroup* group, AppCache* newest_cache, bool success, |
| 57 bool would_exceed_quota) {} | 57 bool would_exceed_quota) {} |
| 58 | 58 |
| 59 // If the operation fails, success will be false. | 59 // If the operation fails, success will be false. |
| 60 virtual void OnGroupMadeObsolete(AppCacheGroup* group, | 60 virtual void OnGroupMadeObsolete(AppCacheGroup* group, |
| 61 bool success, | 61 bool success, |
| 62 int response_code) {} | 62 int response_code) {} |
| 63 | 63 |
| 64 // If a load fails the 'response_info' will be NULL. | 64 // If a load fails the 'response_info' will be NULL. |
| 65 virtual void OnResponseInfoLoaded( | 65 virtual void OnResponseInfoLoaded(AppCacheResponseInfo* response_info, |
| 66 AppCacheResponseInfo* response_info, int64 response_id) {} | 66 int64_t response_id) {} |
| 67 | 67 |
| 68 // If no response is found, entry.response_id() and | 68 // If no response is found, entry.response_id() and |
| 69 // fallback_entry.response_id() will be kAppCacheNoResponseId. | 69 // fallback_entry.response_id() will be kAppCacheNoResponseId. |
| 70 // If the response is the entry for an intercept or fallback | 70 // If the response is the entry for an intercept or fallback |
| 71 // namespace, the url of the namespece entry is returned. | 71 // namespace, the url of the namespece entry is returned. |
| 72 // If a response is found, the cache id and manifest url of the | 72 // If a response is found, the cache id and manifest url of the |
| 73 // containing cache and group are also returned. | 73 // containing cache and group are also returned. |
| 74 virtual void OnMainResponseFound( | 74 virtual void OnMainResponseFound(const GURL& url, |
| 75 const GURL& url, const AppCacheEntry& entry, | 75 const AppCacheEntry& entry, |
| 76 const GURL& namespace_entry_url, const AppCacheEntry& fallback_entry, | 76 const GURL& namespace_entry_url, |
| 77 int64 cache_id, int64 group_id, const GURL& mainfest_url) {} | 77 const AppCacheEntry& fallback_entry, |
| 78 int64_t cache_id, |
| 79 int64_t group_id, |
| 80 const GURL& mainfest_url) {} |
| 78 | 81 |
| 79 protected: | 82 protected: |
| 80 virtual ~Delegate() {} | 83 virtual ~Delegate() {} |
| 81 }; | 84 }; |
| 82 | 85 |
| 83 explicit AppCacheStorage(AppCacheServiceImpl* service); | 86 explicit AppCacheStorage(AppCacheServiceImpl* service); |
| 84 virtual ~AppCacheStorage(); | 87 virtual ~AppCacheStorage(); |
| 85 | 88 |
| 86 // Schedules a task to retrieve basic info about all groups and caches | 89 // Schedules a task to retrieve basic info about all groups and caches |
| 87 // stored in the system. Upon completion the delegate will be called | 90 // stored in the system. Upon completion the delegate will be called |
| 88 // with the results. | 91 // with the results. |
| 89 virtual void GetAllInfo(Delegate* delegate) = 0; | 92 virtual void GetAllInfo(Delegate* delegate) = 0; |
| 90 | 93 |
| 91 // Schedules a cache to be loaded from storage. Upon load completion | 94 // Schedules a cache to be loaded from storage. Upon load completion |
| 92 // the delegate will be called back. If the cache already resides in | 95 // the delegate will be called back. If the cache already resides in |
| 93 // memory, the delegate will be called back immediately without returning | 96 // memory, the delegate will be called back immediately without returning |
| 94 // to the message loop. If the load fails, the delegate will be called | 97 // to the message loop. If the load fails, the delegate will be called |
| 95 // back with a NULL cache pointer. | 98 // back with a NULL cache pointer. |
| 96 virtual void LoadCache(int64 id, Delegate* delegate) = 0; | 99 virtual void LoadCache(int64_t id, Delegate* delegate) = 0; |
| 97 | 100 |
| 98 // Schedules a group and its newest cache, if any, to be loaded from storage. | 101 // Schedules a group and its newest cache, if any, to be loaded from storage. |
| 99 // Upon load completion the delegate will be called back. If the group | 102 // Upon load completion the delegate will be called back. If the group |
| 100 // and newest cache already reside in memory, the delegate will be called | 103 // and newest cache already reside in memory, the delegate will be called |
| 101 // back immediately without returning to the message loop. If the load fails, | 104 // back immediately without returning to the message loop. If the load fails, |
| 102 // the delegate will be called back with a NULL group pointer. | 105 // the delegate will be called back with a NULL group pointer. |
| 103 virtual void LoadOrCreateGroup( | 106 virtual void LoadOrCreateGroup( |
| 104 const GURL& manifest_url, Delegate* delegate) = 0; | 107 const GURL& manifest_url, Delegate* delegate) = 0; |
| 105 | 108 |
| 106 // Schedules response info to be loaded from storage. | 109 // Schedules response info to be loaded from storage. |
| 107 // Upon load completion the delegate will be called back. If the data | 110 // Upon load completion the delegate will be called back. If the data |
| 108 // already resides in memory, the delegate will be called back | 111 // already resides in memory, the delegate will be called back |
| 109 // immediately without returning to the message loop. If the load fails, | 112 // immediately without returning to the message loop. If the load fails, |
| 110 // the delegate will be called back with a NULL pointer. | 113 // the delegate will be called back with a NULL pointer. |
| 111 virtual void LoadResponseInfo( | 114 virtual void LoadResponseInfo(const GURL& manifest_url, |
| 112 const GURL& manifest_url, int64 group_id, int64 response_id, | 115 int64_t group_id, |
| 113 Delegate* delegate); | 116 int64_t response_id, |
| 117 Delegate* delegate); |
| 114 | 118 |
| 115 // Schedules a group and its newest complete cache to be initially stored or | 119 // Schedules a group and its newest complete cache to be initially stored or |
| 116 // incrementally updated with new changes. Upon completion the delegate | 120 // incrementally updated with new changes. Upon completion the delegate |
| 117 // will be called back. A group without a newest cache cannot be stored. | 121 // will be called back. A group without a newest cache cannot be stored. |
| 118 // It's a programming error to call this method without a newest cache. A | 122 // It's a programming error to call this method without a newest cache. A |
| 119 // side effect of storing a new newest cache is the removal of the group's | 123 // side effect of storing a new newest cache is the removal of the group's |
| 120 // old caches and responses from persistent storage (although they may still | 124 // old caches and responses from persistent storage (although they may still |
| 121 // linger in the in-memory working set until no longer needed). The new | 125 // linger in the in-memory working set until no longer needed). The new |
| 122 // cache will be added as the group's newest complete cache only if storage | 126 // cache will be added as the group's newest complete cache only if storage |
| 123 // succeeds. | 127 // succeeds. |
| (...skipping 11 matching lines...) Expand all Loading... |
| 135 // identify a response for a sub resource request. | 139 // identify a response for a sub resource request. |
| 136 virtual void FindResponseForSubRequest( | 140 virtual void FindResponseForSubRequest( |
| 137 AppCache* cache, const GURL& url, | 141 AppCache* cache, const GURL& url, |
| 138 AppCacheEntry* found_entry, AppCacheEntry* found_fallback_entry, | 142 AppCacheEntry* found_entry, AppCacheEntry* found_fallback_entry, |
| 139 bool* found_network_namespace) = 0; | 143 bool* found_network_namespace) = 0; |
| 140 | 144 |
| 141 // Immediately updates in-memory storage, if the cache is in memory, | 145 // Immediately updates in-memory storage, if the cache is in memory, |
| 142 // and schedules a task to update persistent storage. If the cache is | 146 // and schedules a task to update persistent storage. If the cache is |
| 143 // already scheduled to be loaded, upon loading completion the entry | 147 // already scheduled to be loaded, upon loading completion the entry |
| 144 // will be marked. There is no delegate completion callback. | 148 // will be marked. There is no delegate completion callback. |
| 145 virtual void MarkEntryAsForeign(const GURL& entry_url, int64 cache_id) = 0; | 149 virtual void MarkEntryAsForeign(const GURL& entry_url, int64_t cache_id) = 0; |
| 146 | 150 |
| 147 // Schedules a task to update persistent storage and doom the group and all | 151 // Schedules a task to update persistent storage and doom the group and all |
| 148 // related caches and responses for deletion. Upon completion the in-memory | 152 // related caches and responses for deletion. Upon completion the in-memory |
| 149 // instance is marked as obsolete and the delegate callback is called. | 153 // instance is marked as obsolete and the delegate callback is called. |
| 150 virtual void MakeGroupObsolete(AppCacheGroup* group, | 154 virtual void MakeGroupObsolete(AppCacheGroup* group, |
| 151 Delegate* delegate, | 155 Delegate* delegate, |
| 152 int response_code) = 0; | 156 int response_code) = 0; |
| 153 | 157 |
| 154 // Schedules a task to update persistent storage with the times of the first | 158 // Schedules a task to update persistent storage with the times of the first |
| 155 // evictable error and last successful full update check. | 159 // evictable error and last successful full update check. |
| 156 virtual void StoreEvictionTimes(AppCacheGroup* group) = 0; | 160 virtual void StoreEvictionTimes(AppCacheGroup* group) = 0; |
| 157 | 161 |
| 158 // Cancels all pending callbacks for the delegate. The delegate callbacks | 162 // Cancels all pending callbacks for the delegate. The delegate callbacks |
| 159 // will not be invoked after, however any scheduled operations will still | 163 // will not be invoked after, however any scheduled operations will still |
| 160 // take place. The callbacks for subsequently scheduled operations are | 164 // take place. The callbacks for subsequently scheduled operations are |
| 161 // unaffected. | 165 // unaffected. |
| 162 void CancelDelegateCallbacks(Delegate* delegate) { | 166 void CancelDelegateCallbacks(Delegate* delegate) { |
| 163 DelegateReference* delegate_reference = GetDelegateReference(delegate); | 167 DelegateReference* delegate_reference = GetDelegateReference(delegate); |
| 164 if (delegate_reference) | 168 if (delegate_reference) |
| 165 delegate_reference->CancelReference(); | 169 delegate_reference->CancelReference(); |
| 166 } | 170 } |
| 167 | 171 |
| 168 // Creates a reader to read a response from storage. | 172 // Creates a reader to read a response from storage. |
| 169 virtual AppCacheResponseReader* CreateResponseReader( | 173 virtual AppCacheResponseReader* CreateResponseReader(const GURL& manifest_url, |
| 170 const GURL& manifest_url, int64 group_id, int64 response_id) = 0; | 174 int64_t group_id, |
| 175 int64_t response_id) = 0; |
| 171 | 176 |
| 172 // Creates a writer to write a new response to storage. This call | 177 // Creates a writer to write a new response to storage. This call |
| 173 // establishes a new response id. | 178 // establishes a new response id. |
| 174 virtual AppCacheResponseWriter* CreateResponseWriter( | 179 virtual AppCacheResponseWriter* CreateResponseWriter(const GURL& manifest_url, |
| 175 const GURL& manifest_url, int64 group_id) = 0; | 180 int64_t group_id) = 0; |
| 176 | 181 |
| 177 // Creates a metadata writer to write metadata of response to storage. | 182 // Creates a metadata writer to write metadata of response to storage. |
| 178 virtual AppCacheResponseMetadataWriter* CreateResponseMetadataWriter( | 183 virtual AppCacheResponseMetadataWriter* CreateResponseMetadataWriter( |
| 179 int64 group_id, | 184 int64_t group_id, |
| 180 int64 response_id) = 0; | 185 int64_t response_id) = 0; |
| 181 | 186 |
| 182 // Schedules the lazy deletion of responses and saves the ids | 187 // Schedules the lazy deletion of responses and saves the ids |
| 183 // persistently such that the responses will be deleted upon restart | 188 // persistently such that the responses will be deleted upon restart |
| 184 // if they aren't deleted prior to shutdown. | 189 // if they aren't deleted prior to shutdown. |
| 185 virtual void DoomResponses( | 190 virtual void DoomResponses(const GURL& manifest_url, |
| 186 const GURL& manifest_url, const std::vector<int64>& response_ids) = 0; | 191 const std::vector<int64_t>& response_ids) = 0; |
| 187 | 192 |
| 188 // Schedules the lazy deletion of responses without persistently saving | 193 // Schedules the lazy deletion of responses without persistently saving |
| 189 // the response ids. | 194 // the response ids. |
| 190 virtual void DeleteResponses( | 195 virtual void DeleteResponses(const GURL& manifest_url, |
| 191 const GURL& manifest_url, const std::vector<int64>& response_ids) = 0; | 196 const std::vector<int64_t>& response_ids) = 0; |
| 192 | 197 |
| 193 // Generates unique storage ids for different object types. | 198 // Generates unique storage ids for different object types. |
| 194 int64 NewCacheId() { | 199 int64_t NewCacheId() { return ++last_cache_id_; } |
| 195 return ++last_cache_id_; | 200 int64_t NewGroupId() { return ++last_group_id_; } |
| 196 } | |
| 197 int64 NewGroupId() { | |
| 198 return ++last_group_id_; | |
| 199 } | |
| 200 | 201 |
| 201 // The working set of object instances currently in memory. | 202 // The working set of object instances currently in memory. |
| 202 AppCacheWorkingSet* working_set() { return &working_set_; } | 203 AppCacheWorkingSet* working_set() { return &working_set_; } |
| 203 | 204 |
| 204 // A map of origins to usage. | 205 // A map of origins to usage. |
| 205 const UsageMap* usage_map() { return &usage_map_; } | 206 const UsageMap* usage_map() { return &usage_map_; } |
| 206 | 207 |
| 207 // Simple ptr back to the service object that owns us. | 208 // Simple ptr back to the service object that owns us. |
| 208 AppCacheServiceImpl* service() { return service_; } | 209 AppCacheServiceImpl* service() { return service_; } |
| 209 | 210 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 virtual ~DelegateReference(); | 244 virtual ~DelegateReference(); |
| 244 }; | 245 }; |
| 245 typedef std::map<Delegate*, DelegateReference*> DelegateReferenceMap; | 246 typedef std::map<Delegate*, DelegateReference*> DelegateReferenceMap; |
| 246 typedef std::vector<scoped_refptr<DelegateReference> > | 247 typedef std::vector<scoped_refptr<DelegateReference> > |
| 247 DelegateReferenceVector; | 248 DelegateReferenceVector; |
| 248 | 249 |
| 249 // Helper used to manage an async LoadResponseInfo calls on behalf of | 250 // Helper used to manage an async LoadResponseInfo calls on behalf of |
| 250 // multiple callers. | 251 // multiple callers. |
| 251 class ResponseInfoLoadTask { | 252 class ResponseInfoLoadTask { |
| 252 public: | 253 public: |
| 253 ResponseInfoLoadTask(const GURL& manifest_url, int64 group_id, | 254 ResponseInfoLoadTask(const GURL& manifest_url, |
| 254 int64 response_id, AppCacheStorage* storage); | 255 int64_t group_id, |
| 256 int64_t response_id, |
| 257 AppCacheStorage* storage); |
| 255 ~ResponseInfoLoadTask(); | 258 ~ResponseInfoLoadTask(); |
| 256 | 259 |
| 257 int64 response_id() const { return response_id_; } | 260 int64_t response_id() const { return response_id_; } |
| 258 const GURL& manifest_url() const { return manifest_url_; } | 261 const GURL& manifest_url() const { return manifest_url_; } |
| 259 int64 group_id() const { return group_id_; } | 262 int64_t group_id() const { return group_id_; } |
| 260 | 263 |
| 261 void AddDelegate(DelegateReference* delegate_reference) { | 264 void AddDelegate(DelegateReference* delegate_reference) { |
| 262 delegates_.push_back(delegate_reference); | 265 delegates_.push_back(delegate_reference); |
| 263 } | 266 } |
| 264 | 267 |
| 265 void StartIfNeeded(); | 268 void StartIfNeeded(); |
| 266 | 269 |
| 267 private: | 270 private: |
| 268 void OnReadComplete(int result); | 271 void OnReadComplete(int result); |
| 269 | 272 |
| 270 AppCacheStorage* storage_; | 273 AppCacheStorage* storage_; |
| 271 GURL manifest_url_; | 274 GURL manifest_url_; |
| 272 int64 group_id_; | 275 int64_t group_id_; |
| 273 int64 response_id_; | 276 int64_t response_id_; |
| 274 scoped_ptr<AppCacheResponseReader> reader_; | 277 scoped_ptr<AppCacheResponseReader> reader_; |
| 275 DelegateReferenceVector delegates_; | 278 DelegateReferenceVector delegates_; |
| 276 scoped_refptr<HttpResponseInfoIOBuffer> info_buffer_; | 279 scoped_refptr<HttpResponseInfoIOBuffer> info_buffer_; |
| 277 }; | 280 }; |
| 278 | 281 |
| 279 typedef std::map<int64, ResponseInfoLoadTask*> PendingResponseInfoLoads; | 282 typedef std::map<int64_t, ResponseInfoLoadTask*> PendingResponseInfoLoads; |
| 280 | 283 |
| 281 DelegateReference* GetDelegateReference(Delegate* delegate) { | 284 DelegateReference* GetDelegateReference(Delegate* delegate) { |
| 282 DelegateReferenceMap::iterator iter = | 285 DelegateReferenceMap::iterator iter = |
| 283 delegate_references_.find(delegate); | 286 delegate_references_.find(delegate); |
| 284 if (iter != delegate_references_.end()) | 287 if (iter != delegate_references_.end()) |
| 285 return iter->second; | 288 return iter->second; |
| 286 return NULL; | 289 return NULL; |
| 287 } | 290 } |
| 288 | 291 |
| 289 DelegateReference* GetOrCreateDelegateReference(Delegate* delegate) { | 292 DelegateReference* GetOrCreateDelegateReference(Delegate* delegate) { |
| 290 DelegateReference* reference = GetDelegateReference(delegate); | 293 DelegateReference* reference = GetDelegateReference(delegate); |
| 291 if (reference) | 294 if (reference) |
| 292 return reference; | 295 return reference; |
| 293 return new DelegateReference(delegate, this); | 296 return new DelegateReference(delegate, this); |
| 294 } | 297 } |
| 295 | 298 |
| 296 ResponseInfoLoadTask* GetOrCreateResponseInfoLoadTask( | 299 ResponseInfoLoadTask* GetOrCreateResponseInfoLoadTask( |
| 297 const GURL& manifest_url, int64 group_id, int64 response_id) { | 300 const GURL& manifest_url, |
| 301 int64_t group_id, |
| 302 int64_t response_id) { |
| 298 PendingResponseInfoLoads::iterator iter = | 303 PendingResponseInfoLoads::iterator iter = |
| 299 pending_info_loads_.find(response_id); | 304 pending_info_loads_.find(response_id); |
| 300 if (iter != pending_info_loads_.end()) | 305 if (iter != pending_info_loads_.end()) |
| 301 return iter->second; | 306 return iter->second; |
| 302 return new ResponseInfoLoadTask(manifest_url, group_id, response_id, this); | 307 return new ResponseInfoLoadTask(manifest_url, group_id, response_id, this); |
| 303 } | 308 } |
| 304 | 309 |
| 305 // Should only be called when creating a new response writer. | 310 // Should only be called when creating a new response writer. |
| 306 int64 NewResponseId() { | 311 int64_t NewResponseId() { return ++last_response_id_; } |
| 307 return ++last_response_id_; | |
| 308 } | |
| 309 | 312 |
| 310 // Helpers to query and notify the QuotaManager. | 313 // Helpers to query and notify the QuotaManager. |
| 311 void UpdateUsageMapAndNotify(const GURL& origin, int64 new_usage); | 314 void UpdateUsageMapAndNotify(const GURL& origin, int64_t new_usage); |
| 312 void ClearUsageMapAndNotify(); | 315 void ClearUsageMapAndNotify(); |
| 313 void NotifyStorageAccessed(const GURL& origin); | 316 void NotifyStorageAccessed(const GURL& origin); |
| 314 | 317 |
| 315 // The last storage id used for different object types. | 318 // The last storage id used for different object types. |
| 316 int64 last_cache_id_; | 319 int64_t last_cache_id_; |
| 317 int64 last_group_id_; | 320 int64_t last_group_id_; |
| 318 int64 last_response_id_; | 321 int64_t last_response_id_; |
| 319 | 322 |
| 320 UsageMap usage_map_; // maps origin to usage | 323 UsageMap usage_map_; // maps origin to usage |
| 321 AppCacheWorkingSet working_set_; | 324 AppCacheWorkingSet working_set_; |
| 322 AppCacheServiceImpl* service_; | 325 AppCacheServiceImpl* service_; |
| 323 DelegateReferenceMap delegate_references_; | 326 DelegateReferenceMap delegate_references_; |
| 324 PendingResponseInfoLoads pending_info_loads_; | 327 PendingResponseInfoLoads pending_info_loads_; |
| 325 | 328 |
| 326 // The set of last ids must be retrieved from storage prior to being used. | 329 // The set of last ids must be retrieved from storage prior to being used. |
| 327 static const int64 kUnitializedId; | 330 static const int64_t kUnitializedId; |
| 328 | 331 |
| 329 FRIEND_TEST_ALL_PREFIXES(content::AppCacheStorageTest, DelegateReferences); | 332 FRIEND_TEST_ALL_PREFIXES(content::AppCacheStorageTest, DelegateReferences); |
| 330 FRIEND_TEST_ALL_PREFIXES(content::AppCacheStorageTest, UsageMap); | 333 FRIEND_TEST_ALL_PREFIXES(content::AppCacheStorageTest, UsageMap); |
| 331 | 334 |
| 332 DISALLOW_COPY_AND_ASSIGN(AppCacheStorage); | 335 DISALLOW_COPY_AND_ASSIGN(AppCacheStorage); |
| 333 }; | 336 }; |
| 334 | 337 |
| 335 } // namespace content | 338 } // namespace content |
| 336 | 339 |
| 337 #endif // CONTENT_BROWSER_APPCACHE_APPCACHE_STORAGE_H_ | 340 #endif // CONTENT_BROWSER_APPCACHE_APPCACHE_STORAGE_H_ |
| OLD | NEW |