| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 // testing. The lifetime of the network_layer and disk_cache are managed by | 86 // testing. The lifetime of the network_layer and disk_cache are managed by |
| 87 // the HttpCache and will be destroyed using |delete| when the HttpCache is | 87 // the HttpCache and will be destroyed using |delete| when the HttpCache is |
| 88 // destroyed. | 88 // destroyed. |
| 89 HttpCache(HttpTransactionFactory* network_layer, | 89 HttpCache(HttpTransactionFactory* network_layer, |
| 90 disk_cache::Backend* disk_cache); | 90 disk_cache::Backend* disk_cache); |
| 91 | 91 |
| 92 HttpTransactionFactory* network_layer() { return network_layer_.get(); } | 92 HttpTransactionFactory* network_layer() { return network_layer_.get(); } |
| 93 disk_cache::Backend* disk_cache() { return disk_cache_.get(); } | 93 disk_cache::Backend* disk_cache() { return disk_cache_.get(); } |
| 94 | 94 |
| 95 // HttpTransactionFactory implementation: | 95 // HttpTransactionFactory implementation: |
| 96 virtual HttpTransaction* CreateTransaction(); | 96 virtual int CreateTransaction(scoped_ptr<HttpTransaction>* trans); |
| 97 virtual HttpCache* GetCache(); | 97 virtual HttpCache* GetCache(); |
| 98 virtual void Suspend(bool suspend); | 98 virtual void Suspend(bool suspend); |
| 99 | 99 |
| 100 // Helper function for reading response info from the disk cache. If the | 100 // Helper function for reading response info from the disk cache. If the |
| 101 // cache doesn't have the whole resource *|request_truncated| is set to true. | 101 // cache doesn't have the whole resource *|request_truncated| is set to true. |
| 102 static bool ReadResponseInfo(disk_cache::Entry* disk_entry, | 102 static bool ReadResponseInfo(disk_cache::Entry* disk_entry, |
| 103 HttpResponseInfo* response_info, | 103 HttpResponseInfo* response_info, |
| 104 bool* response_truncated); | 104 bool* response_truncated); |
| 105 | 105 |
| 106 // Helper function for writing response info into the disk cache. If the | 106 // Helper function for writing response info into the disk cache. If the |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 scoped_ptr<PlaybackCacheMap> playback_cache_map_; | 207 scoped_ptr<PlaybackCacheMap> playback_cache_map_; |
| 208 | 208 |
| 209 RevocableStore transactions_; | 209 RevocableStore transactions_; |
| 210 | 210 |
| 211 DISALLOW_COPY_AND_ASSIGN(HttpCache); | 211 DISALLOW_COPY_AND_ASSIGN(HttpCache); |
| 212 }; | 212 }; |
| 213 | 213 |
| 214 } // namespace net | 214 } // namespace net |
| 215 | 215 |
| 216 #endif // NET_HTTP_HTTP_CACHE_H_ | 216 #endif // NET_HTTP_HTTP_CACHE_H_ |
| OLD | NEW |