| 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 12 matching lines...) Expand all Loading... |
| 23 #include "base/hash_tables.h" | 23 #include "base/hash_tables.h" |
| 24 #include "base/memory/scoped_ptr.h" | 24 #include "base/memory/scoped_ptr.h" |
| 25 #include "base/memory/weak_ptr.h" | 25 #include "base/memory/weak_ptr.h" |
| 26 #include "base/message_loop_proxy.h" | 26 #include "base/message_loop_proxy.h" |
| 27 #include "base/time.h" | 27 #include "base/time.h" |
| 28 #include "base/threading/non_thread_safe.h" | 28 #include "base/threading/non_thread_safe.h" |
| 29 #include "net/base/cache_type.h" | 29 #include "net/base/cache_type.h" |
| 30 #include "net/base/completion_callback.h" | 30 #include "net/base/completion_callback.h" |
| 31 #include "net/base/load_states.h" | 31 #include "net/base/load_states.h" |
| 32 #include "net/base/net_export.h" | 32 #include "net/base/net_export.h" |
| 33 #include "net/http/http_network_session.h" |
| 33 #include "net/http/http_transaction_factory.h" | 34 #include "net/http/http_transaction_factory.h" |
| 34 | 35 |
| 35 class GURL; | 36 class GURL; |
| 36 | 37 |
| 37 namespace disk_cache { | 38 namespace disk_cache { |
| 38 class Backend; | 39 class Backend; |
| 39 class Entry; | 40 class Entry; |
| 40 } | 41 } |
| 41 | 42 |
| 42 namespace net { | 43 namespace net { |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 | 112 |
| 112 private: | 113 private: |
| 113 CacheType type_; | 114 CacheType type_; |
| 114 const FilePath path_; | 115 const FilePath path_; |
| 115 int max_bytes_; | 116 int max_bytes_; |
| 116 scoped_refptr<base::MessageLoopProxy> thread_; | 117 scoped_refptr<base::MessageLoopProxy> thread_; |
| 117 }; | 118 }; |
| 118 | 119 |
| 119 // The disk cache is initialized lazily (by CreateTransaction) in this case. | 120 // The disk cache is initialized lazily (by CreateTransaction) in this case. |
| 120 // The HttpCache takes ownership of the |backend_factory|. | 121 // The HttpCache takes ownership of the |backend_factory|. |
| 121 HttpCache(HostResolver* host_resolver, | 122 HttpCache(const net::HttpNetworkSession::Params& params, |
| 122 CertVerifier* cert_verifier, | 123 BackendFactory* backend_factory); |
| 123 ServerBoundCertService* server_bound_cert_service, | |
| 124 TransportSecurityState* transport_security_state, | |
| 125 ProxyService* proxy_service, | |
| 126 const std::string& ssl_session_cache_shard, | |
| 127 SSLConfigService* ssl_config_service, | |
| 128 HttpAuthHandlerFactory* http_auth_handler_factory, | |
| 129 NetworkDelegate* network_delegate, | |
| 130 HttpServerProperties* http_server_properties, | |
| 131 NetLog* net_log, | |
| 132 BackendFactory* backend_factory, | |
| 133 const std::string& trusted_spdy_proxy); | |
| 134 | 124 |
| 135 // The disk cache is initialized lazily (by CreateTransaction) in this case. | 125 // The disk cache is initialized lazily (by CreateTransaction) in this case. |
| 136 // Provide an existing HttpNetworkSession, the cache can construct a | 126 // Provide an existing HttpNetworkSession, the cache can construct a |
| 137 // network layer with a shared HttpNetworkSession in order for multiple | 127 // network layer with a shared HttpNetworkSession in order for multiple |
| 138 // network layers to share information (e.g. authentication data). The | 128 // network layers to share information (e.g. authentication data). The |
| 139 // HttpCache takes ownership of the |backend_factory|. | 129 // HttpCache takes ownership of the |backend_factory|. |
| 140 HttpCache(HttpNetworkSession* session, BackendFactory* backend_factory); | 130 HttpCache(HttpNetworkSession* session, BackendFactory* backend_factory); |
| 141 | 131 |
| 142 // Initialize the cache from its component parts, which is useful for | 132 // Initialize the cache from its component parts, which is useful for |
| 143 // testing. The lifetime of the network_layer and backend_factory are managed | 133 // testing. The lifetime of the network_layer and backend_factory are managed |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 392 PendingOpsMap pending_ops_; | 382 PendingOpsMap pending_ops_; |
| 393 | 383 |
| 394 scoped_ptr<PlaybackCacheMap> playback_cache_map_; | 384 scoped_ptr<PlaybackCacheMap> playback_cache_map_; |
| 395 | 385 |
| 396 DISALLOW_COPY_AND_ASSIGN(HttpCache); | 386 DISALLOW_COPY_AND_ASSIGN(HttpCache); |
| 397 }; | 387 }; |
| 398 | 388 |
| 399 } // namespace net | 389 } // namespace net |
| 400 | 390 |
| 401 #endif // NET_HTTP_HTTP_CACHE_H_ | 391 #endif // NET_HTTP_HTTP_CACHE_H_ |
| OLD | NEW |