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

Side by Side Diff: net/spdy/spdy_session_pool.cc

Issue 169053004: Remove a bunch of unused network flags. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge Created 6 years, 9 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/spdy/spdy_session_pool.h ('k') | no next file » | 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) 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 #include "net/spdy/spdy_session_pool.h" 5 #include "net/spdy/spdy_session_pool.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "base/values.h" 9 #include "base/values.h"
10 #include "net/base/address_list.h" 10 #include "net/base/address_list.h"
(...skipping 14 matching lines...) Expand all
25 SPDY_SESSION_GET_MAX = 4 25 SPDY_SESSION_GET_MAX = 4
26 }; 26 };
27 27
28 } // namespace 28 } // namespace
29 29
30 SpdySessionPool::SpdySessionPool( 30 SpdySessionPool::SpdySessionPool(
31 HostResolver* resolver, 31 HostResolver* resolver,
32 SSLConfigService* ssl_config_service, 32 SSLConfigService* ssl_config_service,
33 const base::WeakPtr<HttpServerProperties>& http_server_properties, 33 const base::WeakPtr<HttpServerProperties>& http_server_properties,
34 bool force_single_domain, 34 bool force_single_domain,
35 bool enable_ip_pooling,
36 bool enable_compression, 35 bool enable_compression,
37 bool enable_ping_based_connection_checking, 36 bool enable_ping_based_connection_checking,
38 NextProto default_protocol, 37 NextProto default_protocol,
39 size_t stream_initial_recv_window_size, 38 size_t stream_initial_recv_window_size,
40 size_t initial_max_concurrent_streams, 39 size_t initial_max_concurrent_streams,
41 size_t max_concurrent_streams_limit, 40 size_t max_concurrent_streams_limit,
42 SpdySessionPool::TimeFunc time_func, 41 SpdySessionPool::TimeFunc time_func,
43 const std::string& trusted_spdy_proxy) 42 const std::string& trusted_spdy_proxy)
44 : http_server_properties_(http_server_properties), 43 : http_server_properties_(http_server_properties),
45 ssl_config_service_(ssl_config_service), 44 ssl_config_service_(ssl_config_service),
46 resolver_(resolver), 45 resolver_(resolver),
47 verify_domain_authentication_(true), 46 verify_domain_authentication_(true),
48 enable_sending_initial_data_(true), 47 enable_sending_initial_data_(true),
49 force_single_domain_(force_single_domain), 48 force_single_domain_(force_single_domain),
50 enable_ip_pooling_(enable_ip_pooling),
51 enable_compression_(enable_compression), 49 enable_compression_(enable_compression),
52 enable_ping_based_connection_checking_( 50 enable_ping_based_connection_checking_(
53 enable_ping_based_connection_checking), 51 enable_ping_based_connection_checking),
54 // TODO(akalin): Force callers to have a valid value of 52 // TODO(akalin): Force callers to have a valid value of
55 // |default_protocol_|. 53 // |default_protocol_|.
56 default_protocol_( 54 default_protocol_(
57 (default_protocol == kProtoUnknown) ? 55 (default_protocol == kProtoUnknown) ?
58 kProtoSPDY3 : default_protocol), 56 kProtoSPDY3 : default_protocol),
59 stream_initial_recv_window_size_(stream_initial_recv_window_size), 57 stream_initial_recv_window_size_(stream_initial_recv_window_size),
60 initial_max_concurrent_streams_(initial_max_concurrent_streams), 58 initial_max_concurrent_streams_(initial_max_concurrent_streams),
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 120
123 net_log.AddEvent( 121 net_log.AddEvent(
124 NetLog::TYPE_SPDY_SESSION_POOL_IMPORTED_SESSION_FROM_SOCKET, 122 NetLog::TYPE_SPDY_SESSION_POOL_IMPORTED_SESSION_FROM_SOCKET,
125 (*available_session)->net_log().source().ToEventParametersCallback()); 123 (*available_session)->net_log().source().ToEventParametersCallback());
126 124
127 // Look up the IP address for this session so that we can match 125 // Look up the IP address for this session so that we can match
128 // future sessions (potentially to different domains) which can 126 // future sessions (potentially to different domains) which can
129 // potentially be pooled with this one. Because GetPeerAddress() 127 // potentially be pooled with this one. Because GetPeerAddress()
130 // reports the proxy's address instead of the origin server, check 128 // reports the proxy's address instead of the origin server, check
131 // to see if this is a direct connection. 129 // to see if this is a direct connection.
132 if (enable_ip_pooling_ && key.proxy_server().is_direct()) { 130 if (key.proxy_server().is_direct()) {
133 IPEndPoint address; 131 IPEndPoint address;
134 if ((*available_session)->GetPeerAddress(&address) == OK) 132 if ((*available_session)->GetPeerAddress(&address) == OK)
135 aliases_[address] = key; 133 aliases_[address] = key;
136 } 134 }
137 135
138 return error; 136 return error;
139 } 137 }
140 138
141 base::WeakPtr<SpdySession> SpdySessionPool::FindAvailableSession( 139 base::WeakPtr<SpdySession> SpdySessionPool::FindAvailableSession(
142 const SpdySessionKey& key, 140 const SpdySessionKey& key,
143 const BoundNetLog& net_log) { 141 const BoundNetLog& net_log) {
144 AvailableSessionMap::iterator it = LookupAvailableSessionByKey(key); 142 AvailableSessionMap::iterator it = LookupAvailableSessionByKey(key);
145 if (it != available_sessions_.end()) { 143 if (it != available_sessions_.end()) {
146 UMA_HISTOGRAM_ENUMERATION( 144 UMA_HISTOGRAM_ENUMERATION(
147 "Net.SpdySessionGet", FOUND_EXISTING, SPDY_SESSION_GET_MAX); 145 "Net.SpdySessionGet", FOUND_EXISTING, SPDY_SESSION_GET_MAX);
148 net_log.AddEvent( 146 net_log.AddEvent(
149 NetLog::TYPE_SPDY_SESSION_POOL_FOUND_EXISTING_SESSION, 147 NetLog::TYPE_SPDY_SESSION_POOL_FOUND_EXISTING_SESSION,
150 it->second->net_log().source().ToEventParametersCallback()); 148 it->second->net_log().source().ToEventParametersCallback());
151 return it->second; 149 return it->second;
152 } 150 }
153 151
154 if (!enable_ip_pooling_)
155 return base::WeakPtr<SpdySession>();
156
157 // Look up the key's from the resolver's cache. 152 // Look up the key's from the resolver's cache.
158 net::HostResolver::RequestInfo resolve_info(key.host_port_pair()); 153 net::HostResolver::RequestInfo resolve_info(key.host_port_pair());
159 AddressList addresses; 154 AddressList addresses;
160 int rv = resolver_->ResolveFromCache(resolve_info, &addresses, net_log); 155 int rv = resolver_->ResolveFromCache(resolve_info, &addresses, net_log);
161 DCHECK_NE(rv, ERR_IO_PENDING); 156 DCHECK_NE(rv, ERR_IO_PENDING);
162 if (rv != OK) 157 if (rv != OK)
163 return base::WeakPtr<SpdySession>(); 158 return base::WeakPtr<SpdySession>();
164 159
165 // Check if we have a session through a domain alias. 160 // Check if we have a session through a domain alias.
166 for (AddressList::const_iterator address_it = addresses.begin(); 161 for (AddressList::const_iterator address_it = addresses.begin();
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
399 if (idle_only && (*it)->is_active()) 394 if (idle_only && (*it)->is_active())
400 continue; 395 continue;
401 396
402 (*it)->CloseSessionOnError(error, description); 397 (*it)->CloseSessionOnError(error, description);
403 DCHECK(!IsSessionAvailable(*it)); 398 DCHECK(!IsSessionAvailable(*it));
404 DCHECK(!*it); 399 DCHECK(!*it);
405 } 400 }
406 } 401 }
407 402
408 } // namespace net 403 } // namespace net
OLDNEW
« no previous file with comments | « net/spdy/spdy_session_pool.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698