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

Side by Side Diff: net/spdy/spdy_session.h

Issue 425803014: Refactor pooling logic into a helper method (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix test Created 6 years, 4 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/socket/ssl_client_socket_pool_unittest.cc ('k') | net/spdy/spdy_session.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) 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 #ifndef NET_SPDY_SPDY_SESSION_H_ 5 #ifndef NET_SPDY_SPDY_SESSION_H_
6 #define NET_SPDY_SPDY_SESSION_H_ 6 #define NET_SPDY_SPDY_SESSION_H_
7 7
8 #include <deque> 8 #include <deque>
9 #include <map> 9 #include <map>
10 #include <set> 10 #include <set>
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 63
64 // First and last valid stream IDs. As we always act as the client, 64 // First and last valid stream IDs. As we always act as the client,
65 // start at 1 for the first stream id. 65 // start at 1 for the first stream id.
66 const SpdyStreamId kFirstStreamId = 1; 66 const SpdyStreamId kFirstStreamId = 1;
67 const SpdyStreamId kLastStreamId = 0x7fffffff; 67 const SpdyStreamId kLastStreamId = 0x7fffffff;
68 68
69 class BoundNetLog; 69 class BoundNetLog;
70 struct LoadTimingInfo; 70 struct LoadTimingInfo;
71 class SpdyStream; 71 class SpdyStream;
72 class SSLInfo; 72 class SSLInfo;
73 class TransportSecurityState;
73 74
74 // NOTE: There's an enum of the same name (also with numeric suffixes) 75 // NOTE: There's an enum of the same name (also with numeric suffixes)
75 // in histograms.xml. Be sure to add new values there also. 76 // in histograms.xml. Be sure to add new values there also.
76 enum SpdyProtocolErrorDetails { 77 enum SpdyProtocolErrorDetails {
77 // SpdyFramer::SpdyError mappings. 78 // SpdyFramer::SpdyError mappings.
78 SPDY_ERROR_NO_ERROR = 0, 79 SPDY_ERROR_NO_ERROR = 0,
79 SPDY_ERROR_INVALID_CONTROL_FRAME = 1, 80 SPDY_ERROR_INVALID_CONTROL_FRAME = 1,
80 SPDY_ERROR_CONTROL_PAYLOAD_TOO_LARGE = 2, 81 SPDY_ERROR_CONTROL_PAYLOAD_TOO_LARGE = 2,
81 SPDY_ERROR_ZLIB_INIT_FAILURE = 3, 82 SPDY_ERROR_ZLIB_INIT_FAILURE = 3,
82 SPDY_ERROR_UNSUPPORTED_VERSION = 4, 83 SPDY_ERROR_UNSUPPORTED_VERSION = 4,
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 // TODO(akalin): Use base::TickClock when it becomes available. 216 // TODO(akalin): Use base::TickClock when it becomes available.
216 typedef base::TimeTicks (*TimeFunc)(void); 217 typedef base::TimeTicks (*TimeFunc)(void);
217 218
218 // How we handle flow control (version-dependent). 219 // How we handle flow control (version-dependent).
219 enum FlowControlState { 220 enum FlowControlState {
220 FLOW_CONTROL_NONE, 221 FLOW_CONTROL_NONE,
221 FLOW_CONTROL_STREAM, 222 FLOW_CONTROL_STREAM,
222 FLOW_CONTROL_STREAM_AND_SESSION 223 FLOW_CONTROL_STREAM_AND_SESSION
223 }; 224 };
224 225
226 // Returns true if |hostname| can be pooled into an existing connection
227 // associated with |ssl_info|.
228 static bool CanPool(TransportSecurityState* transport_security_state,
229 const SSLInfo& ssl_info,
230 const std::string& old_hostname,
231 const std::string& new_hostname);
232
225 // Create a new SpdySession. 233 // Create a new SpdySession.
226 // |spdy_session_key| is the host/port that this session connects to, privacy 234 // |spdy_session_key| is the host/port that this session connects to, privacy
227 // and proxy configuration settings that it's using. 235 // and proxy configuration settings that it's using.
228 // |session| is the HttpNetworkSession. |net_log| is the NetLog that we log 236 // |session| is the HttpNetworkSession. |net_log| is the NetLog that we log
229 // network events to. 237 // network events to.
230 SpdySession(const SpdySessionKey& spdy_session_key, 238 SpdySession(const SpdySessionKey& spdy_session_key,
231 const base::WeakPtr<HttpServerProperties>& http_server_properties, 239 const base::WeakPtr<HttpServerProperties>& http_server_properties,
240 TransportSecurityState* transport_security_state,
232 bool verify_domain_authentication, 241 bool verify_domain_authentication,
233 bool enable_sending_initial_data, 242 bool enable_sending_initial_data,
234 bool enable_compression, 243 bool enable_compression,
235 bool enable_ping_based_connection_checking, 244 bool enable_ping_based_connection_checking,
236 NextProto default_protocol, 245 NextProto default_protocol,
237 size_t stream_initial_recv_window_size, 246 size_t stream_initial_recv_window_size,
238 size_t initial_max_concurrent_streams, 247 size_t initial_max_concurrent_streams,
239 size_t max_concurrent_streams_limit, 248 size_t max_concurrent_streams_limit,
240 TimeFunc time_func, 249 TimeFunc time_func,
241 const HostPortPair& trusted_spdy_proxy, 250 const HostPortPair& trusted_spdy_proxy,
(...skipping 714 matching lines...) Expand 10 before | Expand all | Expand 10 after
956 965
957 // Set set of SpdySessionKeys for which this session has serviced 966 // Set set of SpdySessionKeys for which this session has serviced
958 // requests. 967 // requests.
959 std::set<SpdySessionKey> pooled_aliases_; 968 std::set<SpdySessionKey> pooled_aliases_;
960 969
961 // |pool_| owns us, therefore its lifetime must exceed ours. We set 970 // |pool_| owns us, therefore its lifetime must exceed ours. We set
962 // this to NULL after we are removed from the pool. 971 // this to NULL after we are removed from the pool.
963 SpdySessionPool* pool_; 972 SpdySessionPool* pool_;
964 const base::WeakPtr<HttpServerProperties> http_server_properties_; 973 const base::WeakPtr<HttpServerProperties> http_server_properties_;
965 974
975 TransportSecurityState* transport_security_state_;
976
966 // The socket handle for this session. 977 // The socket handle for this session.
967 scoped_ptr<ClientSocketHandle> connection_; 978 scoped_ptr<ClientSocketHandle> connection_;
968 979
969 // The read buffer used to read data from the socket. 980 // The read buffer used to read data from the socket.
970 scoped_refptr<IOBuffer> read_buffer_; 981 scoped_refptr<IOBuffer> read_buffer_;
971 982
972 SpdyStreamId stream_hi_water_mark_; // The next stream id to use. 983 SpdyStreamId stream_hi_water_mark_; // The next stream id to use.
973 984
974 // Queue, for each priority, of pending stream requests that have 985 // Queue, for each priority, of pending stream requests that have
975 // not yet been satisfied. 986 // not yet been satisfied.
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
1157 // Used for posting asynchronous IO tasks. We use this even though 1168 // Used for posting asynchronous IO tasks. We use this even though
1158 // SpdySession is refcounted because we don't need to keep the SpdySession 1169 // SpdySession is refcounted because we don't need to keep the SpdySession
1159 // alive if the last reference is within a RunnableMethod. Just revoke the 1170 // alive if the last reference is within a RunnableMethod. Just revoke the
1160 // method. 1171 // method.
1161 base::WeakPtrFactory<SpdySession> weak_factory_; 1172 base::WeakPtrFactory<SpdySession> weak_factory_;
1162 }; 1173 };
1163 1174
1164 } // namespace net 1175 } // namespace net
1165 1176
1166 #endif // NET_SPDY_SPDY_SESSION_H_ 1177 #endif // NET_SPDY_SPDY_SESSION_H_
OLDNEW
« no previous file with comments | « net/socket/ssl_client_socket_pool_unittest.cc ('k') | net/spdy/spdy_session.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698