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 // A client specific QuicSession subclass. This class owns the underlying | 5 // A client specific QuicSession subclass. This class owns the underlying |
6 // QuicConnection and QuicConnectionHelper objects. The connection stores | 6 // QuicConnection and QuicConnectionHelper objects. The connection stores |
7 // a non-owning pointer to the helper so this session needs to ensure that | 7 // a non-owning pointer to the helper so this session needs to ensure that |
8 // the helper outlives the connection. | 8 // the helper outlives the connection. |
9 | 9 |
10 #ifndef NET_QUIC_QUIC_CLIENT_SESSION_H_ | 10 #ifndef NET_QUIC_QUIC_CLIENT_SESSION_H_ |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
80 // if |session_| is destroyed while the stream request is still pending. | 80 // if |session_| is destroyed while the stream request is still pending. |
81 void OnRequestCompleteFailure(int rv); | 81 void OnRequestCompleteFailure(int rv); |
82 | 82 |
83 base::WeakPtr<QuicClientSession> session_; | 83 base::WeakPtr<QuicClientSession> session_; |
84 CompletionCallback callback_; | 84 CompletionCallback callback_; |
85 QuicReliableClientStream** stream_; | 85 QuicReliableClientStream** stream_; |
86 | 86 |
87 DISALLOW_COPY_AND_ASSIGN(StreamRequest); | 87 DISALLOW_COPY_AND_ASSIGN(StreamRequest); |
88 }; | 88 }; |
89 | 89 |
90 // Constructs a new session connected to |server_id| which will own | 90 // Constructs a new session which will own |connection|, but not |
91 // |connection|, but not |stream_factory|, which must outlive this session. | 91 // |stream_factory|, which must outlive this session. |
92 // TODO(rch): decouple the factory from the session via a Delegate interface. | 92 // TODO(rch): decouple the factory from the session via a Delegate interface. |
93 QuicClientSession(QuicConnection* connection, | 93 QuicClientSession(QuicConnection* connection, |
94 scoped_ptr<DatagramClientSocket> socket, | 94 scoped_ptr<DatagramClientSocket> socket, |
95 QuicStreamFactory* stream_factory, | 95 QuicStreamFactory* stream_factory, |
96 QuicCryptoClientStreamFactory* crypto_client_stream_factory, | |
97 TransportSecurityState* transport_security_state, | 96 TransportSecurityState* transport_security_state, |
98 scoped_ptr<QuicServerInfo> server_info, | 97 scoped_ptr<QuicServerInfo> server_info, |
99 const QuicServerId& server_id, | |
100 const QuicConfig& config, | 98 const QuicConfig& config, |
101 QuicCryptoClientConfig* crypto_config, | |
102 base::TaskRunner* task_runner, | 99 base::TaskRunner* task_runner, |
103 NetLog* net_log); | 100 NetLog* net_log); |
104 virtual ~QuicClientSession(); | 101 virtual ~QuicClientSession(); |
105 | 102 |
103 // Initialize session's connection to |server_id|. | |
104 void InitializeSession( | |
105 const QuicServerId& server_id, | |
106 QuicCryptoClientConfig* config, | |
107 QuicCryptoClientStreamFactory* crypto_client_stream_factory); | |
108 | |
106 void AddObserver(Observer* observer); | 109 void AddObserver(Observer* observer); |
107 void RemoveObserver(Observer* observer); | 110 void RemoveObserver(Observer* observer); |
108 | 111 |
109 // Attempts to create a new stream. If the stream can be | 112 // Attempts to create a new stream. If the stream can be |
110 // created immediately, returns OK. If the open stream limit | 113 // created immediately, returns OK. If the open stream limit |
111 // has been reached, returns ERR_IO_PENDING, and |request| | 114 // has been reached, returns ERR_IO_PENDING, and |request| |
112 // will be added to the stream requets queue and will | 115 // will be added to the stream requets queue and will |
113 // be completed asynchronously. | 116 // be completed asynchronously. |
114 // TODO(rch): remove |stream| from this and use setter on |request| | 117 // TODO(rch): remove |stream| from this and use setter on |request| |
115 // and fix in spdy too. | 118 // and fix in spdy too. |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
212 | 215 |
213 // Posts a task to notify the factory that this session has been closed. | 216 // Posts a task to notify the factory that this session has been closed. |
214 void NotifyFactoryOfSessionClosedLater(); | 217 void NotifyFactoryOfSessionClosedLater(); |
215 | 218 |
216 // Notifies the factory that this session has been closed which will | 219 // Notifies the factory that this session has been closed which will |
217 // delete |this|. | 220 // delete |this|. |
218 void NotifyFactoryOfSessionClosed(); | 221 void NotifyFactoryOfSessionClosed(); |
219 | 222 |
220 void OnConnectTimeout(); | 223 void OnConnectTimeout(); |
221 | 224 |
222 const HostPortPair server_host_port_; | 225 scoped_ptr<HostPortPair> server_host_port_; |
wtc
2014/08/26 18:35:42
It seems that this doesn't need to be a pointer. W
ramant (doing other things)
2014/08/27 22:06:46
Fixed it in CL: https://codereview.chromium.org/51
| |
223 bool require_confirmation_; | 226 bool require_confirmation_; |
224 scoped_ptr<QuicCryptoClientStream> crypto_stream_; | 227 scoped_ptr<QuicCryptoClientStream> crypto_stream_; |
225 QuicStreamFactory* stream_factory_; | 228 QuicStreamFactory* stream_factory_; |
226 scoped_ptr<DatagramClientSocket> socket_; | 229 scoped_ptr<DatagramClientSocket> socket_; |
227 scoped_refptr<IOBufferWithSize> read_buffer_; | 230 scoped_refptr<IOBufferWithSize> read_buffer_; |
228 TransportSecurityState* transport_security_state_; | 231 TransportSecurityState* transport_security_state_; |
229 scoped_ptr<QuicServerInfo> server_info_; | 232 scoped_ptr<QuicServerInfo> server_info_; |
230 scoped_ptr<CertVerifyResult> cert_verify_result_; | 233 scoped_ptr<CertVerifyResult> cert_verify_result_; |
231 std::string pinning_failure_log_; | 234 std::string pinning_failure_log_; |
232 ObserverSet observers_; | 235 ObserverSet observers_; |
(...skipping 11 matching lines...) Expand all Loading... | |
244 // on this session. Existing stream will continue to be processed. | 247 // on this session. Existing stream will continue to be processed. |
245 bool going_away_; | 248 bool going_away_; |
246 base::WeakPtrFactory<QuicClientSession> weak_factory_; | 249 base::WeakPtrFactory<QuicClientSession> weak_factory_; |
247 | 250 |
248 DISALLOW_COPY_AND_ASSIGN(QuicClientSession); | 251 DISALLOW_COPY_AND_ASSIGN(QuicClientSession); |
249 }; | 252 }; |
250 | 253 |
251 } // namespace net | 254 } // namespace net |
252 | 255 |
253 #endif // NET_QUIC_QUIC_CLIENT_SESSION_H_ | 256 #endif // NET_QUIC_QUIC_CLIENT_SESSION_H_ |
OLD | NEW |