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

Side by Side Diff: net/http/http_cache.h

Issue 378015: Clear disk cache when the cache is not initialized (Closed)
Patch Set: simple test Created 11 years, 1 month 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
« no previous file with comments | « chrome/browser/browsing_data_remover.cc ('k') | net/http/http_cache.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 // This file declares a HttpTransactionFactory implementation that can be 5 // This file declares a HttpTransactionFactory implementation that can be
6 // layered on top of another HttpTransactionFactory to add HTTP caching. The 6 // layered on top of another HttpTransactionFactory to add HTTP caching. The
7 // caching logic follows RFC 2616 (any exceptions are called out in the code). 7 // caching logic follows RFC 2616 (any exceptions are called out in the code).
8 // 8 //
9 // The HttpCache takes a disk_cache::Backend as a parameter, and uses that for 9 // The HttpCache takes a disk_cache::Backend as a parameter, and uses that for
10 // the cache storage. 10 // the cache storage.
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 int cache_size); 86 int cache_size);
87 87
88 // Initialize the cache from its component parts, which is useful for 88 // Initialize the cache from its component parts, which is useful for
89 // testing. The lifetime of the network_layer and disk_cache are managed by 89 // testing. The lifetime of the network_layer and disk_cache are managed by
90 // the HttpCache and will be destroyed using |delete| when the HttpCache is 90 // the HttpCache and will be destroyed using |delete| when the HttpCache is
91 // destroyed. 91 // destroyed.
92 HttpCache(HttpTransactionFactory* network_layer, 92 HttpCache(HttpTransactionFactory* network_layer,
93 disk_cache::Backend* disk_cache); 93 disk_cache::Backend* disk_cache);
94 94
95 HttpTransactionFactory* network_layer() { return network_layer_.get(); } 95 HttpTransactionFactory* network_layer() { return network_layer_.get(); }
96 disk_cache::Backend* disk_cache() { return disk_cache_.get(); } 96
97 // Returns the cache backend for this HttpCache instance. If the backend
98 // is not initialized yet, this method will initialize it. If the return
99 // value is NULL then the backend cannot be initialized.
100 disk_cache::Backend* GetBackend();
97 101
98 // HttpTransactionFactory implementation: 102 // HttpTransactionFactory implementation:
99 virtual int CreateTransaction(scoped_ptr<HttpTransaction>* trans); 103 virtual int CreateTransaction(scoped_ptr<HttpTransaction>* trans);
100 virtual HttpCache* GetCache(); 104 virtual HttpCache* GetCache();
101 virtual HttpNetworkSession* GetSession(); 105 virtual HttpNetworkSession* GetSession();
102 virtual void Suspend(bool suspend); 106 virtual void Suspend(bool suspend);
103 107
104 // Helper function for reading response info from the disk cache. If the 108 // Helper function for reading response info from the disk cache. If the
105 // cache doesn't have the whole resource *|request_truncated| is set to true. 109 // cache doesn't have the whole resource *|request_truncated| is set to true.
106 static bool ReadResponseInfo(disk_cache::Entry* disk_entry, 110 static bool ReadResponseInfo(disk_cache::Entry* disk_entry,
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 scoped_ptr<disk_cache::Backend> disk_cache_; 202 scoped_ptr<disk_cache::Backend> disk_cache_;
199 203
200 // The set of active entries indexed by cache key 204 // The set of active entries indexed by cache key
201 ActiveEntriesMap active_entries_; 205 ActiveEntriesMap active_entries_;
202 206
203 // The set of doomed entries 207 // The set of doomed entries
204 ActiveEntriesSet doomed_entries_; 208 ActiveEntriesSet doomed_entries_;
205 209
206 ScopedRunnableMethodFactory<HttpCache> task_factory_; 210 ScopedRunnableMethodFactory<HttpCache> task_factory_;
207 211
208 bool in_memory_cache_;
209 bool enable_range_support_; 212 bool enable_range_support_;
210 int cache_size_; 213 int cache_size_;
211 214
212 typedef base::hash_map<std::string, int> PlaybackCacheMap; 215 typedef base::hash_map<std::string, int> PlaybackCacheMap;
213 scoped_ptr<PlaybackCacheMap> playback_cache_map_; 216 scoped_ptr<PlaybackCacheMap> playback_cache_map_;
214 217
215 DISALLOW_COPY_AND_ASSIGN(HttpCache); 218 DISALLOW_COPY_AND_ASSIGN(HttpCache);
216 }; 219 };
217 220
218 } // namespace net 221 } // namespace net
219 222
220 #endif // NET_HTTP_HTTP_CACHE_H_ 223 #endif // NET_HTTP_HTTP_CACHE_H_
OLDNEW
« no previous file with comments | « chrome/browser/browsing_data_remover.cc ('k') | net/http/http_cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698