| 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 #include "net/quic/chromium/quic_chromium_client_session.h" | 5 #include "net/quic/chromium/quic_chromium_client_session.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/callback_helpers.h" | 9 #include "base/callback_helpers.h" |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 if (!session_) | 294 if (!session_) |
| 295 return ERR_CONNECTION_CLOSED; | 295 return ERR_CONNECTION_CLOSED; |
| 296 | 296 |
| 297 // base::MakeUnique does not work because the StreamRequest constructor | 297 // base::MakeUnique does not work because the StreamRequest constructor |
| 298 // is private. | 298 // is private. |
| 299 stream_request_ = std::unique_ptr<StreamRequest>( | 299 stream_request_ = std::unique_ptr<StreamRequest>( |
| 300 new StreamRequest(this, requires_confirmation)); | 300 new StreamRequest(this, requires_confirmation)); |
| 301 return stream_request_->StartRequest(callback); | 301 return stream_request_->StartRequest(callback); |
| 302 } | 302 } |
| 303 | 303 |
| 304 QuicChromiumClientStream* QuicChromiumClientSession::Handle::ReleaseStream() { | 304 QuicChromiumClientStream* QuicChromiumClientSession::Handle::ReleaseStream( |
| 305 QuicChromiumClientStream::Delegate* delegate) { |
| 305 DCHECK(stream_request_); | 306 DCHECK(stream_request_); |
| 306 | 307 |
| 307 auto* stream = stream_request_->ReleaseStream(); | 308 auto* stream = stream_request_->ReleaseStream(delegate); |
| 308 stream_request_.reset(); | 309 stream_request_.reset(); |
| 309 return stream; | 310 return stream; |
| 310 } | 311 } |
| 311 | 312 |
| 312 int QuicChromiumClientSession::Handle::WaitForHandshakeConfirmation( | 313 int QuicChromiumClientSession::Handle::WaitForHandshakeConfirmation( |
| 313 const CompletionCallback& callback) { | 314 const CompletionCallback& callback) { |
| 314 if (!session_) | 315 if (!session_) |
| 315 return ERR_CONNECTION_CLOSED; | 316 return ERR_CONNECTION_CLOSED; |
| 316 | 317 |
| 317 return session_->WaitForHandshakeConfirmation(callback); | 318 return session_->WaitForHandshakeConfirmation(callback); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 369 | 370 |
| 370 next_state_ = STATE_WAIT_FOR_CONFIRMATION; | 371 next_state_ = STATE_WAIT_FOR_CONFIRMATION; |
| 371 int rv = DoLoop(OK); | 372 int rv = DoLoop(OK); |
| 372 if (rv == ERR_IO_PENDING) | 373 if (rv == ERR_IO_PENDING) |
| 373 callback_ = callback; | 374 callback_ = callback; |
| 374 | 375 |
| 375 return rv; | 376 return rv; |
| 376 } | 377 } |
| 377 | 378 |
| 378 QuicChromiumClientStream* | 379 QuicChromiumClientStream* |
| 379 QuicChromiumClientSession::StreamRequest::ReleaseStream() { | 380 QuicChromiumClientSession::StreamRequest::ReleaseStream( |
| 381 QuicChromiumClientStream::Delegate* delegate) { |
| 380 DCHECK(stream_); | 382 DCHECK(stream_); |
| 381 QuicChromiumClientStream* stream = stream_; | 383 QuicChromiumClientStream* stream = stream_; |
| 382 stream_ = nullptr; | 384 stream_ = nullptr; |
| 385 stream->SetDelegate(delegate); |
| 383 return stream; | 386 return stream; |
| 384 } | 387 } |
| 385 | 388 |
| 386 void QuicChromiumClientSession::StreamRequest::OnRequestCompleteSuccess( | 389 void QuicChromiumClientSession::StreamRequest::OnRequestCompleteSuccess( |
| 387 QuicChromiumClientStream* stream) { | 390 QuicChromiumClientStream* stream) { |
| 388 DCHECK_EQ(STATE_REQUEST_STREAM_COMPLETE, next_state_); | 391 DCHECK_EQ(STATE_REQUEST_STREAM_COMPLETE, next_state_); |
| 389 | 392 |
| 390 stream_ = stream; | 393 stream_ = stream; |
| 391 // This method is called even when the request completes synchronously. | 394 // This method is called even when the request completes synchronously. |
| 392 if (callback_) | 395 if (callback_) |
| (...skipping 1361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1754 } | 1757 } |
| 1755 | 1758 |
| 1756 size_t QuicChromiumClientSession::EstimateMemoryUsage() const { | 1759 size_t QuicChromiumClientSession::EstimateMemoryUsage() const { |
| 1757 // TODO(xunjieli): Estimate |crypto_stream_|, QuicSpdySession's | 1760 // TODO(xunjieli): Estimate |crypto_stream_|, QuicSpdySession's |
| 1758 // QuicHeaderList, QuicSession's QuiCWriteBlockedList, open streams and | 1761 // QuicHeaderList, QuicSession's QuiCWriteBlockedList, open streams and |
| 1759 // unacked packet map. | 1762 // unacked packet map. |
| 1760 return base::trace_event::EstimateMemoryUsage(packet_readers_); | 1763 return base::trace_event::EstimateMemoryUsage(packet_readers_); |
| 1761 } | 1764 } |
| 1762 | 1765 |
| 1763 } // namespace net | 1766 } // namespace net |
| OLD | NEW |