| 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 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 // immediately, but they will not be reusable. This is for debugging. | 181 // immediately, but they will not be reusable. This is for debugging. |
| 182 void CloseAllConnections(); | 182 void CloseAllConnections(); |
| 183 | 183 |
| 184 // Close all idle connections. Will close all sockets not in active use. | 184 // Close all idle connections. Will close all sockets not in active use. |
| 185 void CloseIdleConnections(); | 185 void CloseIdleConnections(); |
| 186 | 186 |
| 187 // Called whenever an external cache in the system reuses the resource | 187 // Called whenever an external cache in the system reuses the resource |
| 188 // referred to by |url| and |http_method|. | 188 // referred to by |url| and |http_method|. |
| 189 void OnExternalCacheHit(const GURL& url, const std::string& http_method); | 189 void OnExternalCacheHit(const GURL& url, const std::string& http_method); |
| 190 | 190 |
| 191 // Causes all transactions created after this point to effectively bypass | 191 // Causes all transactions created after this point to simulate lock timeout |
| 192 // the cache lock whenever there is lock contention. | 192 // and effectively bypass the cache lock whenever there is lock contention. |
| 193 void BypassLockForTest() { | 193 void SimulateCacheLockTimeout() { bypass_lock_for_test_ = true; } |
| 194 bypass_lock_for_test_ = true; | |
| 195 } | |
| 196 | 194 |
| 197 // Causes all transactions created after this point to generate a failure | 195 // Causes all transactions created after this point to generate a failure |
| 198 // when attempting to conditionalize a network request. | 196 // when attempting to conditionalize a network request. |
| 199 void FailConditionalizationForTest() { | 197 void FailConditionalizationForTest() { |
| 200 fail_conditionalization_for_test_ = true; | 198 fail_conditionalization_for_test_ = true; |
| 201 } | 199 } |
| 202 | 200 |
| 203 // HttpTransactionFactory implementation: | 201 // HttpTransactionFactory implementation: |
| 204 int CreateTransaction(RequestPriority priority, | 202 int CreateTransaction(RequestPriority priority, |
| 205 std::unique_ptr<HttpTransaction>* trans) override; | 203 std::unique_ptr<HttpTransaction>* trans) override; |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 423 std::unique_ptr<base::Clock> clock_; | 421 std::unique_ptr<base::Clock> clock_; |
| 424 | 422 |
| 425 base::WeakPtrFactory<HttpCache> weak_factory_; | 423 base::WeakPtrFactory<HttpCache> weak_factory_; |
| 426 | 424 |
| 427 DISALLOW_COPY_AND_ASSIGN(HttpCache); | 425 DISALLOW_COPY_AND_ASSIGN(HttpCache); |
| 428 }; | 426 }; |
| 429 | 427 |
| 430 } // namespace net | 428 } // namespace net |
| 431 | 429 |
| 432 #endif // NET_HTTP_HTTP_CACHE_H_ | 430 #endif // NET_HTTP_HTTP_CACHE_H_ |
| OLD | NEW |