OLD | NEW |
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 <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 // |session| is the HttpNetworkSession. |net_log| is the NetLog that we log | 294 // |session| is the HttpNetworkSession. |net_log| is the NetLog that we log |
295 // network events to. | 295 // network events to. |
296 SpdySession(const SpdySessionKey& spdy_session_key, | 296 SpdySession(const SpdySessionKey& spdy_session_key, |
297 HttpServerProperties* http_server_properties, | 297 HttpServerProperties* http_server_properties, |
298 TransportSecurityState* transport_security_state, | 298 TransportSecurityState* transport_security_state, |
299 bool enable_sending_initial_data, | 299 bool enable_sending_initial_data, |
300 bool enable_ping_based_connection_checking, | 300 bool enable_ping_based_connection_checking, |
301 size_t session_max_recv_window_size, | 301 size_t session_max_recv_window_size, |
302 size_t stream_max_recv_window_size, | 302 size_t stream_max_recv_window_size, |
303 TimeFunc time_func, | 303 TimeFunc time_func, |
| 304 ServerPushDelegate* push_delegate, |
304 ProxyDelegate* proxy_delegate, | 305 ProxyDelegate* proxy_delegate, |
305 NetLog* net_log); | 306 NetLog* net_log); |
306 | 307 |
307 ~SpdySession() override; | 308 ~SpdySession() override; |
308 | 309 |
309 const HostPortPair& host_port_pair() const { | 310 const HostPortPair& host_port_pair() const { |
310 return spdy_session_key_.host_port_proxy_pair().first; | 311 return spdy_session_key_.host_port_proxy_pair().first; |
311 } | 312 } |
312 const HostPortProxyPair& host_port_proxy_pair() const { | 313 const HostPortProxyPair& host_port_proxy_pair() const { |
313 return spdy_session_key_.host_port_proxy_pair(); | 314 return spdy_session_key_.host_port_proxy_pair(); |
314 } | 315 } |
315 const SpdySessionKey& spdy_session_key() const { | 316 const SpdySessionKey& spdy_session_key() const { |
316 return spdy_session_key_; | 317 return spdy_session_key_; |
317 } | 318 } |
318 // Get a pushed stream for a given |url|. If the server initiates a | 319 // Get a pushed stream for a given |url|. If the server initiates a |
319 // stream, it might already exist for a given path. The server | 320 // stream, it might already exist for a given path. The server |
320 // might also not have initiated the stream yet, but indicated it | 321 // might also not have initiated the stream yet, but indicated it |
321 // will via X-Associated-Content. Returns OK if a stream was found | 322 // will via X-Associated-Content. Returns OK if a stream was found |
322 // and put into |spdy_stream|, or if one was not found but it is | 323 // and put into |spdy_stream|, or if one was not found but it is |
323 // okay to create a new stream (in which case |spdy_stream| is | 324 // okay to create a new stream (in which case |spdy_stream| is |
324 // reset). Returns an error (not ERR_IO_PENDING) otherwise, and | 325 // reset). Returns an error (not ERR_IO_PENDING) otherwise, and |
325 // resets |spdy_stream|. | 326 // resets |spdy_stream|. |
326 int GetPushStream(const GURL& url, | 327 int GetPushStream(const GURL& url, |
327 base::WeakPtr<SpdyStream>* spdy_stream, | 328 base::WeakPtr<SpdyStream>* spdy_stream, |
328 const NetLogWithSource& stream_net_log); | 329 const NetLogWithSource& stream_net_log); |
329 | 330 |
330 void set_push_delegate(ServerPushDelegate* push_delegate) { | |
331 push_delegate_ = push_delegate; | |
332 } | |
333 | |
334 // Called when the pushed stream should be cancelled. If the pushed stream is | 331 // Called when the pushed stream should be cancelled. If the pushed stream is |
335 // not claimed and active, sends RST to the server to cancel the stream. | 332 // not claimed and active, sends RST to the server to cancel the stream. |
336 void CancelPush(const GURL& url); | 333 void CancelPush(const GURL& url); |
337 | 334 |
338 // Initialize the session with the given connection. |is_secure| | 335 // Initialize the session with the given connection. |is_secure| |
339 // must indicate whether |connection| uses an SSL socket or not; it | 336 // must indicate whether |connection| uses an SSL socket or not; it |
340 // is usually true, but it can be false for testing or when SPDY is | 337 // is usually true, but it can be false for testing or when SPDY is |
341 // configured to work with non-secure sockets. | 338 // configured to work with non-secure sockets. |
342 // | 339 // |
343 // |pool| is the SpdySessionPool that owns us. Its lifetime must | 340 // |pool| is the SpdySessionPool that owns us. Its lifetime must |
(...skipping 870 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1214 // Used for posting asynchronous IO tasks. We use this even though | 1211 // Used for posting asynchronous IO tasks. We use this even though |
1215 // SpdySession is refcounted because we don't need to keep the SpdySession | 1212 // SpdySession is refcounted because we don't need to keep the SpdySession |
1216 // alive if the last reference is within a RunnableMethod. Just revoke the | 1213 // alive if the last reference is within a RunnableMethod. Just revoke the |
1217 // method. | 1214 // method. |
1218 base::WeakPtrFactory<SpdySession> weak_factory_; | 1215 base::WeakPtrFactory<SpdySession> weak_factory_; |
1219 }; | 1216 }; |
1220 | 1217 |
1221 } // namespace net | 1218 } // namespace net |
1222 | 1219 |
1223 #endif // NET_SPDY_SPDY_SESSION_H_ | 1220 #endif // NET_SPDY_SPDY_SESSION_H_ |
OLD | NEW |