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 11 matching lines...) Expand all Loading... |
22 #include "base/hash_tables.h" | 22 #include "base/hash_tables.h" |
23 #include "base/message_loop_proxy.h" | 23 #include "base/message_loop_proxy.h" |
24 #include "base/scoped_ptr.h" | 24 #include "base/scoped_ptr.h" |
25 #include "base/task.h" | 25 #include "base/task.h" |
26 #include "base/weak_ptr.h" | 26 #include "base/weak_ptr.h" |
27 #include "net/base/cache_type.h" | 27 #include "net/base/cache_type.h" |
28 #include "net/base/completion_callback.h" | 28 #include "net/base/completion_callback.h" |
29 #include "net/http/http_transaction_factory.h" | 29 #include "net/http/http_transaction_factory.h" |
30 | 30 |
31 class GURL; | 31 class GURL; |
32 class ViewCacheHelper; | |
33 | 32 |
34 namespace disk_cache { | 33 namespace disk_cache { |
35 class Backend; | 34 class Backend; |
36 class Entry; | 35 class Entry; |
37 } | 36 } |
38 | 37 |
39 namespace net { | 38 namespace net { |
40 | 39 |
41 class HostResolver; | 40 class HostResolver; |
42 class HttpAuthHandlerFactory; | 41 class HttpAuthHandlerFactory; |
43 class HttpNetworkSession; | 42 class HttpNetworkSession; |
44 struct HttpRequestInfo; | 43 struct HttpRequestInfo; |
45 class HttpResponseInfo; | 44 class HttpResponseInfo; |
46 class IOBuffer; | 45 class IOBuffer; |
47 class NetworkChangeNotifier; | 46 class NetworkChangeNotifier; |
48 class ProxyService; | 47 class ProxyService; |
49 class SSLConfigService; | 48 class SSLConfigService; |
| 49 class ViewCacheHelper; |
50 | 50 |
51 class HttpCache : public HttpTransactionFactory, | 51 class HttpCache : public HttpTransactionFactory, |
52 public base::SupportsWeakPtr<HttpCache> { | 52 public base::SupportsWeakPtr<HttpCache> { |
53 public: | 53 public: |
54 ~HttpCache(); | 54 ~HttpCache(); |
55 | 55 |
56 // The cache mode of operation. | 56 // The cache mode of operation. |
57 enum Mode { | 57 enum Mode { |
58 // Normal mode just behaves like a standard web cache. | 58 // Normal mode just behaves like a standard web cache. |
59 NORMAL = 0, | 59 NORMAL = 0, |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 protected: | 194 protected: |
195 // Disk cache entry data indices. | 195 // Disk cache entry data indices. |
196 enum { | 196 enum { |
197 kResponseInfoIndex = 0, | 197 kResponseInfoIndex = 0, |
198 kResponseContentIndex, | 198 kResponseContentIndex, |
199 kMetadataIndex, | 199 kMetadataIndex, |
200 | 200 |
201 // Must remain at the end of the enum. | 201 // Must remain at the end of the enum. |
202 kNumCacheEntryDataIndices | 202 kNumCacheEntryDataIndices |
203 }; | 203 }; |
204 friend class ::ViewCacheHelper; | 204 friend class ViewCacheHelper; |
205 | 205 |
206 private: | 206 private: |
207 // Types -------------------------------------------------------------------- | 207 // Types -------------------------------------------------------------------- |
208 | 208 |
209 class BackendCallback; | 209 class BackendCallback; |
210 class MetadataWriter; | 210 class MetadataWriter; |
211 class Transaction; | 211 class Transaction; |
212 class WorkItem; | 212 class WorkItem; |
213 friend class Transaction; | 213 friend class Transaction; |
214 struct PendingOp; // Info for an entry under construction. | 214 struct PendingOp; // Info for an entry under construction. |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
377 | 377 |
378 typedef base::hash_map<std::string, int> PlaybackCacheMap; | 378 typedef base::hash_map<std::string, int> PlaybackCacheMap; |
379 scoped_ptr<PlaybackCacheMap> playback_cache_map_; | 379 scoped_ptr<PlaybackCacheMap> playback_cache_map_; |
380 | 380 |
381 DISALLOW_COPY_AND_ASSIGN(HttpCache); | 381 DISALLOW_COPY_AND_ASSIGN(HttpCache); |
382 }; | 382 }; |
383 | 383 |
384 } // namespace net | 384 } // namespace net |
385 | 385 |
386 #endif // NET_HTTP_HTTP_CACHE_H_ | 386 #endif // NET_HTTP_HTTP_CACHE_H_ |
OLD | NEW |