| 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 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 base::Time expected_response_time, | 174 base::Time expected_response_time, |
| 175 IOBuffer* buf, | 175 IOBuffer* buf, |
| 176 int buf_len); | 176 int buf_len); |
| 177 | 177 |
| 178 // Get/Set the cache's mode. | 178 // Get/Set the cache's mode. |
| 179 void set_mode(Mode value) { mode_ = value; } | 179 void set_mode(Mode value) { mode_ = value; } |
| 180 Mode mode() { return mode_; } | 180 Mode mode() { return mode_; } |
| 181 | 181 |
| 182 // Get/Set the cache's clock. These are public only for testing. | 182 // Get/Set the cache's clock. These are public only for testing. |
| 183 void SetClockForTesting(std::unique_ptr<base::Clock> clock) { | 183 void SetClockForTesting(std::unique_ptr<base::Clock> clock) { |
| 184 clock_.reset(clock.release()); | 184 clock_ = std::move(clock); |
| 185 } | 185 } |
| 186 base::Clock* clock() const { return clock_.get(); } | 186 base::Clock* clock() const { return clock_.get(); } |
| 187 | 187 |
| 188 // Close currently active sockets so that fresh page loads will not use any | 188 // Close currently active sockets so that fresh page loads will not use any |
| 189 // recycled connections. For sockets currently in use, they may not close | 189 // recycled connections. For sockets currently in use, they may not close |
| 190 // immediately, but they will not be reusable. This is for debugging. | 190 // immediately, but they will not be reusable. This is for debugging. |
| 191 void CloseAllConnections(); | 191 void CloseAllConnections(); |
| 192 | 192 |
| 193 // Close all idle connections. Will close all sockets not in active use. | 193 // Close all idle connections. Will close all sockets not in active use. |
| 194 void CloseIdleConnections(); | 194 void CloseIdleConnections(); |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 432 std::unique_ptr<base::Clock> clock_; | 432 std::unique_ptr<base::Clock> clock_; |
| 433 | 433 |
| 434 base::WeakPtrFactory<HttpCache> weak_factory_; | 434 base::WeakPtrFactory<HttpCache> weak_factory_; |
| 435 | 435 |
| 436 DISALLOW_COPY_AND_ASSIGN(HttpCache); | 436 DISALLOW_COPY_AND_ASSIGN(HttpCache); |
| 437 }; | 437 }; |
| 438 | 438 |
| 439 } // namespace net | 439 } // namespace net |
| 440 | 440 |
| 441 #endif // NET_HTTP_HTTP_CACHE_H_ | 441 #endif // NET_HTTP_HTTP_CACHE_H_ |
| OLD | NEW |