Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(923)

Side by Side Diff: content/browser/appcache/appcache_storage.h

Issue 1887153002: Removing unused field - AppCacheResponseIO::group_id_. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: git cl format Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <stdint.h> 8 #include <stdint.h>
9 9
10 #include <map> 10 #include <map>
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 // the delegate will be called back with a NULL group pointer. 107 // the delegate will be called back with a NULL group pointer.
108 virtual void LoadOrCreateGroup( 108 virtual void LoadOrCreateGroup(
109 const GURL& manifest_url, Delegate* delegate) = 0; 109 const GURL& manifest_url, Delegate* delegate) = 0;
110 110
111 // Schedules response info to be loaded from storage. 111 // Schedules response info to be loaded from storage.
112 // Upon load completion the delegate will be called back. If the data 112 // Upon load completion the delegate will be called back. If the data
113 // already resides in memory, the delegate will be called back 113 // already resides in memory, the delegate will be called back
114 // immediately without returning to the message loop. If the load fails, 114 // immediately without returning to the message loop. If the load fails,
115 // the delegate will be called back with a NULL pointer. 115 // the delegate will be called back with a NULL pointer.
116 virtual void LoadResponseInfo(const GURL& manifest_url, 116 virtual void LoadResponseInfo(const GURL& manifest_url,
117 int64_t group_id,
118 int64_t response_id, 117 int64_t response_id,
119 Delegate* delegate); 118 Delegate* delegate);
120 119
121 // Schedules a group and its newest complete cache to be initially stored or 120 // Schedules a group and its newest complete cache to be initially stored or
122 // incrementally updated with new changes. Upon completion the delegate 121 // incrementally updated with new changes. Upon completion the delegate
123 // will be called back. A group without a newest cache cannot be stored. 122 // will be called back. A group without a newest cache cannot be stored.
124 // It's a programming error to call this method without a newest cache. A 123 // It's a programming error to call this method without a newest cache. A
125 // side effect of storing a new newest cache is the removal of the group's 124 // side effect of storing a new newest cache is the removal of the group's
126 // old caches and responses from persistent storage (although they may still 125 // old caches and responses from persistent storage (although they may still
127 // linger in the in-memory working set until no longer needed). The new 126 // linger in the in-memory working set until no longer needed). The new
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 // take place. The callbacks for subsequently scheduled operations are 165 // take place. The callbacks for subsequently scheduled operations are
167 // unaffected. 166 // unaffected.
168 void CancelDelegateCallbacks(Delegate* delegate) { 167 void CancelDelegateCallbacks(Delegate* delegate) {
169 DelegateReference* delegate_reference = GetDelegateReference(delegate); 168 DelegateReference* delegate_reference = GetDelegateReference(delegate);
170 if (delegate_reference) 169 if (delegate_reference)
171 delegate_reference->CancelReference(); 170 delegate_reference->CancelReference();
172 } 171 }
173 172
174 // Creates a reader to read a response from storage. 173 // Creates a reader to read a response from storage.
175 virtual AppCacheResponseReader* CreateResponseReader(const GURL& manifest_url, 174 virtual AppCacheResponseReader* CreateResponseReader(const GURL& manifest_url,
176 int64_t group_id,
177 int64_t response_id) = 0; 175 int64_t response_id) = 0;
178 176
179 // 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
180 // establishes a new response id. 178 // establishes a new response id.
181 virtual AppCacheResponseWriter* CreateResponseWriter(const GURL& manifest_url, 179 virtual AppCacheResponseWriter* CreateResponseWriter(
182 int64_t group_id) = 0; 180 const GURL& manifest_url) = 0;
183 181
184 // Creates a metadata writer to write metadata of response to storage. 182 // Creates a metadata writer to write metadata of response to storage.
185 virtual AppCacheResponseMetadataWriter* CreateResponseMetadataWriter( 183 virtual AppCacheResponseMetadataWriter* CreateResponseMetadataWriter(
186 int64_t group_id,
187 int64_t response_id) = 0; 184 int64_t response_id) = 0;
188 185
189 // Schedules the lazy deletion of responses and saves the ids 186 // Schedules the lazy deletion of responses and saves the ids
190 // persistently such that the responses will be deleted upon restart 187 // persistently such that the responses will be deleted upon restart
191 // if they aren't deleted prior to shutdown. 188 // if they aren't deleted prior to shutdown.
192 virtual void DoomResponses(const GURL& manifest_url, 189 virtual void DoomResponses(const GURL& manifest_url,
193 const std::vector<int64_t>& response_ids) = 0; 190 const std::vector<int64_t>& response_ids) = 0;
194 191
195 // Schedules the lazy deletion of responses without persistently saving 192 // Schedules the lazy deletion of responses without persistently saving
196 // the response ids. 193 // the response ids.
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 }; 244 };
248 typedef std::map<Delegate*, DelegateReference*> DelegateReferenceMap; 245 typedef std::map<Delegate*, DelegateReference*> DelegateReferenceMap;
249 typedef std::vector<scoped_refptr<DelegateReference> > 246 typedef std::vector<scoped_refptr<DelegateReference> >
250 DelegateReferenceVector; 247 DelegateReferenceVector;
251 248
252 // Helper used to manage an async LoadResponseInfo calls on behalf of 249 // Helper used to manage an async LoadResponseInfo calls on behalf of
253 // multiple callers. 250 // multiple callers.
254 class ResponseInfoLoadTask { 251 class ResponseInfoLoadTask {
255 public: 252 public:
256 ResponseInfoLoadTask(const GURL& manifest_url, 253 ResponseInfoLoadTask(const GURL& manifest_url,
257 int64_t group_id,
258 int64_t response_id, 254 int64_t response_id,
259 AppCacheStorage* storage); 255 AppCacheStorage* storage);
260 ~ResponseInfoLoadTask(); 256 ~ResponseInfoLoadTask();
261 257
262 int64_t response_id() const { return response_id_; } 258 int64_t response_id() const { return response_id_; }
263 const GURL& manifest_url() const { return manifest_url_; } 259 const GURL& manifest_url() const { return manifest_url_; }
264 int64_t group_id() const { return group_id_; }
265 260
266 void AddDelegate(DelegateReference* delegate_reference) { 261 void AddDelegate(DelegateReference* delegate_reference) {
267 delegates_.push_back(delegate_reference); 262 delegates_.push_back(delegate_reference);
268 } 263 }
269 264
270 void StartIfNeeded(); 265 void StartIfNeeded();
271 266
272 private: 267 private:
273 void OnReadComplete(int result); 268 void OnReadComplete(int result);
274 269
275 AppCacheStorage* storage_; 270 AppCacheStorage* storage_;
276 GURL manifest_url_; 271 GURL manifest_url_;
277 int64_t group_id_;
278 int64_t response_id_; 272 int64_t response_id_;
279 std::unique_ptr<AppCacheResponseReader> reader_; 273 std::unique_ptr<AppCacheResponseReader> reader_;
280 DelegateReferenceVector delegates_; 274 DelegateReferenceVector delegates_;
281 scoped_refptr<HttpResponseInfoIOBuffer> info_buffer_; 275 scoped_refptr<HttpResponseInfoIOBuffer> info_buffer_;
282 }; 276 };
283 277
284 typedef std::map<int64_t, ResponseInfoLoadTask*> PendingResponseInfoLoads; 278 typedef std::map<int64_t, ResponseInfoLoadTask*> PendingResponseInfoLoads;
285 279
286 DelegateReference* GetDelegateReference(Delegate* delegate) { 280 DelegateReference* GetDelegateReference(Delegate* delegate) {
287 DelegateReferenceMap::iterator iter = 281 DelegateReferenceMap::iterator iter =
288 delegate_references_.find(delegate); 282 delegate_references_.find(delegate);
289 if (iter != delegate_references_.end()) 283 if (iter != delegate_references_.end())
290 return iter->second; 284 return iter->second;
291 return NULL; 285 return NULL;
292 } 286 }
293 287
294 DelegateReference* GetOrCreateDelegateReference(Delegate* delegate) { 288 DelegateReference* GetOrCreateDelegateReference(Delegate* delegate) {
295 DelegateReference* reference = GetDelegateReference(delegate); 289 DelegateReference* reference = GetDelegateReference(delegate);
296 if (reference) 290 if (reference)
297 return reference; 291 return reference;
298 return new DelegateReference(delegate, this); 292 return new DelegateReference(delegate, this);
299 } 293 }
300 294
301 ResponseInfoLoadTask* GetOrCreateResponseInfoLoadTask( 295 ResponseInfoLoadTask* GetOrCreateResponseInfoLoadTask(
302 const GURL& manifest_url, 296 const GURL& manifest_url,
303 int64_t group_id,
304 int64_t response_id) { 297 int64_t response_id) {
305 PendingResponseInfoLoads::iterator iter = 298 PendingResponseInfoLoads::iterator iter =
306 pending_info_loads_.find(response_id); 299 pending_info_loads_.find(response_id);
307 if (iter != pending_info_loads_.end()) 300 if (iter != pending_info_loads_.end())
308 return iter->second; 301 return iter->second;
309 return new ResponseInfoLoadTask(manifest_url, group_id, response_id, this); 302 return new ResponseInfoLoadTask(manifest_url, response_id, this);
310 } 303 }
311 304
312 // Should only be called when creating a new response writer. 305 // Should only be called when creating a new response writer.
313 int64_t NewResponseId() { return ++last_response_id_; } 306 int64_t NewResponseId() { return ++last_response_id_; }
314 307
315 // Helpers to query and notify the QuotaManager. 308 // Helpers to query and notify the QuotaManager.
316 void UpdateUsageMapAndNotify(const GURL& origin, int64_t new_usage); 309 void UpdateUsageMapAndNotify(const GURL& origin, int64_t new_usage);
317 void ClearUsageMapAndNotify(); 310 void ClearUsageMapAndNotify();
318 void NotifyStorageAccessed(const GURL& origin); 311 void NotifyStorageAccessed(const GURL& origin);
319 312
(...skipping 13 matching lines...) Expand all
333 326
334 FRIEND_TEST_ALL_PREFIXES(content::AppCacheStorageTest, DelegateReferences); 327 FRIEND_TEST_ALL_PREFIXES(content::AppCacheStorageTest, DelegateReferences);
335 FRIEND_TEST_ALL_PREFIXES(content::AppCacheStorageTest, UsageMap); 328 FRIEND_TEST_ALL_PREFIXES(content::AppCacheStorageTest, UsageMap);
336 329
337 DISALLOW_COPY_AND_ASSIGN(AppCacheStorage); 330 DISALLOW_COPY_AND_ASSIGN(AppCacheStorage);
338 }; 331 };
339 332
340 } // namespace content 333 } // namespace content
341 334
342 #endif // CONTENT_BROWSER_APPCACHE_APPCACHE_STORAGE_H_ 335 #endif // CONTENT_BROWSER_APPCACHE_APPCACHE_STORAGE_H_
OLDNEW
« no previous file with comments | « content/browser/appcache/appcache_service_unittest.cc ('k') | content/browser/appcache/appcache_storage.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698