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

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

Issue 2844493002: QuicChromiumClientSession::StreamRequest to be created by the session (Closed)
Patch Set: Rebase Created 3 years, 8 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/bidirectional_stream_quic_impl.h" 5 #include "net/quic/chromium/bidirectional_stream_quic_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 send_request_headers_automatically_ = send_request_headers_automatically; 66 send_request_headers_automatically_ = send_request_headers_automatically;
67 if (!session_) { 67 if (!session_) {
68 NotifyError(was_handshake_confirmed_ ? ERR_QUIC_PROTOCOL_ERROR 68 NotifyError(was_handshake_confirmed_ ? ERR_QUIC_PROTOCOL_ERROR
69 : ERR_QUIC_HANDSHAKE_FAILED); 69 : ERR_QUIC_HANDSHAKE_FAILED);
70 return; 70 return;
71 } 71 }
72 72
73 delegate_ = delegate; 73 delegate_ = delegate;
74 request_info_ = request_info; 74 request_info_ = request_info;
75 75
76 int rv = stream_request_.StartRequest( 76 stream_request_ = session_->CreateStreamRequest();
77 session_, &stream_, 77 int rv = stream_request_->StartRequest(base::Bind(
78 base::Bind(&BidirectionalStreamQuicImpl::OnStreamReady, 78 &BidirectionalStreamQuicImpl::OnStreamReady, weak_factory_.GetWeakPtr()));
79 weak_factory_.GetWeakPtr()));
80 if (rv == OK) { 79 if (rv == OK) {
81 OnStreamReady(rv); 80 OnStreamReady(rv);
82 } else if (!was_handshake_confirmed_) { 81 } else if (!was_handshake_confirmed_) {
83 NotifyError(ERR_QUIC_HANDSHAKE_FAILED); 82 NotifyError(ERR_QUIC_HANDSHAKE_FAILED);
84 } 83 }
85 } 84 }
86 85
87 void BidirectionalStreamQuicImpl::SendRequestHeaders() { 86 void BidirectionalStreamQuicImpl::SendRequestHeaders() {
88 DCHECK(!has_sent_headers_); 87 DCHECK(!has_sent_headers_);
89 if (!stream_) { 88 if (!stream_) {
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 bool /*port_migration_detected*/) { 298 bool /*port_migration_detected*/) {
300 DCHECK_NE(OK, error); 299 DCHECK_NE(OK, error);
301 session_.reset(); 300 session_.reset();
302 NotifyError(error); 301 NotifyError(error);
303 } 302 }
304 303
305 void BidirectionalStreamQuicImpl::OnStreamReady(int rv) { 304 void BidirectionalStreamQuicImpl::OnStreamReady(int rv) {
306 DCHECK_NE(ERR_IO_PENDING, rv); 305 DCHECK_NE(ERR_IO_PENDING, rv);
307 DCHECK(rv == OK || !stream_); 306 DCHECK(rv == OK || !stream_);
308 if (rv == OK) { 307 if (rv == OK) {
308 stream_ = stream_request_->ReleaseStream();
309 stream_request_.reset();
309 stream_->SetDelegate(this); 310 stream_->SetDelegate(this);
310 if (!was_handshake_confirmed_ && request_info_->method == "POST") { 311 if (!was_handshake_confirmed_ && request_info_->method == "POST") {
311 waiting_for_confirmation_ = true; 312 waiting_for_confirmation_ = true;
312 return; 313 return;
313 } 314 }
314 NotifyStreamReady(); 315 NotifyStreamReady();
315 } else { 316 } else {
316 NotifyError(rv); 317 NotifyError(rv);
317 } 318 }
318 } 319 }
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 if (!stream_) 356 if (!stream_)
356 return; 357 return;
357 closed_stream_received_bytes_ = stream_->stream_bytes_read(); 358 closed_stream_received_bytes_ = stream_->stream_bytes_read();
358 closed_stream_sent_bytes_ = stream_->stream_bytes_written(); 359 closed_stream_sent_bytes_ = stream_->stream_bytes_written();
359 closed_is_first_stream_ = stream_->IsFirstStream(); 360 closed_is_first_stream_ = stream_->IsFirstStream();
360 stream_->SetDelegate(nullptr); 361 stream_->SetDelegate(nullptr);
361 stream_ = nullptr; 362 stream_ = nullptr;
362 } 363 }
363 364
364 } // namespace net 365 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/chromium/bidirectional_stream_quic_impl.h ('k') | net/quic/chromium/quic_chromium_client_session.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698