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 // 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 26 matching lines...) Expand all Loading... |
37 class GURL; | 37 class GURL; |
38 | 38 |
39 namespace disk_cache { | 39 namespace disk_cache { |
40 class Backend; | 40 class Backend; |
41 class Entry; | 41 class Entry; |
42 } | 42 } |
43 | 43 |
44 namespace net { | 44 namespace net { |
45 | 45 |
46 class CertVerifier; | 46 class CertVerifier; |
| 47 class DiskBasedCertCache; |
47 class HostResolver; | 48 class HostResolver; |
48 class HttpAuthHandlerFactory; | 49 class HttpAuthHandlerFactory; |
49 class HttpNetworkSession; | 50 class HttpNetworkSession; |
50 class HttpResponseInfo; | 51 class HttpResponseInfo; |
51 class HttpServerProperties; | 52 class HttpServerProperties; |
52 class IOBuffer; | 53 class IOBuffer; |
53 class NetLog; | 54 class NetLog; |
54 class NetworkDelegate; | 55 class NetworkDelegate; |
55 class ServerBoundCertService; | 56 class ServerBoundCertService; |
56 class ProxyService; | 57 class ProxyService; |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 // |network_layer| and |backend_factory| are managed by the HttpCache and | 136 // |network_layer| and |backend_factory| are managed by the HttpCache and |
136 // will be destroyed using |delete| when the HttpCache is destroyed. | 137 // will be destroyed using |delete| when the HttpCache is destroyed. |
137 HttpCache(HttpTransactionFactory* network_layer, | 138 HttpCache(HttpTransactionFactory* network_layer, |
138 NetLog* net_log, | 139 NetLog* net_log, |
139 BackendFactory* backend_factory); | 140 BackendFactory* backend_factory); |
140 | 141 |
141 virtual ~HttpCache(); | 142 virtual ~HttpCache(); |
142 | 143 |
143 HttpTransactionFactory* network_layer() { return network_layer_.get(); } | 144 HttpTransactionFactory* network_layer() { return network_layer_.get(); } |
144 | 145 |
| 146 DiskBasedCertCache* cert_cache() const { return cert_cache_.get(); } |
| 147 |
145 // Retrieves the cache backend for this HttpCache instance. If the backend | 148 // Retrieves the cache backend for this HttpCache instance. If the backend |
146 // is not initialized yet, this method will initialize it. The return value is | 149 // is not initialized yet, this method will initialize it. The return value is |
147 // a network error code, and it could be ERR_IO_PENDING, in which case the | 150 // a network error code, and it could be ERR_IO_PENDING, in which case the |
148 // |callback| will be notified when the operation completes. The pointer that | 151 // |callback| will be notified when the operation completes. The pointer that |
149 // receives the |backend| must remain valid until the operation completes. | 152 // receives the |backend| must remain valid until the operation completes. |
150 int GetBackend(disk_cache::Backend** backend, | 153 int GetBackend(disk_cache::Backend** backend, |
151 const net::CompletionCallback& callback); | 154 const net::CompletionCallback& callback); |
152 | 155 |
153 // Returns the current backend (can be NULL). | 156 // Returns the current backend (can be NULL). |
154 disk_cache::Backend* GetCurrentBackend() const; | 157 disk_cache::Backend* GetCurrentBackend() const; |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
398 bool bypass_lock_for_test_; | 401 bool bypass_lock_for_test_; |
399 | 402 |
400 Mode mode_; | 403 Mode mode_; |
401 | 404 |
402 scoped_ptr<QuicServerInfoFactoryAdaptor> quic_server_info_factory_; | 405 scoped_ptr<QuicServerInfoFactoryAdaptor> quic_server_info_factory_; |
403 | 406 |
404 scoped_ptr<HttpTransactionFactory> network_layer_; | 407 scoped_ptr<HttpTransactionFactory> network_layer_; |
405 | 408 |
406 scoped_ptr<disk_cache::Backend> disk_cache_; | 409 scoped_ptr<disk_cache::Backend> disk_cache_; |
407 | 410 |
| 411 scoped_ptr<DiskBasedCertCache> cert_cache_; |
| 412 |
408 // The set of active entries indexed by cache key. | 413 // The set of active entries indexed by cache key. |
409 ActiveEntriesMap active_entries_; | 414 ActiveEntriesMap active_entries_; |
410 | 415 |
411 // The set of doomed entries. | 416 // The set of doomed entries. |
412 ActiveEntriesSet doomed_entries_; | 417 ActiveEntriesSet doomed_entries_; |
413 | 418 |
414 // The set of entries "under construction". | 419 // The set of entries "under construction". |
415 PendingOpsMap pending_ops_; | 420 PendingOpsMap pending_ops_; |
416 | 421 |
417 scoped_ptr<PlaybackCacheMap> playback_cache_map_; | 422 scoped_ptr<PlaybackCacheMap> playback_cache_map_; |
418 | 423 |
419 base::WeakPtrFactory<HttpCache> weak_factory_; | 424 base::WeakPtrFactory<HttpCache> weak_factory_; |
420 | 425 |
421 DISALLOW_COPY_AND_ASSIGN(HttpCache); | 426 DISALLOW_COPY_AND_ASSIGN(HttpCache); |
422 }; | 427 }; |
423 | 428 |
424 } // namespace net | 429 } // namespace net |
425 | 430 |
426 #endif // NET_HTTP_HTTP_CACHE_H_ | 431 #endif // NET_HTTP_HTTP_CACHE_H_ |
OLD | NEW |