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

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

Issue 8526006: Close idle sockets next time we are about to send data. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: code conventions Created 9 years, 1 month 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
OLDNEW
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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 // Record mode caches everything for purposes of offline playback. 70 // Record mode caches everything for purposes of offline playback.
71 RECORD, 71 RECORD,
72 // Playback mode replays from a cache without considering any 72 // Playback mode replays from a cache without considering any
73 // standard invalidations. 73 // standard invalidations.
74 PLAYBACK, 74 PLAYBACK,
75 // Disables reads and writes from the cache. 75 // Disables reads and writes from the cache.
76 // Equivalent to setting LOAD_DISABLE_CACHE on every request. 76 // Equivalent to setting LOAD_DISABLE_CACHE on every request.
77 DISABLE 77 DISABLE
78 }; 78 };
79 79
80 // The idle socket cleanup mode of operation.
81 enum IdleSocketCleanupMode {
82 // Cleanup idle sockets using a timer.
83 USE_CLEANUP_TIMER = 0,
84 // Defer cleaning up idle sockets until next request.
85 DEFER_IDLE_CLEANUP
86 };
87
80 // A BackendFactory creates a backend object to be used by the HttpCache. 88 // A BackendFactory creates a backend object to be used by the HttpCache.
81 class NET_EXPORT BackendFactory { 89 class NET_EXPORT BackendFactory {
82 public: 90 public:
83 virtual ~BackendFactory() {} 91 virtual ~BackendFactory() {}
84 92
85 // The actual method to build the backend. Returns a net error code. If 93 // The actual method to build the backend. Returns a net error code. If
86 // ERR_IO_PENDING is returned, the |callback| will be notified when the 94 // ERR_IO_PENDING is returned, the |callback| will be notified when the
87 // operation completes, and |backend| must remain valid until the 95 // operation completes, and |backend| must remain valid until the
88 // notification arrives. 96 // notification arrives.
89 // The implementation must not access the factory object after invoking the 97 // The implementation must not access the factory object after invoking the
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 CertVerifier* cert_verifier, 132 CertVerifier* cert_verifier,
125 OriginBoundCertService* origin_bound_cert_service, 133 OriginBoundCertService* origin_bound_cert_service,
126 DnsRRResolver* dnsrr_resolver, 134 DnsRRResolver* dnsrr_resolver,
127 DnsCertProvenanceChecker* dns_cert_checker, 135 DnsCertProvenanceChecker* dns_cert_checker,
128 ProxyService* proxy_service, 136 ProxyService* proxy_service,
129 SSLConfigService* ssl_config_service, 137 SSLConfigService* ssl_config_service,
130 HttpAuthHandlerFactory* http_auth_handler_factory, 138 HttpAuthHandlerFactory* http_auth_handler_factory,
131 NetworkDelegate* network_delegate, 139 NetworkDelegate* network_delegate,
132 HttpServerProperties* http_server_properties, 140 HttpServerProperties* http_server_properties,
133 NetLog* net_log, 141 NetLog* net_log,
134 BackendFactory* backend_factory); 142 BackendFactory* backend_factory,
143 IdleSocketCleanupMode cleanup_mode = USE_CLEANUP_TIMER);
willchan no longer on Chromium 2011/11/15 20:35:29 default args are not allowed by the style guide
135 144
136 // The disk cache is initialized lazily (by CreateTransaction) in this case. 145 // The disk cache is initialized lazily (by CreateTransaction) in this case.
137 // Provide an existing HttpNetworkSession, the cache can construct a 146 // Provide an existing HttpNetworkSession, the cache can construct a
138 // network layer with a shared HttpNetworkSession in order for multiple 147 // network layer with a shared HttpNetworkSession in order for multiple
139 // network layers to share information (e.g. authentication data). The 148 // network layers to share information (e.g. authentication data). The
140 // HttpCache takes ownership of the |backend_factory|. 149 // HttpCache takes ownership of the |backend_factory|.
141 HttpCache(HttpNetworkSession* session, BackendFactory* backend_factory); 150 HttpCache(HttpNetworkSession* session, BackendFactory* backend_factory);
142 151
143 // Initialize the cache from its component parts, which is useful for 152 // Initialize the cache from its component parts, which is useful for
144 // testing. The lifetime of the network_layer and backend_factory are managed 153 // testing. The lifetime of the network_layer and backend_factory are managed
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 PendingOpsMap pending_ops_; 390 PendingOpsMap pending_ops_;
382 391
383 scoped_ptr<PlaybackCacheMap> playback_cache_map_; 392 scoped_ptr<PlaybackCacheMap> playback_cache_map_;
384 393
385 DISALLOW_COPY_AND_ASSIGN(HttpCache); 394 DISALLOW_COPY_AND_ASSIGN(HttpCache);
386 }; 395 };
387 396
388 } // namespace net 397 } // namespace net
389 398
390 #endif // NET_HTTP_HTTP_CACHE_H_ 399 #endif // NET_HTTP_HTTP_CACHE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698