| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 <list> | 9 #include <list> |
| 10 #include <map> | 10 #include <map> |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 // Returns net::Error::OK on success. | 52 // Returns net::Error::OK on success. |
| 53 // Note that this call does not wait for the connect to complete. Callers can | 53 // Note that this call does not wait for the connect to complete. Callers can |
| 54 // immediately start using the SpdySession while it connects. | 54 // immediately start using the SpdySession while it connects. |
| 55 net::Error Connect(const std::string& group_name, | 55 net::Error Connect(const std::string& group_name, |
| 56 const TCPSocketParams& destination, | 56 const TCPSocketParams& destination, |
| 57 RequestPriority priority); | 57 RequestPriority priority); |
| 58 | 58 |
| 59 // Get a pushed stream for a given |url|. | 59 // Get a pushed stream for a given |url|. |
| 60 // If the server initiates a stream, it might already exist for a given path. | 60 // If the server initiates a stream, it might already exist for a given path. |
| 61 // The server might also not have initiated the stream yet, but indicated it | 61 // The server might also not have initiated the stream yet, but indicated it |
| 62 // will via X-Associated-Content. | 62 // will via X-Associated-Content. Writes the stream out to |spdy_stream|. |
| 63 // Returns existing stream or NULL. | 63 // Returns a net error code. |
| 64 scoped_refptr<SpdyStream> GetPushStream( | 64 int GetPushStream( |
| 65 const GURL& url, | 65 const GURL& url, |
| 66 scoped_refptr<SpdyStream>* spdy_stream, |
| 66 const BoundNetLog& stream_net_log); | 67 const BoundNetLog& stream_net_log); |
| 67 | 68 |
| 68 // Create a new stream for a given |url|. | 69 // Create a new stream for a given |url|. Writes it out to |spdy_stream|. |
| 69 // Returns the new stream. Never returns NULL. | 70 // Returns a net error code. |
| 70 const scoped_refptr<SpdyStream>& CreateStream( | 71 int CreateStream( |
| 71 const GURL& url, | 72 const GURL& url, |
| 72 RequestPriority priority, | 73 RequestPriority priority, |
| 74 scoped_refptr<SpdyStream>* spdy_stream, |
| 73 const BoundNetLog& stream_net_log); | 75 const BoundNetLog& stream_net_log); |
| 74 | 76 |
| 75 // Used by SpdySessionPool to initialize with a pre-existing SSL socket. | 77 // Used by SpdySessionPool to initialize with a pre-existing SSL socket. |
| 76 // Returns OK on success, or an error on failure. | 78 // Returns OK on success, or an error on failure. |
| 77 net::Error InitializeWithSSLSocket(ClientSocketHandle* connection); | 79 net::Error InitializeWithSSLSocket(ClientSocketHandle* connection, |
| 80 int certificate_error_code); |
| 78 | 81 |
| 79 // Send the SYN frame for |stream_id|. | 82 // Send the SYN frame for |stream_id|. |
| 80 int WriteSynStream( | 83 int WriteSynStream( |
| 81 spdy::SpdyStreamId stream_id, | 84 spdy::SpdyStreamId stream_id, |
| 82 RequestPriority priority, | 85 RequestPriority priority, |
| 83 spdy::SpdyControlFlags flags, | 86 spdy::SpdyControlFlags flags, |
| 84 const linked_ptr<spdy::SpdyHeaderBlock>& headers); | 87 const linked_ptr<spdy::SpdyHeaderBlock>& headers); |
| 85 | 88 |
| 86 // Write a data frame to the stream. | 89 // Write a data frame to the stream. |
| 87 // Used to create and queue a data frame for the given stream. | 90 // Used to create and queue a data frame for the given stream. |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 // The packet we are currently sending. | 247 // The packet we are currently sending. |
| 245 bool write_pending_; // Will be true when a write is in progress. | 248 bool write_pending_; // Will be true when a write is in progress. |
| 246 SpdyIOBuffer in_flight_write_; // This is the write buffer in progress. | 249 SpdyIOBuffer in_flight_write_; // This is the write buffer in progress. |
| 247 | 250 |
| 248 // Flag if we have a pending message scheduled for WriteSocket. | 251 // Flag if we have a pending message scheduled for WriteSocket. |
| 249 bool delayed_write_pending_; | 252 bool delayed_write_pending_; |
| 250 | 253 |
| 251 // Flag if we're using an SSL connection for this SpdySession. | 254 // Flag if we're using an SSL connection for this SpdySession. |
| 252 bool is_secure_; | 255 bool is_secure_; |
| 253 | 256 |
| 257 // Certificate error code when using a secure connection. |
| 258 int certificate_error_code_; |
| 259 |
| 254 // Spdy Frame state. | 260 // Spdy Frame state. |
| 255 spdy::SpdyFramer spdy_framer_; | 261 spdy::SpdyFramer spdy_framer_; |
| 256 | 262 |
| 257 // If an error has occurred on the session, the session is effectively | 263 // If an error has occurred on the session, the session is effectively |
| 258 // dead. Record this error here. When no error has occurred, |error_| will | 264 // dead. Record this error here. When no error has occurred, |error_| will |
| 259 // be OK. | 265 // be OK. |
| 260 net::Error error_; | 266 net::Error error_; |
| 261 State state_; | 267 State state_; |
| 262 | 268 |
| 263 // Some statistics counters for the session. | 269 // Some statistics counters for the session. |
| 264 int streams_initiated_count_; | 270 int streams_initiated_count_; |
| 265 int streams_pushed_count_; | 271 int streams_pushed_count_; |
| 266 int streams_pushed_and_claimed_count_; | 272 int streams_pushed_and_claimed_count_; |
| 267 int streams_abandoned_count_; | 273 int streams_abandoned_count_; |
| 268 bool sent_settings_; // Did this session send settings when it started. | 274 bool sent_settings_; // Did this session send settings when it started. |
| 269 bool received_settings_; // Did this session receive at least one settings | 275 bool received_settings_; // Did this session receive at least one settings |
| 270 // frame. | 276 // frame. |
| 271 | 277 |
| 272 bool in_session_pool_; // True if the session is currently in the pool. | 278 bool in_session_pool_; // True if the session is currently in the pool. |
| 273 | 279 |
| 274 BoundNetLog net_log_; | 280 BoundNetLog net_log_; |
| 275 | 281 |
| 276 static bool use_ssl_; | 282 static bool use_ssl_; |
| 277 }; | 283 }; |
| 278 | 284 |
| 279 } // namespace net | 285 } // namespace net |
| 280 | 286 |
| 281 #endif // NET_SPDY_SPDY_SESSION_H_ | 287 #endif // NET_SPDY_SPDY_SESSION_H_ |
| OLD | NEW |