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 <deque> | 8 #include <deque> |
9 #include <map> | 9 #include <map> |
10 #include <set> | 10 #include <set> |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 // must indicate whether |connection| uses an SSL socket or not; it | 249 // must indicate whether |connection| uses an SSL socket or not; it |
250 // is usually true, but it can be false for testing or when SPDY is | 250 // is usually true, but it can be false for testing or when SPDY is |
251 // configured to work with non-secure sockets. | 251 // configured to work with non-secure sockets. |
252 // | 252 // |
253 // |pool| is the SpdySessionPool that owns us. Its lifetime must | 253 // |pool| is the SpdySessionPool that owns us. Its lifetime must |
254 // strictly be greater than |this|. | 254 // strictly be greater than |this|. |
255 // | 255 // |
256 // |certificate_error_code| must either be OK or less than | 256 // |certificate_error_code| must either be OK or less than |
257 // ERR_IO_PENDING. | 257 // ERR_IO_PENDING. |
258 // | 258 // |
259 // Returns OK on success, or an error on failure. Never returns | 259 // The session begins reading from |connection| on a subsequent event loop |
260 // ERR_IO_PENDING. If an error is returned, the session must be | 260 // iteration, so the SpdySession may close immediately afterwards if the first |
261 // destroyed immediately. | 261 // read of |connection| fails. |
262 Error InitializeWithSocket(scoped_ptr<ClientSocketHandle> connection, | 262 void InitializeWithSocket(scoped_ptr<ClientSocketHandle> connection, |
263 SpdySessionPool* pool, | 263 SpdySessionPool* pool, |
264 bool is_secure, | 264 bool is_secure, |
265 int certificate_error_code); | 265 int certificate_error_code); |
266 | 266 |
267 // Returns the protocol used by this session. Always between | 267 // Returns the protocol used by this session. Always between |
268 // kProtoSPDYMinimumVersion and kProtoSPDYMaximumVersion. | 268 // kProtoSPDYMinimumVersion and kProtoSPDYMaximumVersion. |
269 NextProto protocol() const { return protocol_; } | 269 NextProto protocol() const { return protocol_; } |
270 | 270 |
271 // Check to see if this SPDY session can support an additional domain. | 271 // Check to see if this SPDY session can support an additional domain. |
272 // If the session is un-authenticated, then this call always returns true. | 272 // If the session is un-authenticated, then this call always returns true. |
273 // For SSL-based sessions, verifies that the server certificate in use by | 273 // For SSL-based sessions, verifies that the server certificate in use by |
274 // this session provides authentication for the domain and no client | 274 // this session provides authentication for the domain and no client |
275 // certificate or channel ID was sent to the original server during the SSL | 275 // certificate or channel ID was sent to the original server during the SSL |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
360 // Mark this session as unavailable, meaning that it will not be used to | 360 // Mark this session as unavailable, meaning that it will not be used to |
361 // service new streams. Unlike when a GOAWAY frame is received, this function | 361 // service new streams. Unlike when a GOAWAY frame is received, this function |
362 // will not close any streams. | 362 // will not close any streams. |
363 void MakeUnavailable(); | 363 void MakeUnavailable(); |
364 | 364 |
365 // Retrieves information on the current state of the SPDY session as a | 365 // Retrieves information on the current state of the SPDY session as a |
366 // Value. Caller takes possession of the returned value. | 366 // Value. Caller takes possession of the returned value. |
367 base::Value* GetInfoAsValue() const; | 367 base::Value* GetInfoAsValue() const; |
368 | 368 |
369 // Indicates whether the session is being reused after having successfully | 369 // Indicates whether the session is being reused after having successfully |
370 // used to send/receive data in the past. | 370 // used to send/receive data in the past or if the underlying socket was idle |
| 371 // before being used for a SPDY session. |
371 bool IsReused() const; | 372 bool IsReused() const; |
372 | 373 |
373 // Returns true if the underlying transport socket ever had any reads or | 374 // Returns true if the underlying transport socket ever had any reads or |
374 // writes. | 375 // writes. |
375 bool WasEverUsed() const { | 376 bool WasEverUsed() const { |
376 return connection_->socket()->WasEverUsed(); | 377 return connection_->socket()->WasEverUsed(); |
377 } | 378 } |
378 | 379 |
379 // Returns the load timing information from the perspective of the given | 380 // Returns the load timing information from the perspective of the given |
380 // stream. If it's not the first stream, the connection is considered reused | 381 // stream. If it's not the first stream, the connection is considered reused |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
610 // Calls DoReadLoop and then if |availability_state_| is | 611 // Calls DoReadLoop and then if |availability_state_| is |
611 // STATE_CLOSED, calls RemoveFromPool(). | 612 // STATE_CLOSED, calls RemoveFromPool(). |
612 // | 613 // |
613 // Use this function instead of DoReadLoop when posting a task to | 614 // Use this function instead of DoReadLoop when posting a task to |
614 // pump the read loop. | 615 // pump the read loop. |
615 void PumpReadLoop(ReadState expected_read_state, int result); | 616 void PumpReadLoop(ReadState expected_read_state, int result); |
616 | 617 |
617 // Advance the ReadState state machine. |expected_read_state| is the | 618 // Advance the ReadState state machine. |expected_read_state| is the |
618 // expected starting read state. | 619 // expected starting read state. |
619 // | 620 // |
620 // This function must always be called via PumpReadLoop() except for | 621 // This function must always be called via PumpReadLoop(). |
621 // from InitializeWithSocket(). | |
622 int DoReadLoop(ReadState expected_read_state, int result); | 622 int DoReadLoop(ReadState expected_read_state, int result); |
623 // The implementations of the states of the ReadState state machine. | 623 // The implementations of the states of the ReadState state machine. |
624 int DoRead(); | 624 int DoRead(); |
625 int DoReadComplete(int result); | 625 int DoReadComplete(int result); |
626 | 626 |
627 // Calls DoWriteLoop and then if |availability_state_| is | 627 // Calls DoWriteLoop and then if |availability_state_| is |
628 // STATE_CLOSED, calls RemoveFromPool(). | 628 // STATE_CLOSED, calls RemoveFromPool(). |
629 // | 629 // |
630 // Use this function instead of DoWriteLoop when posting a task to | 630 // Use this function instead of DoWriteLoop when posting a task to |
631 // pump the write loop. | 631 // pump the write loop. |
(...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1120 // This SPDY proxy is allowed to push resources from origins that are | 1120 // This SPDY proxy is allowed to push resources from origins that are |
1121 // different from those of their associated streams. | 1121 // different from those of their associated streams. |
1122 HostPortPair trusted_spdy_proxy_; | 1122 HostPortPair trusted_spdy_proxy_; |
1123 | 1123 |
1124 TimeFunc time_func_; | 1124 TimeFunc time_func_; |
1125 }; | 1125 }; |
1126 | 1126 |
1127 } // namespace net | 1127 } // namespace net |
1128 | 1128 |
1129 #endif // NET_SPDY_SPDY_SESSION_H_ | 1129 #endif // NET_SPDY_SPDY_SESSION_H_ |
OLD | NEW |