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

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

Issue 2363003: Rework the logging for sockets/connectjobs.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 6 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_network_layer.h ('k') | net/http/http_network_layer_unittest.cc » ('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_network_layer.h" 5 #include "net/http/http_network_layer.h"
6 6
7 #include "base/field_trial.h" 7 #include "base/field_trial.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "net/http/http_network_session.h" 10 #include "net/http/http_network_session.h"
11 #include "net/http/http_network_transaction.h" 11 #include "net/http/http_network_transaction.h"
12 #include "net/socket/client_socket_factory.h" 12 #include "net/socket/client_socket_factory.h"
13 #include "net/spdy/spdy_framer.h" 13 #include "net/spdy/spdy_framer.h"
14 #include "net/spdy/spdy_network_transaction.h" 14 #include "net/spdy/spdy_network_transaction.h"
15 #include "net/spdy/spdy_session.h" 15 #include "net/spdy/spdy_session.h"
16 #include "net/spdy/spdy_session_pool.h" 16 #include "net/spdy/spdy_session_pool.h"
17 17
18 namespace net { 18 namespace net {
19 19
20 //----------------------------------------------------------------------------- 20 //-----------------------------------------------------------------------------
21 21
22 // static 22 // static
23 HttpTransactionFactory* HttpNetworkLayer::CreateFactory( 23 HttpTransactionFactory* HttpNetworkLayer::CreateFactory(
24 NetworkChangeNotifier* network_change_notifier, 24 NetworkChangeNotifier* network_change_notifier,
25 HostResolver* host_resolver, 25 HostResolver* host_resolver,
26 ProxyService* proxy_service, 26 ProxyService* proxy_service,
27 SSLConfigService* ssl_config_service, 27 SSLConfigService* ssl_config_service,
28 HttpAuthHandlerFactory* http_auth_handler_factory) { 28 HttpAuthHandlerFactory* http_auth_handler_factory,
29 NetLog* net_log) {
29 DCHECK(proxy_service); 30 DCHECK(proxy_service);
30 31
31 return new HttpNetworkLayer(ClientSocketFactory::GetDefaultFactory(), 32 return new HttpNetworkLayer(ClientSocketFactory::GetDefaultFactory(),
32 network_change_notifier, 33 network_change_notifier,
33 host_resolver, proxy_service, ssl_config_service, 34 host_resolver, proxy_service, ssl_config_service,
34 http_auth_handler_factory); 35 http_auth_handler_factory,
36 net_log);
35 } 37 }
36 38
37 // static 39 // static
38 HttpTransactionFactory* HttpNetworkLayer::CreateFactory( 40 HttpTransactionFactory* HttpNetworkLayer::CreateFactory(
39 HttpNetworkSession* session) { 41 HttpNetworkSession* session) {
40 DCHECK(session); 42 DCHECK(session);
41 43
42 return new HttpNetworkLayer(session); 44 return new HttpNetworkLayer(session);
43 } 45 }
44 46
45 //----------------------------------------------------------------------------- 47 //-----------------------------------------------------------------------------
46 bool HttpNetworkLayer::force_spdy_ = false; 48 bool HttpNetworkLayer::force_spdy_ = false;
47 49
48 HttpNetworkLayer::HttpNetworkLayer( 50 HttpNetworkLayer::HttpNetworkLayer(
49 ClientSocketFactory* socket_factory, 51 ClientSocketFactory* socket_factory,
50 NetworkChangeNotifier* network_change_notifier, 52 NetworkChangeNotifier* network_change_notifier,
51 HostResolver* host_resolver, 53 HostResolver* host_resolver,
52 ProxyService* proxy_service, 54 ProxyService* proxy_service,
53 SSLConfigService* ssl_config_service, 55 SSLConfigService* ssl_config_service,
54 HttpAuthHandlerFactory* http_auth_handler_factory) 56 HttpAuthHandlerFactory* http_auth_handler_factory,
57 NetLog* net_log)
55 : socket_factory_(socket_factory), 58 : socket_factory_(socket_factory),
56 network_change_notifier_(network_change_notifier), 59 network_change_notifier_(network_change_notifier),
57 host_resolver_(host_resolver), 60 host_resolver_(host_resolver),
58 proxy_service_(proxy_service), 61 proxy_service_(proxy_service),
59 ssl_config_service_(ssl_config_service), 62 ssl_config_service_(ssl_config_service),
60 session_(NULL), 63 session_(NULL),
61 spdy_session_pool_(NULL), 64 spdy_session_pool_(NULL),
62 http_auth_handler_factory_(http_auth_handler_factory), 65 http_auth_handler_factory_(http_auth_handler_factory),
66 net_log_(net_log),
63 suspended_(false) { 67 suspended_(false) {
64 DCHECK(proxy_service_); 68 DCHECK(proxy_service_);
65 DCHECK(ssl_config_service_.get()); 69 DCHECK(ssl_config_service_.get());
66 } 70 }
67 71
68 HttpNetworkLayer::HttpNetworkLayer(HttpNetworkSession* session) 72 HttpNetworkLayer::HttpNetworkLayer(HttpNetworkSession* session)
69 : socket_factory_(ClientSocketFactory::GetDefaultFactory()), 73 : socket_factory_(ClientSocketFactory::GetDefaultFactory()),
70 network_change_notifier_(NULL), 74 network_change_notifier_(NULL),
71 ssl_config_service_(NULL), 75 ssl_config_service_(NULL),
72 session_(session), 76 session_(session),
73 spdy_session_pool_(session->spdy_session_pool()), 77 spdy_session_pool_(session->spdy_session_pool()),
74 http_auth_handler_factory_(NULL), 78 http_auth_handler_factory_(NULL),
79 net_log_(NULL),
75 suspended_(false) { 80 suspended_(false) {
76 DCHECK(session_.get()); 81 DCHECK(session_.get());
77 } 82 }
78 83
79 HttpNetworkLayer::~HttpNetworkLayer() { 84 HttpNetworkLayer::~HttpNetworkLayer() {
80 } 85 }
81 86
82 int HttpNetworkLayer::CreateTransaction(scoped_ptr<HttpTransaction>* trans) { 87 int HttpNetworkLayer::CreateTransaction(scoped_ptr<HttpTransaction>* trans) {
83 if (suspended_) 88 if (suspended_)
84 return ERR_NETWORK_IO_SUSPENDED; 89 return ERR_NETWORK_IO_SUSPENDED;
(...skipping 16 matching lines...) Expand all
101 session_->tcp_socket_pool()->CloseIdleSockets(); 106 session_->tcp_socket_pool()->CloseIdleSockets();
102 } 107 }
103 108
104 HttpNetworkSession* HttpNetworkLayer::GetSession() { 109 HttpNetworkSession* HttpNetworkLayer::GetSession() {
105 if (!session_) { 110 if (!session_) {
106 DCHECK(proxy_service_); 111 DCHECK(proxy_service_);
107 SpdySessionPool* spdy_pool = new SpdySessionPool; 112 SpdySessionPool* spdy_pool = new SpdySessionPool;
108 session_ = new HttpNetworkSession( 113 session_ = new HttpNetworkSession(
109 network_change_notifier_, host_resolver_, proxy_service_, 114 network_change_notifier_, host_resolver_, proxy_service_,
110 socket_factory_, ssl_config_service_, spdy_pool, 115 socket_factory_, ssl_config_service_, spdy_pool,
111 http_auth_handler_factory_); 116 http_auth_handler_factory_,
117 net_log_);
112 // These were just temps for lazy-initializing HttpNetworkSession. 118 // These were just temps for lazy-initializing HttpNetworkSession.
113 network_change_notifier_ = NULL; 119 network_change_notifier_ = NULL;
114 host_resolver_ = NULL; 120 host_resolver_ = NULL;
115 proxy_service_ = NULL; 121 proxy_service_ = NULL;
116 socket_factory_ = NULL; 122 socket_factory_ = NULL;
117 http_auth_handler_factory_ = NULL; 123 http_auth_handler_factory_ = NULL;
124 net_log_ = NULL;
118 } 125 }
119 return session_; 126 return session_;
120 } 127 }
121 128
122 // static 129 // static
123 void HttpNetworkLayer::EnableSpdy(const std::string& mode) { 130 void HttpNetworkLayer::EnableSpdy(const std::string& mode) {
124 static const char kDisableSSL[] = "no-ssl"; 131 static const char kDisableSSL[] = "no-ssl";
125 static const char kDisableCompression[] = "no-compress"; 132 static const char kDisableCompression[] = "no-compress";
126 133
127 // We want an A/B experiment between SPDY enabled and SPDY disabled, 134 // We want an A/B experiment between SPDY enabled and SPDY disabled,
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 force_spdy_ = false; 175 force_spdy_ = false;
169 } else if (option.empty() && it == spdy_options.begin()) { 176 } else if (option.empty() && it == spdy_options.begin()) {
170 continue; 177 continue;
171 } else { 178 } else {
172 LOG(DFATAL) << "Unrecognized spdy option: " << option; 179 LOG(DFATAL) << "Unrecognized spdy option: " << option;
173 } 180 }
174 } 181 }
175 } 182 }
176 183
177 } // namespace net 184 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_network_layer.h ('k') | net/http/http_network_layer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698