Chromium Code Reviews| 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 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 172 | 172 |
| 173 // Get/Set the cache's mode. | 173 // Get/Set the cache's mode. |
| 174 void set_mode(Mode value) { mode_ = value; } | 174 void set_mode(Mode value) { mode_ = value; } |
| 175 Mode mode() { return mode_; } | 175 Mode mode() { return mode_; } |
| 176 | 176 |
| 177 // Close currently active sockets so that fresh page loads will not use any | 177 // Close currently active sockets so that fresh page loads will not use any |
| 178 // recycled connections. For sockets currently in use, they may not close | 178 // recycled connections. For sockets currently in use, they may not close |
| 179 // immediately, but they will not be reusable. This is for debugging. | 179 // immediately, but they will not be reusable. This is for debugging. |
| 180 void CloseAllConnections(); | 180 void CloseAllConnections(); |
| 181 | 181 |
| 182 // Indicates that the renderer's memory cache hit the resource specified by | |
|
rvargas (doing something else)
2011/07/28 22:27:01
What is the renderer's memory cache?
| |
| 183 // |url|. Propagate that cache hit to our http cache, so that frequently used | |
| 184 // resources stay in the disk cache too. | |
| 185 void OnExternalCacheHit(const GURL& url, const std::string& http_method); | |
| 186 | |
| 182 // HttpTransactionFactory implementation: | 187 // HttpTransactionFactory implementation: |
| 183 virtual int CreateTransaction(scoped_ptr<HttpTransaction>* trans); | 188 virtual int CreateTransaction(scoped_ptr<HttpTransaction>* trans); |
| 184 virtual HttpCache* GetCache(); | 189 virtual HttpCache* GetCache(); |
| 185 virtual HttpNetworkSession* GetSession(); | 190 virtual HttpNetworkSession* GetSession(); |
| 186 | 191 |
| 187 protected: | 192 protected: |
| 188 // Disk cache entry data indices. | 193 // Disk cache entry data indices. |
| 189 enum { | 194 enum { |
| 190 kResponseInfoIndex = 0, | 195 kResponseInfoIndex = 0, |
| 191 kResponseContentIndex, | 196 kResponseContentIndex, |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 338 void OnProcessPendingQueue(ActiveEntry* entry); | 343 void OnProcessPendingQueue(ActiveEntry* entry); |
| 339 | 344 |
| 340 // Callbacks ---------------------------------------------------------------- | 345 // Callbacks ---------------------------------------------------------------- |
| 341 | 346 |
| 342 // Processes BackendCallback notifications. | 347 // Processes BackendCallback notifications. |
| 343 void OnIOComplete(int result, PendingOp* entry); | 348 void OnIOComplete(int result, PendingOp* entry); |
| 344 | 349 |
| 345 // Processes the backend creation notification. | 350 // Processes the backend creation notification. |
| 346 void OnBackendCreated(int result, PendingOp* pending_op); | 351 void OnBackendCreated(int result, PendingOp* pending_op); |
| 347 | 352 |
| 348 | |
| 349 // Variables ---------------------------------------------------------------- | 353 // Variables ---------------------------------------------------------------- |
| 350 | 354 |
| 351 NetLog* net_log_; | 355 NetLog* net_log_; |
| 352 | 356 |
| 353 // Used when lazily constructing the disk_cache_. | 357 // Used when lazily constructing the disk_cache_. |
| 354 scoped_ptr<BackendFactory> backend_factory_; | 358 scoped_ptr<BackendFactory> backend_factory_; |
| 355 bool building_backend_; | 359 bool building_backend_; |
| 356 | 360 |
| 357 Mode mode_; | 361 Mode mode_; |
| 358 | 362 |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 373 ScopedRunnableMethodFactory<HttpCache> task_factory_; | 377 ScopedRunnableMethodFactory<HttpCache> task_factory_; |
| 374 | 378 |
| 375 scoped_ptr<PlaybackCacheMap> playback_cache_map_; | 379 scoped_ptr<PlaybackCacheMap> playback_cache_map_; |
| 376 | 380 |
| 377 DISALLOW_COPY_AND_ASSIGN(HttpCache); | 381 DISALLOW_COPY_AND_ASSIGN(HttpCache); |
| 378 }; | 382 }; |
| 379 | 383 |
| 380 } // namespace net | 384 } // namespace net |
| 381 | 385 |
| 382 #endif // NET_HTTP_HTTP_CACHE_H_ | 386 #endif // NET_HTTP_HTTP_CACHE_H_ |
| OLD | NEW |