Chromium Code Reviews| 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/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 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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() { | 177 int QuicHttpStream::DoStreamRequest() { |
| 178 if (session_.get() == nullptr) { | |
|
xunjieli
2016/06/07 23:46:25
Could just do "if (!session_)". It's more consiste
ramant (doing other things)
2016/06/07 23:58:32
Regarding WeakPtr, the following discussion could
ramant (doing other things)
2016/06/18 00:18:05
Uploaded CL: https://codereview.chromium.org/20733
| |
| 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 } | |
| 178 int rv = stream_request_.StartRequest( | 184 int rv = stream_request_.StartRequest( |
| 179 session_, &stream_, | 185 session_, &stream_, |
| 180 base::Bind(&QuicHttpStream::OnStreamReady, weak_factory_.GetWeakPtr())); | 186 base::Bind(&QuicHttpStream::OnStreamReady, weak_factory_.GetWeakPtr())); |
| 181 if (rv == OK) { | 187 if (rv == OK) { |
| 182 stream_->SetDelegate(this); | 188 stream_->SetDelegate(this); |
| 183 if (request_info_->load_flags & LOAD_DISABLE_CONNECTION_MIGRATION) { | 189 if (request_info_->load_flags & LOAD_DISABLE_CONNECTION_MIGRATION) { |
| 184 stream_->DisableConnectionMigration(); | 190 stream_->DisableConnectionMigration(); |
| 185 } | 191 } |
| 186 if (response_info_) { | 192 if (response_info_) { |
| 187 next_state_ = STATE_SET_REQUEST_PRIORITY; | 193 next_state_ = STATE_SET_REQUEST_PRIORITY; |
| (...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 772 closed_stream_sent_bytes_ = stream_->stream_bytes_written(); | 778 closed_stream_sent_bytes_ = stream_->stream_bytes_written(); |
| 773 stream_ = nullptr; | 779 stream_ = nullptr; |
| 774 | 780 |
| 775 // 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 |
| 776 // read. | 782 // read. |
| 777 if (request_body_stream_) | 783 if (request_body_stream_) |
| 778 request_body_stream_->Reset(); | 784 request_body_stream_->Reset(); |
| 779 } | 785 } |
| 780 | 786 |
| 781 } // namespace net | 787 } // namespace net |
| OLD | NEW |