Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(65)

Side by Side Diff: net/quic/chromium/quic_chromium_client_session.cc

Issue 2908243002: Remove QuicChromiumClientStream::Delegate in favor of async methods. (Closed)
Patch Set: No expect_trailers_ Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 return ERR_CONNECTION_CLOSED; 298 return ERR_CONNECTION_CLOSED;
299 299
300 // base::MakeUnique does not work because the StreamRequest constructor 300 // base::MakeUnique does not work because the StreamRequest constructor
301 // is private. 301 // is private.
302 stream_request_ = std::unique_ptr<StreamRequest>( 302 stream_request_ = std::unique_ptr<StreamRequest>(
303 new StreamRequest(this, requires_confirmation)); 303 new StreamRequest(this, requires_confirmation));
304 return stream_request_->StartRequest(callback); 304 return stream_request_->StartRequest(callback);
305 } 305 }
306 306
307 std::unique_ptr<QuicChromiumClientStream::Handle> 307 std::unique_ptr<QuicChromiumClientStream::Handle>
308 QuicChromiumClientSession::Handle::ReleaseStream( 308 QuicChromiumClientSession::Handle::ReleaseStream() {
309 QuicChromiumClientStream::Delegate* delegate) {
310 DCHECK(stream_request_); 309 DCHECK(stream_request_);
311 310
312 auto handle = stream_request_->ReleaseStream(delegate); 311 auto handle = stream_request_->ReleaseStream();
313 stream_request_.reset(); 312 stream_request_.reset();
314 return handle; 313 return handle;
315 } 314 }
316 315
317 int QuicChromiumClientSession::Handle::WaitForHandshakeConfirmation( 316 int QuicChromiumClientSession::Handle::WaitForHandshakeConfirmation(
318 const CompletionCallback& callback) { 317 const CompletionCallback& callback) {
319 if (!session_) 318 if (!session_)
320 return ERR_CONNECTION_CLOSED; 319 return ERR_CONNECTION_CLOSED;
321 320
322 return session_->WaitForHandshakeConfirmation(callback); 321 return session_->WaitForHandshakeConfirmation(callback);
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 373
375 next_state_ = STATE_WAIT_FOR_CONFIRMATION; 374 next_state_ = STATE_WAIT_FOR_CONFIRMATION;
376 int rv = DoLoop(OK); 375 int rv = DoLoop(OK);
377 if (rv == ERR_IO_PENDING) 376 if (rv == ERR_IO_PENDING)
378 callback_ = callback; 377 callback_ = callback;
379 378
380 return rv; 379 return rv;
381 } 380 }
382 381
383 std::unique_ptr<QuicChromiumClientStream::Handle> 382 std::unique_ptr<QuicChromiumClientStream::Handle>
384 QuicChromiumClientSession::StreamRequest::ReleaseStream( 383 QuicChromiumClientSession::StreamRequest::ReleaseStream() {
385 QuicChromiumClientStream::Delegate* delegate) {
386 DCHECK(stream_); 384 DCHECK(stream_);
387 QuicChromiumClientStream* stream = stream_; 385 QuicChromiumClientStream* stream = stream_;
388 stream_ = nullptr; 386 stream_ = nullptr;
389 return stream->CreateHandle(delegate); 387 return stream->CreateHandle();
390 } 388 }
391 389
392 void QuicChromiumClientSession::StreamRequest::OnRequestCompleteSuccess( 390 void QuicChromiumClientSession::StreamRequest::OnRequestCompleteSuccess(
393 QuicChromiumClientStream* stream) { 391 QuicChromiumClientStream* stream) {
394 DCHECK_EQ(STATE_REQUEST_STREAM_COMPLETE, next_state_); 392 DCHECK_EQ(STATE_REQUEST_STREAM_COMPLETE, next_state_);
395 393
396 stream_ = stream; 394 stream_ = stream;
397 // This method is called even when the request completes synchronously. 395 // This method is called even when the request completes synchronously.
398 if (callback_) 396 if (callback_)
399 DoCallback(OK); 397 DoCallback(OK);
(...skipping 1360 matching lines...) Expand 10 before | Expand all | Expand 10 after
1760 } 1758 }
1761 1759
1762 size_t QuicChromiumClientSession::EstimateMemoryUsage() const { 1760 size_t QuicChromiumClientSession::EstimateMemoryUsage() const {
1763 // TODO(xunjieli): Estimate |crypto_stream_|, QuicSpdySession's 1761 // TODO(xunjieli): Estimate |crypto_stream_|, QuicSpdySession's
1764 // QuicHeaderList, QuicSession's QuiCWriteBlockedList, open streams and 1762 // QuicHeaderList, QuicSession's QuiCWriteBlockedList, open streams and
1765 // unacked packet map. 1763 // unacked packet map.
1766 return base::trace_event::EstimateMemoryUsage(packet_readers_); 1764 return base::trace_event::EstimateMemoryUsage(packet_readers_);
1767 } 1765 }
1768 1766
1769 } // namespace net 1767 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/chromium/quic_chromium_client_session.h ('k') | net/quic/chromium/quic_chromium_client_session_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698