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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 HttpCache(HttpNetworkSession* session, BackendFactory* backend_factory); | 137 HttpCache(HttpNetworkSession* session, BackendFactory* backend_factory); |
138 | 138 |
139 // Initialize the cache from its component parts, which is useful for | 139 // Initialize the cache from its component parts, which is useful for |
140 // testing. The lifetime of the network_layer and backend_factory are managed | 140 // testing. The lifetime of the network_layer and backend_factory are managed |
141 // by the HttpCache and will be destroyed using |delete| when the HttpCache is | 141 // by the HttpCache and will be destroyed using |delete| when the HttpCache is |
142 // destroyed. | 142 // destroyed. |
143 HttpCache(HttpTransactionFactory* network_layer, | 143 HttpCache(HttpTransactionFactory* network_layer, |
144 NetLog* net_log, | 144 NetLog* net_log, |
145 BackendFactory* backend_factory); | 145 BackendFactory* backend_factory); |
146 | 146 |
147 ~HttpCache(); | 147 virtual ~HttpCache(); |
148 | 148 |
149 HttpTransactionFactory* network_layer() { return network_layer_.get(); } | 149 HttpTransactionFactory* network_layer() { return network_layer_.get(); } |
150 | 150 |
151 // Retrieves the cache backend for this HttpCache instance. If the backend | 151 // Retrieves the cache backend for this HttpCache instance. If the backend |
152 // is not initialized yet, this method will initialize it. The return value is | 152 // is not initialized yet, this method will initialize it. The return value is |
153 // a network error code, and it could be ERR_IO_PENDING, in which case the | 153 // a network error code, and it could be ERR_IO_PENDING, in which case the |
154 // |callback| will be notified when the operation completes. The pointer that | 154 // |callback| will be notified when the operation completes. The pointer that |
155 // receives the |backend| must remain valid until the operation completes. | 155 // receives the |backend| must remain valid until the operation completes. |
156 int GetBackend(disk_cache::Backend** backend, CompletionCallback* callback); | 156 int GetBackend(disk_cache::Backend** backend, CompletionCallback* callback); |
157 | 157 |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
373 ScopedRunnableMethodFactory<HttpCache> task_factory_; | 373 ScopedRunnableMethodFactory<HttpCache> task_factory_; |
374 | 374 |
375 scoped_ptr<PlaybackCacheMap> playback_cache_map_; | 375 scoped_ptr<PlaybackCacheMap> playback_cache_map_; |
376 | 376 |
377 DISALLOW_COPY_AND_ASSIGN(HttpCache); | 377 DISALLOW_COPY_AND_ASSIGN(HttpCache); |
378 }; | 378 }; |
379 | 379 |
380 } // namespace net | 380 } // namespace net |
381 | 381 |
382 #endif // NET_HTTP_HTTP_CACHE_H_ | 382 #endif // NET_HTTP_HTTP_CACHE_H_ |
OLD | NEW |