Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(79)

Side by Side Diff: net/http/http_cache.h

Issue 138513002: Plumb network stack information about existence of cached copy (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Share a bit of errorpage_browsertest.cc test code. Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 188
189 // Initializes the Infinite Cache, if selected by the field trial. 189 // Initializes the Infinite Cache, if selected by the field trial.
190 void InitializeInfiniteCache(const base::FilePath& path); 190 void InitializeInfiniteCache(const base::FilePath& path);
191 191
192 // HttpTransactionFactory implementation: 192 // HttpTransactionFactory implementation:
193 virtual int CreateTransaction(RequestPriority priority, 193 virtual int CreateTransaction(RequestPriority priority,
194 scoped_ptr<HttpTransaction>* trans) OVERRIDE; 194 scoped_ptr<HttpTransaction>* trans) OVERRIDE;
195 virtual HttpCache* GetCache() OVERRIDE; 195 virtual HttpCache* GetCache() OVERRIDE;
196 virtual HttpNetworkSession* GetSession() OVERRIDE; 196 virtual HttpNetworkSession* GetSession() OVERRIDE;
197 197
198 // Reset the network layer to allow for tests that probe
rvargas (doing something else) 2014/01/23 23:24:49 nit: resets
Randy Smith (Not in Mondays) 2014/01/25 21:11:31 Done.
199 // network changes (e.g. host unreachable). The old network layer is
200 // returned to allow for filter patterns that only intercept
201 // some creation requests. Note ownership exchange.
202 scoped_ptr<HttpTransactionFactory> SetNetworkLayerForTesting(
203 scoped_ptr<HttpTransactionFactory> new_network_layer);
204
198 protected: 205 protected:
199 // Disk cache entry data indices. 206 // Disk cache entry data indices.
200 enum { 207 enum {
201 kResponseInfoIndex = 0, 208 kResponseInfoIndex = 0,
202 kResponseContentIndex, 209 kResponseContentIndex,
203 kMetadataIndex, 210 kMetadataIndex,
204 211
205 // Must remain at the end of the enum. 212 // Must remain at the end of the enum.
206 kNumCacheEntryDataIndices 213 kNumCacheEntryDataIndices
207 }; 214 };
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 NetLog* net_log_; 384 NetLog* net_log_;
378 385
379 // Used when lazily constructing the disk_cache_. 386 // Used when lazily constructing the disk_cache_.
380 scoped_ptr<BackendFactory> backend_factory_; 387 scoped_ptr<BackendFactory> backend_factory_;
381 bool building_backend_; 388 bool building_backend_;
382 389
383 Mode mode_; 390 Mode mode_;
384 391
385 const scoped_ptr<SSLHostInfoFactoryAdaptor> ssl_host_info_factory_; 392 const scoped_ptr<SSLHostInfoFactoryAdaptor> ssl_host_info_factory_;
386 393
387 const scoped_ptr<HttpTransactionFactory> network_layer_; 394 scoped_ptr<HttpTransactionFactory> network_layer_;
395
388 scoped_ptr<disk_cache::Backend> disk_cache_; 396 scoped_ptr<disk_cache::Backend> disk_cache_;
389 397
390 // The set of active entries indexed by cache key. 398 // The set of active entries indexed by cache key.
391 ActiveEntriesMap active_entries_; 399 ActiveEntriesMap active_entries_;
392 400
393 // The set of doomed entries. 401 // The set of doomed entries.
394 ActiveEntriesSet doomed_entries_; 402 ActiveEntriesSet doomed_entries_;
395 403
396 // The set of entries "under construction". 404 // The set of entries "under construction".
397 PendingOpsMap pending_ops_; 405 PendingOpsMap pending_ops_;
398 406
399 scoped_ptr<PlaybackCacheMap> playback_cache_map_; 407 scoped_ptr<PlaybackCacheMap> playback_cache_map_;
400 408
401 DISALLOW_COPY_AND_ASSIGN(HttpCache); 409 DISALLOW_COPY_AND_ASSIGN(HttpCache);
402 }; 410 };
403 411
404 } // namespace net 412 } // namespace net
405 413
406 #endif // NET_HTTP_HTTP_CACHE_H_ 414 #endif // NET_HTTP_HTTP_CACHE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698