Chromium Code Reviews| 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 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 326 const NetLogWithSource& stream_net_log); | 326 const NetLogWithSource& stream_net_log); |
| 327 | 327 |
| 328 // Initialize the session with the given connection. |is_secure| | 328 // Initialize the session with the given connection. |is_secure| |
| 329 // must indicate whether |connection| uses an SSL socket or not; it | 329 // must indicate whether |connection| uses an SSL socket or not; it |
| 330 // is usually true, but it can be false for testing or when SPDY is | 330 // is usually true, but it can be false for testing or when SPDY is |
| 331 // configured to work with non-secure sockets. | 331 // configured to work with non-secure sockets. |
| 332 // | 332 // |
| 333 // |pool| is the SpdySessionPool that owns us. Its lifetime must | 333 // |pool| is the SpdySessionPool that owns us. Its lifetime must |
| 334 // strictly be greater than |this|. | 334 // strictly be greater than |this|. |
| 335 // | 335 // |
| 336 // |certificate_error_code| must either be OK or less than | |
| 337 // ERR_IO_PENDING. | |
|
Ryan Hamilton
2016/09/27 17:17:50
OH! I'll bet this is a hold-over from the days whe
| |
| 338 // | |
| 339 // The session begins reading from |connection| on a subsequent event loop | 336 // The session begins reading from |connection| on a subsequent event loop |
| 340 // iteration, so the SpdySession may close immediately afterwards if the first | 337 // iteration, so the SpdySession may close immediately afterwards if the first |
| 341 // read of |connection| fails. | 338 // read of |connection| fails. |
| 342 void InitializeWithSocket(std::unique_ptr<ClientSocketHandle> connection, | 339 void InitializeWithSocket(std::unique_ptr<ClientSocketHandle> connection, |
| 343 SpdySessionPool* pool, | 340 SpdySessionPool* pool, |
| 344 bool is_secure, | 341 bool is_secure); |
| 345 int certificate_error_code); | |
| 346 | 342 |
| 347 // Check to see if this SPDY session can support an additional domain. | 343 // Check to see if this SPDY session can support an additional domain. |
| 348 // If the session is un-authenticated, then this call always returns true. | 344 // If the session is un-authenticated, then this call always returns true. |
| 349 // For SSL-based sessions, verifies that the server certificate in use by | 345 // For SSL-based sessions, verifies that the server certificate in use by |
| 350 // this session provides authentication for the domain and no client | 346 // this session provides authentication for the domain and no client |
| 351 // certificate or channel ID was sent to the original server during the SSL | 347 // certificate or channel ID was sent to the original server during the SSL |
| 352 // handshake. NOTE: This function can have false negatives on some | 348 // handshake. NOTE: This function can have false negatives on some |
| 353 // platforms. | 349 // platforms. |
| 354 // TODO(wtc): rename this function and the Net.SpdyIPPoolDomainMatch | 350 // TODO(wtc): rename this function and the Net.SpdyIPPoolDomainMatch |
| 355 // histogram because this function does more than verifying domain | 351 // histogram because this function does more than verifying domain |
| (...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 638 READ_STATE_DO_READ_COMPLETE, | 634 READ_STATE_DO_READ_COMPLETE, |
| 639 }; | 635 }; |
| 640 | 636 |
| 641 enum WriteState { | 637 enum WriteState { |
| 642 // There is no in-flight write and the write queue is empty. | 638 // There is no in-flight write and the write queue is empty. |
| 643 WRITE_STATE_IDLE, | 639 WRITE_STATE_IDLE, |
| 644 WRITE_STATE_DO_WRITE, | 640 WRITE_STATE_DO_WRITE, |
| 645 WRITE_STATE_DO_WRITE_COMPLETE, | 641 WRITE_STATE_DO_WRITE_COMPLETE, |
| 646 }; | 642 }; |
| 647 | 643 |
| 648 // Checks whether a stream for the given |url| can be created or | |
| 649 // retrieved from the set of unclaimed push streams. Returns OK if | |
| 650 // so. Otherwise, the session is closed and an error < | |
| 651 // ERR_IO_PENDING is returned. | |
| 652 Error TryAccessStream(const GURL& url); | |
| 653 | |
| 654 // Called by SpdyStreamRequest to start a request to create a | 644 // Called by SpdyStreamRequest to start a request to create a |
| 655 // stream. If OK is returned, then |stream| will be filled in with a | 645 // stream. If OK is returned, then |stream| will be filled in with a |
| 656 // valid stream. If ERR_IO_PENDING is returned, then | 646 // valid stream. If ERR_IO_PENDING is returned, then |
| 657 // |request->OnRequestComplete{Success,Failure}()| will be called | 647 // |request->OnRequestComplete{Success,Failure}()| will be called |
| 658 // when the stream is created (unless it is cancelled). Otherwise, | 648 // when the stream is created (unless it is cancelled). Otherwise, |
| 659 // no stream is created and the error is returned. | 649 // no stream is created and the error is returned. |
| 660 int TryCreateStream(const base::WeakPtr<SpdyStreamRequest>& request, | 650 int TryCreateStream(const base::WeakPtr<SpdyStreamRequest>& request, |
| 661 base::WeakPtr<SpdyStream>* stream); | 651 base::WeakPtr<SpdyStream>* stream); |
| 662 | 652 |
| 663 // Actually create a stream into |stream|. Returns OK if successful; | 653 // Actually create a stream into |stream|. Returns OK if successful; |
| (...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1071 SpdyFrameType in_flight_write_frame_type_; | 1061 SpdyFrameType in_flight_write_frame_type_; |
| 1072 // The size of the frame in |in_flight_write_|. | 1062 // The size of the frame in |in_flight_write_|. |
| 1073 size_t in_flight_write_frame_size_; | 1063 size_t in_flight_write_frame_size_; |
| 1074 // The stream to notify when |in_flight_write_| has been written to | 1064 // The stream to notify when |in_flight_write_| has been written to |
| 1075 // the socket completely. | 1065 // the socket completely. |
| 1076 base::WeakPtr<SpdyStream> in_flight_write_stream_; | 1066 base::WeakPtr<SpdyStream> in_flight_write_stream_; |
| 1077 | 1067 |
| 1078 // Flag if we're using an SSL connection for this SpdySession. | 1068 // Flag if we're using an SSL connection for this SpdySession. |
| 1079 bool is_secure_; | 1069 bool is_secure_; |
| 1080 | 1070 |
| 1081 // Certificate error code when using a secure connection. | |
| 1082 int certificate_error_code_; | |
| 1083 | |
| 1084 // Spdy Frame state. | 1071 // Spdy Frame state. |
| 1085 std::unique_ptr<BufferedSpdyFramer> buffered_spdy_framer_; | 1072 std::unique_ptr<BufferedSpdyFramer> buffered_spdy_framer_; |
| 1086 | 1073 |
| 1087 // The state variables. | 1074 // The state variables. |
| 1088 AvailabilityState availability_state_; | 1075 AvailabilityState availability_state_; |
| 1089 ReadState read_state_; | 1076 ReadState read_state_; |
| 1090 WriteState write_state_; | 1077 WriteState write_state_; |
| 1091 | 1078 |
| 1092 // If the session is closing (i.e., |availability_state_| is STATE_DRAINING), | 1079 // If the session is closing (i.e., |availability_state_| is STATE_DRAINING), |
| 1093 // then |error_on_close_| holds the error with which it was closed, which | 1080 // then |error_on_close_| holds the error with which it was closed, which |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1212 // Used for posting asynchronous IO tasks. We use this even though | 1199 // Used for posting asynchronous IO tasks. We use this even though |
| 1213 // SpdySession is refcounted because we don't need to keep the SpdySession | 1200 // SpdySession is refcounted because we don't need to keep the SpdySession |
| 1214 // alive if the last reference is within a RunnableMethod. Just revoke the | 1201 // alive if the last reference is within a RunnableMethod. Just revoke the |
| 1215 // method. | 1202 // method. |
| 1216 base::WeakPtrFactory<SpdySession> weak_factory_; | 1203 base::WeakPtrFactory<SpdySession> weak_factory_; |
| 1217 }; | 1204 }; |
| 1218 | 1205 |
| 1219 } // namespace net | 1206 } // namespace net |
| 1220 | 1207 |
| 1221 #endif // NET_SPDY_SPDY_SESSION_H_ | 1208 #endif // NET_SPDY_SPDY_SESSION_H_ |
| OLD | NEW |