Chromium Code Reviews| 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 13 matching lines...) Expand all Loading... | |
| 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/message_loop_proxy.h" | 26 #include "base/message_loop/message_loop_proxy.h" |
| 27 #include "base/threading/non_thread_safe.h" | 27 #include "base/threading/non_thread_safe.h" |
| 28 #include "base/time/time.h" | 28 #include "base/time/time.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/base/request_priority.h" | 33 #include "net/base/request_priority.h" |
| 34 #include "net/http/disk_based_cert_cache.h" | |
|
Ryan Sleevi
2014/06/26 19:56:02
Don't include this header in the .h.
You can forw
| |
| 34 #include "net/http/http_network_session.h" | 35 #include "net/http/http_network_session.h" |
| 35 #include "net/http/http_transaction_factory.h" | 36 #include "net/http/http_transaction_factory.h" |
| 36 | 37 |
| 37 class GURL; | 38 class GURL; |
| 38 | 39 |
| 39 namespace disk_cache { | 40 namespace disk_cache { |
| 40 class Backend; | 41 class Backend; |
| 41 class Entry; | 42 class Entry; |
| 42 } | 43 } |
| 43 | 44 |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 194 } | 195 } |
| 195 | 196 |
| 196 // HttpTransactionFactory implementation: | 197 // HttpTransactionFactory implementation: |
| 197 virtual int CreateTransaction(RequestPriority priority, | 198 virtual int CreateTransaction(RequestPriority priority, |
| 198 scoped_ptr<HttpTransaction>* trans) OVERRIDE; | 199 scoped_ptr<HttpTransaction>* trans) OVERRIDE; |
| 199 virtual HttpCache* GetCache() OVERRIDE; | 200 virtual HttpCache* GetCache() OVERRIDE; |
| 200 virtual HttpNetworkSession* GetSession() OVERRIDE; | 201 virtual HttpNetworkSession* GetSession() OVERRIDE; |
| 201 | 202 |
| 202 base::WeakPtr<HttpCache> GetWeakPtr() { return weak_factory_.GetWeakPtr(); } | 203 base::WeakPtr<HttpCache> GetWeakPtr() { return weak_factory_.GetWeakPtr(); } |
| 203 | 204 |
| 205 DiskBasedCertCache* CertCache() { | |
|
Ryan Sleevi
2014/06/26 19:56:02
1) This should be const
2) You should place it wit
| |
| 206 return cert_cache_.get(); | |
| 207 } | |
| 208 | |
| 204 // Resets the network layer to allow for tests that probe | 209 // Resets the network layer to allow for tests that probe |
| 205 // network changes (e.g. host unreachable). The old network layer is | 210 // network changes (e.g. host unreachable). The old network layer is |
| 206 // returned to allow for filter patterns that only intercept | 211 // returned to allow for filter patterns that only intercept |
| 207 // some creation requests. Note ownership exchange. | 212 // some creation requests. Note ownership exchange. |
| 208 scoped_ptr<HttpTransactionFactory> | 213 scoped_ptr<HttpTransactionFactory> |
| 209 SetHttpNetworkTransactionFactoryForTesting( | 214 SetHttpNetworkTransactionFactoryForTesting( |
| 210 scoped_ptr<HttpTransactionFactory> new_network_layer); | 215 scoped_ptr<HttpTransactionFactory> new_network_layer); |
| 211 | 216 |
| 212 private: | 217 private: |
| 213 // Types -------------------------------------------------------------------- | 218 // Types -------------------------------------------------------------------- |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 398 bool bypass_lock_for_test_; | 403 bool bypass_lock_for_test_; |
| 399 | 404 |
| 400 Mode mode_; | 405 Mode mode_; |
| 401 | 406 |
| 402 scoped_ptr<QuicServerInfoFactoryAdaptor> quic_server_info_factory_; | 407 scoped_ptr<QuicServerInfoFactoryAdaptor> quic_server_info_factory_; |
| 403 | 408 |
| 404 scoped_ptr<HttpTransactionFactory> network_layer_; | 409 scoped_ptr<HttpTransactionFactory> network_layer_; |
| 405 | 410 |
| 406 scoped_ptr<disk_cache::Backend> disk_cache_; | 411 scoped_ptr<disk_cache::Backend> disk_cache_; |
| 407 | 412 |
| 413 scoped_ptr<DiskBasedCertCache> cert_cache_; | |
| 414 | |
| 408 // The set of active entries indexed by cache key. | 415 // The set of active entries indexed by cache key. |
| 409 ActiveEntriesMap active_entries_; | 416 ActiveEntriesMap active_entries_; |
| 410 | 417 |
| 411 // The set of doomed entries. | 418 // The set of doomed entries. |
| 412 ActiveEntriesSet doomed_entries_; | 419 ActiveEntriesSet doomed_entries_; |
| 413 | 420 |
| 414 // The set of entries "under construction". | 421 // The set of entries "under construction". |
| 415 PendingOpsMap pending_ops_; | 422 PendingOpsMap pending_ops_; |
| 416 | 423 |
| 417 scoped_ptr<PlaybackCacheMap> playback_cache_map_; | 424 scoped_ptr<PlaybackCacheMap> playback_cache_map_; |
| 418 | 425 |
| 419 base::WeakPtrFactory<HttpCache> weak_factory_; | 426 base::WeakPtrFactory<HttpCache> weak_factory_; |
| 420 | 427 |
| 421 DISALLOW_COPY_AND_ASSIGN(HttpCache); | 428 DISALLOW_COPY_AND_ASSIGN(HttpCache); |
| 422 }; | 429 }; |
| 423 | 430 |
| 424 } // namespace net | 431 } // namespace net |
| 425 | 432 |
| 426 #endif // NET_HTTP_HTTP_CACHE_H_ | 433 #endif // NET_HTTP_HTTP_CACHE_H_ |
| OLD | NEW |