| 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 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 static bool ParseResponseInfo(const char* data, int len, | 171 static bool ParseResponseInfo(const char* data, int len, |
| 172 HttpResponseInfo* response_info, | 172 HttpResponseInfo* response_info, |
| 173 bool* response_truncated); | 173 bool* response_truncated); |
| 174 | 174 |
| 175 // Writes |buf_len| bytes of metadata stored in |buf| to the cache entry | 175 // Writes |buf_len| bytes of metadata stored in |buf| to the cache entry |
| 176 // referenced by |url|, as long as the entry's |expected_response_time| has | 176 // referenced by |url|, as long as the entry's |expected_response_time| has |
| 177 // not changed. This method returns without blocking, and the operation will | 177 // not changed. This method returns without blocking, and the operation will |
| 178 // be performed asynchronously without any completion notification. | 178 // be performed asynchronously without any completion notification. |
| 179 void WriteMetadata(const GURL& url, | 179 void WriteMetadata(const GURL& url, |
| 180 RequestPriority priority, | 180 RequestPriority priority, |
| 181 double expected_response_time, | 181 base::Time expected_response_time, |
| 182 IOBuffer* buf, | 182 IOBuffer* buf, |
| 183 int buf_len); | 183 int buf_len); |
| 184 | 184 |
| 185 // Get/Set the cache's mode. | 185 // Get/Set the cache's mode. |
| 186 void set_mode(Mode value) { mode_ = value; } | 186 void set_mode(Mode value) { mode_ = value; } |
| 187 Mode mode() { return mode_; } | 187 Mode mode() { return mode_; } |
| 188 | 188 |
| 189 // Get/Set the cache's clock. These are public only for testing. | 189 // Get/Set the cache's clock. These are public only for testing. |
| 190 void SetClockForTesting(scoped_ptr<base::Clock> clock) { | 190 void SetClockForTesting(scoped_ptr<base::Clock> clock) { |
| 191 clock_.reset(clock.release()); | 191 clock_.reset(clock.release()); |
| (...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 477 scoped_ptr<base::Clock> clock_; | 477 scoped_ptr<base::Clock> clock_; |
| 478 | 478 |
| 479 base::WeakPtrFactory<HttpCache> weak_factory_; | 479 base::WeakPtrFactory<HttpCache> weak_factory_; |
| 480 | 480 |
| 481 DISALLOW_COPY_AND_ASSIGN(HttpCache); | 481 DISALLOW_COPY_AND_ASSIGN(HttpCache); |
| 482 }; | 482 }; |
| 483 | 483 |
| 484 } // namespace net | 484 } // namespace net |
| 485 | 485 |
| 486 #endif // NET_HTTP_HTTP_CACHE_H_ | 486 #endif // NET_HTTP_HTTP_CACHE_H_ |
| OLD | NEW |