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

Side by Side Diff: net/quic/quic_http_stream.cc

Issue 2075903002: Reorder DoFoo methods in QuicHttpStream's .cc file to match .h and remove two unused methods from t… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 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
« no previous file with comments | « net/quic/quic_http_stream.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/quic_http_stream.h" 5 #include "net/quic/quic_http_stream.h"
6 6
7 #include "base/callback_helpers.h" 7 #include "base/callback_helpers.h"
8 #include "base/metrics/histogram_macros.h" 8 #include "base/metrics/histogram_macros.h"
9 #include "base/strings/string_split.h" 9 #include "base/strings/string_split.h"
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 } 167 }
168 168
169 next_state_ = STATE_REQUEST_STREAM; 169 next_state_ = STATE_REQUEST_STREAM;
170 int rv = DoLoop(OK); 170 int rv = DoLoop(OK);
171 if (rv == ERR_IO_PENDING) 171 if (rv == ERR_IO_PENDING)
172 callback_ = callback; 172 callback_ = callback;
173 173
174 return rv; 174 return rv;
175 } 175 }
176 176
177 int QuicHttpStream::DoStreamRequest() {
178 if (session_.get() == nullptr) {
179 // TODO(rtenneti) Bug: b/28676259 - a temporary fix until we find out why
180 // |session_| could be a nullptr.
181 return was_handshake_confirmed_ ? ERR_CONNECTION_CLOSED
182 : ERR_QUIC_HANDSHAKE_FAILED;
183 }
184 int rv = stream_request_.StartRequest(
185 session_, &stream_,
186 base::Bind(&QuicHttpStream::OnStreamReady, weak_factory_.GetWeakPtr()));
187 if (rv == OK) {
188 stream_->SetDelegate(this);
189 if (request_info_->load_flags & LOAD_DISABLE_CONNECTION_MIGRATION) {
190 stream_->DisableConnectionMigration();
191 }
192 if (response_info_) {
193 next_state_ = STATE_SET_REQUEST_PRIORITY;
194 }
195 } else if (rv != ERR_IO_PENDING && !was_handshake_confirmed_) {
196 rv = ERR_QUIC_HANDSHAKE_FAILED;
197 }
198 return rv;
199 }
200
201 int QuicHttpStream::DoSetRequestPriority() {
202 // Set priority according to request and, and advance to
203 // STATE_SEND_HEADERS.
204 DCHECK(stream_);
205 DCHECK(response_info_);
206 SpdyPriority priority = ConvertRequestPriorityToQuicPriority(priority_);
207 stream_->SetPriority(priority);
208 next_state_ = STATE_SEND_HEADERS;
209 return OK;
210 }
211
212 void QuicHttpStream::OnStreamReady(int rv) { 177 void QuicHttpStream::OnStreamReady(int rv) {
213 DCHECK(rv == OK || !stream_); 178 DCHECK(rv == OK || !stream_);
214 if (rv == OK) { 179 if (rv == OK) {
215 stream_->SetDelegate(this); 180 stream_->SetDelegate(this);
216 if (request_info_->load_flags & LOAD_DISABLE_CONNECTION_MIGRATION) { 181 if (request_info_->load_flags & LOAD_DISABLE_CONNECTION_MIGRATION) {
217 stream_->DisableConnectionMigration(); 182 stream_->DisableConnectionMigration();
218 } 183 }
219 if (response_info_) { 184 if (response_info_) {
220 // This happens in the case of a asynchronous push rendezvous 185 // This happens in the case of a asynchronous push rendezvous
221 // that ultimately fails (e.g. vary failure). |response_info_| 186 // that ultimately fails (e.g. vary failure). |response_info_|
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after
624 default: 589 default:
625 NOTREACHED() << "next_state_: " << next_state_; 590 NOTREACHED() << "next_state_: " << next_state_;
626 break; 591 break;
627 } 592 }
628 } while (next_state_ != STATE_NONE && next_state_ != STATE_OPEN && 593 } while (next_state_ != STATE_NONE && next_state_ != STATE_OPEN &&
629 rv != ERR_IO_PENDING); 594 rv != ERR_IO_PENDING);
630 595
631 return rv; 596 return rv;
632 } 597 }
633 598
599 int QuicHttpStream::DoStreamRequest() {
600 if (session_.get() == nullptr) {
601 // TODO(rtenneti) Bug: b/28676259 - a temporary fix until we find out why
602 // |session_| could be a nullptr.
603 return was_handshake_confirmed_ ? ERR_CONNECTION_CLOSED
604 : ERR_QUIC_HANDSHAKE_FAILED;
605 }
606 int rv = stream_request_.StartRequest(
607 session_, &stream_,
608 base::Bind(&QuicHttpStream::OnStreamReady, weak_factory_.GetWeakPtr()));
609 if (rv == OK) {
610 stream_->SetDelegate(this);
611 if (request_info_->load_flags & LOAD_DISABLE_CONNECTION_MIGRATION) {
612 stream_->DisableConnectionMigration();
613 }
614 if (response_info_) {
615 next_state_ = STATE_SET_REQUEST_PRIORITY;
616 }
617 } else if (rv != ERR_IO_PENDING && !was_handshake_confirmed_) {
618 rv = ERR_QUIC_HANDSHAKE_FAILED;
619 }
620 return rv;
621 }
622
623 int QuicHttpStream::DoSetRequestPriority() {
624 // Set priority according to request and, and advance to
625 // STATE_SEND_HEADERS.
626 DCHECK(stream_);
627 DCHECK(response_info_);
628 SpdyPriority priority = ConvertRequestPriorityToQuicPriority(priority_);
629 stream_->SetPriority(priority);
630 next_state_ = STATE_SEND_HEADERS;
631 return OK;
632 }
633
634 int QuicHttpStream::DoSendHeaders() { 634 int QuicHttpStream::DoSendHeaders() {
635 if (!stream_) 635 if (!stream_)
636 return ERR_UNEXPECTED; 636 return ERR_UNEXPECTED;
637 637
638 // Log the actual request with the URL Request's net log. 638 // Log the actual request with the URL Request's net log.
639 stream_net_log_.AddEvent( 639 stream_net_log_.AddEvent(
640 NetLog::TYPE_HTTP_TRANSACTION_QUIC_SEND_REQUEST_HEADERS, 640 NetLog::TYPE_HTTP_TRANSACTION_QUIC_SEND_REQUEST_HEADERS,
641 base::Bind(&QuicRequestNetLogCallback, stream_->id(), &request_headers_, 641 base::Bind(&QuicRequestNetLogCallback, stream_->id(), &request_headers_,
642 priority_)); 642 priority_));
643 bool has_upload_data = request_body_stream_ != nullptr; 643 bool has_upload_data = request_body_stream_ != nullptr;
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
778 closed_stream_sent_bytes_ = stream_->stream_bytes_written(); 778 closed_stream_sent_bytes_ = stream_->stream_bytes_written();
779 stream_ = nullptr; 779 stream_ = nullptr;
780 780
781 // If |request_body_stream_| is non-NULL, Reset it, to abort any in progress 781 // If |request_body_stream_| is non-NULL, Reset it, to abort any in progress
782 // read. 782 // read.
783 if (request_body_stream_) 783 if (request_body_stream_)
784 request_body_stream_->Reset(); 784 request_body_stream_->Reset();
785 } 785 }
786 786
787 } // namespace net 787 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_http_stream.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698