OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 10 matching lines...) Expand all Loading... |
21 #include "base/file_path.h" | 21 #include "base/file_path.h" |
22 #include "base/hash_tables.h" | 22 #include "base/hash_tables.h" |
23 #include "base/scoped_ptr.h" | 23 #include "base/scoped_ptr.h" |
24 #include "base/task.h" | 24 #include "base/task.h" |
25 #include "base/weak_ptr.h" | 25 #include "base/weak_ptr.h" |
26 #include "net/base/cache_type.h" | 26 #include "net/base/cache_type.h" |
27 #include "net/base/completion_callback.h" | 27 #include "net/base/completion_callback.h" |
28 #include "net/http/http_transaction_factory.h" | 28 #include "net/http/http_transaction_factory.h" |
29 | 29 |
30 class GURL; | 30 class GURL; |
| 31 class ViewCacheHelper; |
31 | 32 |
32 namespace disk_cache { | 33 namespace disk_cache { |
33 class Backend; | 34 class Backend; |
34 class Entry; | 35 class Entry; |
35 } | 36 } |
36 | 37 |
37 namespace net { | 38 namespace net { |
38 | 39 |
39 class HostResolver; | 40 class HostResolver; |
40 class HttpAuthHandlerFactory; | 41 class HttpAuthHandlerFactory; |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 | 152 |
152 // Close currently active sockets so that fresh page loads will not use any | 153 // Close currently active sockets so that fresh page loads will not use any |
153 // recycled connections. For sockets currently in use, they may not close | 154 // recycled connections. For sockets currently in use, they may not close |
154 // immediately, but they will not be reusable. This is for debugging. | 155 // immediately, but they will not be reusable. This is for debugging. |
155 void CloseCurrentConnections(); | 156 void CloseCurrentConnections(); |
156 | 157 |
157 void set_enable_range_support(bool value) { | 158 void set_enable_range_support(bool value) { |
158 enable_range_support_ = value; | 159 enable_range_support_ = value; |
159 } | 160 } |
160 | 161 |
| 162 protected: |
| 163 // Disk cache entry data indices. |
| 164 enum { |
| 165 kResponseInfoIndex = 0, |
| 166 kResponseContentIndex, |
| 167 kMetadataIndex, |
| 168 |
| 169 // Must remain at the end of the enum. |
| 170 kNumCacheEntryDataIndices |
| 171 }; |
| 172 friend class ::ViewCacheHelper; |
| 173 |
161 private: | 174 private: |
162 | 175 |
163 // Types -------------------------------------------------------------------- | 176 // Types -------------------------------------------------------------------- |
164 | 177 |
165 class BackendCallback; | 178 class BackendCallback; |
166 class MetadataWriter; | 179 class MetadataWriter; |
167 class Transaction; | 180 class Transaction; |
168 class WorkItem; | 181 class WorkItem; |
169 friend class Transaction; | 182 friend class Transaction; |
170 struct NewEntry; // Info for an entry under construction. | 183 struct NewEntry; // Info for an entry under construction. |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 | 332 |
320 typedef base::hash_map<std::string, int> PlaybackCacheMap; | 333 typedef base::hash_map<std::string, int> PlaybackCacheMap; |
321 scoped_ptr<PlaybackCacheMap> playback_cache_map_; | 334 scoped_ptr<PlaybackCacheMap> playback_cache_map_; |
322 | 335 |
323 DISALLOW_COPY_AND_ASSIGN(HttpCache); | 336 DISALLOW_COPY_AND_ASSIGN(HttpCache); |
324 }; | 337 }; |
325 | 338 |
326 } // namespace net | 339 } // namespace net |
327 | 340 |
328 #endif // NET_HTTP_HTTP_CACHE_H_ | 341 #endif // NET_HTTP_HTTP_CACHE_H_ |
OLD | NEW |