| 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 7234 (any exceptions are called out in the code). | 7 // caching logic follows RFC 7234 (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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 | 42 |
| 43 namespace disk_cache { | 43 namespace disk_cache { |
| 44 class Backend; | 44 class Backend; |
| 45 class Entry; | 45 class Entry; |
| 46 } // namespace disk_cache | 46 } // namespace disk_cache |
| 47 | 47 |
| 48 namespace net { | 48 namespace net { |
| 49 | 49 |
| 50 class CertVerifier; | 50 class CertVerifier; |
| 51 class ChannelIDService; | 51 class ChannelIDService; |
| 52 class DiskBasedCertCache; | |
| 53 class HostResolver; | 52 class HostResolver; |
| 54 class HttpAuthHandlerFactory; | 53 class HttpAuthHandlerFactory; |
| 55 class HttpNetworkSession; | 54 class HttpNetworkSession; |
| 56 class HttpResponseInfo; | 55 class HttpResponseInfo; |
| 57 class HttpServerProperties; | 56 class HttpServerProperties; |
| 58 class IOBuffer; | 57 class IOBuffer; |
| 59 class NetLog; | 58 class NetLog; |
| 60 class NetworkDelegate; | 59 class NetworkDelegate; |
| 61 class ProxyService; | 60 class ProxyService; |
| 62 class SSLConfigService; | 61 class SSLConfigService; |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 // Initialize the cache from its component parts. |network_layer| and | 141 // Initialize the cache from its component parts. |network_layer| and |
| 143 // |backend_factory| will be destroyed when the HttpCache is. | 142 // |backend_factory| will be destroyed when the HttpCache is. |
| 144 HttpCache(scoped_ptr<HttpTransactionFactory> network_layer, | 143 HttpCache(scoped_ptr<HttpTransactionFactory> network_layer, |
| 145 scoped_ptr<BackendFactory> backend_factory, | 144 scoped_ptr<BackendFactory> backend_factory, |
| 146 bool set_up_quic_server_info); | 145 bool set_up_quic_server_info); |
| 147 | 146 |
| 148 ~HttpCache() override; | 147 ~HttpCache() override; |
| 149 | 148 |
| 150 HttpTransactionFactory* network_layer() { return network_layer_.get(); } | 149 HttpTransactionFactory* network_layer() { return network_layer_.get(); } |
| 151 | 150 |
| 152 DiskBasedCertCache* cert_cache() const { return cert_cache_.get(); } | |
| 153 | |
| 154 // Retrieves the cache backend for this HttpCache instance. If the backend | 151 // Retrieves the cache backend for this HttpCache instance. If the backend |
| 155 // is not initialized yet, this method will initialize it. The return value is | 152 // is not initialized yet, this method will initialize it. The return value is |
| 156 // a network error code, and it could be ERR_IO_PENDING, in which case the | 153 // a network error code, and it could be ERR_IO_PENDING, in which case the |
| 157 // |callback| will be notified when the operation completes. The pointer that | 154 // |callback| will be notified when the operation completes. The pointer that |
| 158 // receives the |backend| must remain valid until the operation completes. | 155 // receives the |backend| must remain valid until the operation completes. |
| 159 int GetBackend(disk_cache::Backend** backend, | 156 int GetBackend(disk_cache::Backend** backend, |
| 160 const CompletionCallback& callback); | 157 const CompletionCallback& callback); |
| 161 | 158 |
| 162 // Returns the current backend (can be NULL). | 159 // Returns the current backend (can be NULL). |
| 163 disk_cache::Backend* GetCurrentBackend() const; | 160 disk_cache::Backend* GetCurrentBackend() const; |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 412 bool building_backend_; | 409 bool building_backend_; |
| 413 bool bypass_lock_for_test_; | 410 bool bypass_lock_for_test_; |
| 414 bool fail_conditionalization_for_test_; | 411 bool fail_conditionalization_for_test_; |
| 415 | 412 |
| 416 Mode mode_; | 413 Mode mode_; |
| 417 | 414 |
| 418 scoped_ptr<HttpTransactionFactory> network_layer_; | 415 scoped_ptr<HttpTransactionFactory> network_layer_; |
| 419 | 416 |
| 420 scoped_ptr<disk_cache::Backend> disk_cache_; | 417 scoped_ptr<disk_cache::Backend> disk_cache_; |
| 421 | 418 |
| 422 scoped_ptr<DiskBasedCertCache> cert_cache_; | |
| 423 | |
| 424 // The set of active entries indexed by cache key. | 419 // The set of active entries indexed by cache key. |
| 425 ActiveEntriesMap active_entries_; | 420 ActiveEntriesMap active_entries_; |
| 426 | 421 |
| 427 // The set of doomed entries. | 422 // The set of doomed entries. |
| 428 ActiveEntriesSet doomed_entries_; | 423 ActiveEntriesSet doomed_entries_; |
| 429 | 424 |
| 430 // The set of entries "under construction". | 425 // The set of entries "under construction". |
| 431 PendingOpsMap pending_ops_; | 426 PendingOpsMap pending_ops_; |
| 432 | 427 |
| 433 scoped_ptr<PlaybackCacheMap> playback_cache_map_; | 428 scoped_ptr<PlaybackCacheMap> playback_cache_map_; |
| 434 | 429 |
| 435 // A clock that can be swapped out for testing. | 430 // A clock that can be swapped out for testing. |
| 436 scoped_ptr<base::Clock> clock_; | 431 scoped_ptr<base::Clock> clock_; |
| 437 | 432 |
| 438 base::WeakPtrFactory<HttpCache> weak_factory_; | 433 base::WeakPtrFactory<HttpCache> weak_factory_; |
| 439 | 434 |
| 440 DISALLOW_COPY_AND_ASSIGN(HttpCache); | 435 DISALLOW_COPY_AND_ASSIGN(HttpCache); |
| 441 }; | 436 }; |
| 442 | 437 |
| 443 } // namespace net | 438 } // namespace net |
| 444 | 439 |
| 445 #endif // NET_HTTP_HTTP_CACHE_H_ | 440 #endif // NET_HTTP_HTTP_CACHE_H_ |
| OLD | NEW |