OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 | 175 |
176 // Close currently active sockets so that fresh page loads will not use any | 176 // Close currently active sockets so that fresh page loads will not use any |
177 // recycled connections. For sockets currently in use, they may not close | 177 // recycled connections. For sockets currently in use, they may not close |
178 // immediately, but they will not be reusable. This is for debugging. | 178 // immediately, but they will not be reusable. This is for debugging. |
179 void CloseAllConnections(); | 179 void CloseAllConnections(); |
180 | 180 |
181 // HttpTransactionFactory implementation: | 181 // HttpTransactionFactory implementation: |
182 virtual int CreateTransaction(scoped_ptr<HttpTransaction>* trans); | 182 virtual int CreateTransaction(scoped_ptr<HttpTransaction>* trans); |
183 virtual HttpCache* GetCache(); | 183 virtual HttpCache* GetCache(); |
184 virtual HttpNetworkSession* GetSession(); | 184 virtual HttpNetworkSession* GetSession(); |
185 virtual void Suspend(bool suspend); | |
186 | 185 |
187 protected: | 186 protected: |
188 // Disk cache entry data indices. | 187 // Disk cache entry data indices. |
189 enum { | 188 enum { |
190 kResponseInfoIndex = 0, | 189 kResponseInfoIndex = 0, |
191 kResponseContentIndex, | 190 kResponseContentIndex, |
192 kMetadataIndex, | 191 kMetadataIndex, |
193 | 192 |
194 // Must remain at the end of the enum. | 193 // Must remain at the end of the enum. |
195 kNumCacheEntryDataIndices | 194 kNumCacheEntryDataIndices |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
373 ScopedRunnableMethodFactory<HttpCache> task_factory_; | 372 ScopedRunnableMethodFactory<HttpCache> task_factory_; |
374 | 373 |
375 scoped_ptr<PlaybackCacheMap> playback_cache_map_; | 374 scoped_ptr<PlaybackCacheMap> playback_cache_map_; |
376 | 375 |
377 DISALLOW_COPY_AND_ASSIGN(HttpCache); | 376 DISALLOW_COPY_AND_ASSIGN(HttpCache); |
378 }; | 377 }; |
379 | 378 |
380 } // namespace net | 379 } // namespace net |
381 | 380 |
382 #endif // NET_HTTP_HTTP_CACHE_H_ | 381 #endif // NET_HTTP_HTTP_CACHE_H_ |
OLD | NEW |