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_CHROMIUM_QUIC_CHROMIUM_CLIENT_SESSION_H_ | 10 #ifndef NET_QUIC_CHROMIUM_QUIC_CHROMIUM_CLIENT_SESSION_H_ |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 friend class QuicChromiumClientSession; | 199 friend class QuicChromiumClientSession; |
200 | 200 |
201 enum State { | 201 enum State { |
202 STATE_NONE, | 202 STATE_NONE, |
203 STATE_WAIT_FOR_CONFIRMATION, | 203 STATE_WAIT_FOR_CONFIRMATION, |
204 STATE_WAIT_FOR_CONFIRMATION_COMPLETE, | 204 STATE_WAIT_FOR_CONFIRMATION_COMPLETE, |
205 STATE_REQUEST_STREAM, | 205 STATE_REQUEST_STREAM, |
206 STATE_REQUEST_STREAM_COMPLETE, | 206 STATE_REQUEST_STREAM_COMPLETE, |
207 }; | 207 }; |
208 | 208 |
209 StreamRequest(std::unique_ptr<QuicChromiumClientSession::Handle> session, | 209 // |session| must outlive this request. |
| 210 StreamRequest(QuicChromiumClientSession::Handle* session, |
210 bool requires_confirmation); | 211 bool requires_confirmation); |
211 | 212 |
212 void OnIOComplete(int rv); | 213 void OnIOComplete(int rv); |
213 void DoCallback(int rv); | 214 void DoCallback(int rv); |
214 | 215 |
215 int DoLoop(int rv); | 216 int DoLoop(int rv); |
216 int DoWaitForConfirmation(); | 217 int DoWaitForConfirmation(); |
217 int DoWaitForConfirmationComplete(int rv); | 218 int DoWaitForConfirmationComplete(int rv); |
218 int DoRequestStream(); | 219 int DoRequestStream(); |
219 int DoRequestStreamComplete(int rv); | 220 int DoRequestStreamComplete(int rv); |
220 | 221 |
221 // Called by |session_| for an asynchronous request when the stream | 222 // Called by |session_| for an asynchronous request when the stream |
222 // request has finished successfully. | 223 // request has finished successfully. |
223 void OnRequestCompleteSuccess(QuicChromiumClientStream* stream); | 224 void OnRequestCompleteSuccess(QuicChromiumClientStream* stream); |
224 | 225 |
225 // Called by |session_| for an asynchronous request when the stream | 226 // Called by |session_| for an asynchronous request when the stream |
226 // request has finished with an error. Also called with ERR_ABORTED | 227 // request has finished with an error. Also called with ERR_ABORTED |
227 // if |session_| is destroyed while the stream request is still pending. | 228 // if |session_| is destroyed while the stream request is still pending. |
228 void OnRequestCompleteFailure(int rv); | 229 void OnRequestCompleteFailure(int rv); |
229 | 230 |
230 std::unique_ptr<QuicChromiumClientSession::Handle> session_; | 231 QuicChromiumClientSession::Handle* session_; |
231 const bool requires_confirmation_; | 232 const bool requires_confirmation_; |
232 CompletionCallback callback_; | 233 CompletionCallback callback_; |
233 QuicChromiumClientStream* stream_; | 234 QuicChromiumClientStream* stream_; |
234 // For tracking how much time pending stream requests wait. | 235 // For tracking how much time pending stream requests wait. |
235 base::TimeTicks pending_start_time_; | 236 base::TimeTicks pending_start_time_; |
236 State next_state_; | 237 State next_state_; |
237 | 238 |
238 base::WeakPtrFactory<StreamRequest> weak_factory_; | 239 base::WeakPtrFactory<StreamRequest> weak_factory_; |
239 | 240 |
240 DISALLOW_COPY_AND_ASSIGN(StreamRequest); | 241 DISALLOW_COPY_AND_ASSIGN(StreamRequest); |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
530 // the current sockets_.size() == the passed in value. | 531 // the current sockets_.size() == the passed in value. |
531 bool migration_pending_; // True while migration is underway. | 532 bool migration_pending_; // True while migration is underway. |
532 base::WeakPtrFactory<QuicChromiumClientSession> weak_factory_; | 533 base::WeakPtrFactory<QuicChromiumClientSession> weak_factory_; |
533 | 534 |
534 DISALLOW_COPY_AND_ASSIGN(QuicChromiumClientSession); | 535 DISALLOW_COPY_AND_ASSIGN(QuicChromiumClientSession); |
535 }; | 536 }; |
536 | 537 |
537 } // namespace net | 538 } // namespace net |
538 | 539 |
539 #endif // NET_QUIC_CHROMIUM_QUIC_CHROMIUM_CLIENT_SESSION_H_ | 540 #endif // NET_QUIC_CHROMIUM_QUIC_CHROMIUM_CLIENT_SESSION_H_ |
OLD | NEW |