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

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

Issue 6402002: Simplify HttpCache/HttpNetworkLayer/HttpNetworkSession interaction. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix nits. Created 9 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
« no previous file with comments | « net/http/http_cache.h ('k') | net/http/http_network_layer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 #include "net/http/http_cache.h" 5 #include "net/http/http_cache.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 10
(...skipping 15 matching lines...) Expand all
26 #include "net/base/net_errors.h" 26 #include "net/base/net_errors.h"
27 #include "net/disk_cache/disk_cache.h" 27 #include "net/disk_cache/disk_cache.h"
28 #include "net/http/disk_cache_based_ssl_host_info.h" 28 #include "net/http/disk_cache_based_ssl_host_info.h"
29 #include "net/http/http_cache_transaction.h" 29 #include "net/http/http_cache_transaction.h"
30 #include "net/http/http_network_layer.h" 30 #include "net/http/http_network_layer.h"
31 #include "net/http/http_network_session.h" 31 #include "net/http/http_network_session.h"
32 #include "net/http/http_request_info.h" 32 #include "net/http/http_request_info.h"
33 #include "net/http/http_response_headers.h" 33 #include "net/http/http_response_headers.h"
34 #include "net/http/http_response_info.h" 34 #include "net/http/http_response_info.h"
35 #include "net/http/http_util.h" 35 #include "net/http/http_util.h"
36 #include "net/socket/client_socket_factory.h"
36 #include "net/socket/ssl_host_info.h" 37 #include "net/socket/ssl_host_info.h"
37 #include "net/spdy/spdy_session_pool.h" 38 #include "net/spdy/spdy_session_pool.h"
38 39
39 namespace net { 40 namespace net {
40 41
41 HttpCache::DefaultBackend::DefaultBackend(CacheType type, 42 HttpCache::DefaultBackend::DefaultBackend(CacheType type,
42 const FilePath& path, 43 const FilePath& path,
43 int max_bytes, 44 int max_bytes,
44 base::MessageLoopProxy* thread) 45 base::MessageLoopProxy* thread)
45 : type_(type), 46 : type_(type),
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 SSLHostInfo* GetForHost(const std::string& hostname, 272 SSLHostInfo* GetForHost(const std::string& hostname,
272 const SSLConfig& ssl_config) { 273 const SSLConfig& ssl_config) {
273 return new DiskCacheBasedSSLHostInfo(hostname, ssl_config, http_cache_); 274 return new DiskCacheBasedSSLHostInfo(hostname, ssl_config, http_cache_);
274 } 275 }
275 276
276 private: 277 private:
277 HttpCache* const http_cache_; 278 HttpCache* const http_cache_;
278 }; 279 };
279 280
280 //----------------------------------------------------------------------------- 281 //-----------------------------------------------------------------------------
281
282 HttpCache::HttpCache(HostResolver* host_resolver, 282 HttpCache::HttpCache(HostResolver* host_resolver,
283 CertVerifier* cert_verifier, 283 CertVerifier* cert_verifier,
284 DnsRRResolver* dnsrr_resolver, 284 DnsRRResolver* dnsrr_resolver,
285 DnsCertProvenanceChecker* dns_cert_checker_, 285 DnsCertProvenanceChecker* dns_cert_checker_,
286 ProxyService* proxy_service, 286 ProxyService* proxy_service,
287 SSLConfigService* ssl_config_service, 287 SSLConfigService* ssl_config_service,
288 HttpAuthHandlerFactory* http_auth_handler_factory, 288 HttpAuthHandlerFactory* http_auth_handler_factory,
289 HttpNetworkDelegate* network_delegate, 289 HttpNetworkDelegate* network_delegate,
290 NetLog* net_log, 290 NetLog* net_log,
291 BackendFactory* backend_factory) 291 BackendFactory* backend_factory)
292 : net_log_(net_log), 292 : net_log_(net_log),
293 backend_factory_(backend_factory), 293 backend_factory_(backend_factory),
294 building_backend_(false), 294 building_backend_(false),
295 mode_(NORMAL), 295 mode_(NORMAL),
296 ssl_host_info_factory_(new SSLHostInfoFactoryAdaptor( 296 ssl_host_info_factory_(new SSLHostInfoFactoryAdaptor(
297 ALLOW_THIS_IN_INITIALIZER_LIST(this))), 297 ALLOW_THIS_IN_INITIALIZER_LIST(this))),
298 network_layer_(HttpNetworkLayer::CreateFactory(host_resolver, 298 network_layer_(
299 cert_verifier, dnsrr_resolver, dns_cert_checker_, 299 new HttpNetworkLayer(
300 ssl_host_info_factory_.get(), 300 new HttpNetworkSession(
301 proxy_service, ssl_config_service, 301 host_resolver,
302 http_auth_handler_factory, network_delegate, net_log)), 302 cert_verifier,
303 dnsrr_resolver,
304 dns_cert_checker_,
305 ssl_host_info_factory_.get(),
306 proxy_service,
307 ClientSocketFactory::GetDefaultFactory(),
308 ssl_config_service,
309 new SpdySessionPool(ssl_config_service),
310 http_auth_handler_factory,
311 network_delegate,
312 net_log))),
303 ALLOW_THIS_IN_INITIALIZER_LIST(task_factory_(this)) { 313 ALLOW_THIS_IN_INITIALIZER_LIST(task_factory_(this)) {
304 } 314 }
305 315
316
306 HttpCache::HttpCache(HttpNetworkSession* session, 317 HttpCache::HttpCache(HttpNetworkSession* session,
307 BackendFactory* backend_factory) 318 BackendFactory* backend_factory)
308 : net_log_(session->net_log()), 319 : net_log_(session->net_log()),
309 backend_factory_(backend_factory), 320 backend_factory_(backend_factory),
310 building_backend_(false), 321 building_backend_(false),
311 mode_(NORMAL), 322 mode_(NORMAL),
312 network_layer_(HttpNetworkLayer::CreateFactory(session)), 323 ssl_host_info_factory_(new SSLHostInfoFactoryAdaptor(
324 ALLOW_THIS_IN_INITIALIZER_LIST(this))),
325 network_layer_(new HttpNetworkLayer(session)),
313 ALLOW_THIS_IN_INITIALIZER_LIST(task_factory_(this)) { 326 ALLOW_THIS_IN_INITIALIZER_LIST(task_factory_(this)) {
314 } 327 }
315 328
316 HttpCache::HttpCache(HttpTransactionFactory* network_layer, 329 HttpCache::HttpCache(HttpTransactionFactory* network_layer,
317 NetLog* net_log, 330 NetLog* net_log,
318 BackendFactory* backend_factory) 331 BackendFactory* backend_factory)
319 : net_log_(net_log), 332 : net_log_(net_log),
320 backend_factory_(backend_factory), 333 backend_factory_(backend_factory),
321 building_backend_(false), 334 building_backend_(false),
322 mode_(NORMAL), 335 mode_(NORMAL),
(...skipping 770 matching lines...) Expand 10 before | Expand all | Expand 10 after
1093 building_backend_ = false; 1106 building_backend_ = false;
1094 DeletePendingOp(pending_op); 1107 DeletePendingOp(pending_op);
1095 } 1108 }
1096 1109
1097 // The cache may be gone when we return from the callback. 1110 // The cache may be gone when we return from the callback.
1098 if (!item->DoCallback(result, backend)) 1111 if (!item->DoCallback(result, backend))
1099 item->NotifyTransaction(result, NULL); 1112 item->NotifyTransaction(result, NULL);
1100 } 1113 }
1101 1114
1102 } // namespace net 1115 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_cache.h ('k') | net/http/http_network_layer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698