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