| 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_stream.h" | 5 #include "net/quic/chromium/quic_chromium_client_stream.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
| 10 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 namespace net { | 22 namespace net { |
| 23 | 23 |
| 24 QuicChromiumClientStream::QuicChromiumClientStream( | 24 QuicChromiumClientStream::QuicChromiumClientStream( |
| 25 QuicStreamId id, | 25 QuicStreamId id, |
| 26 QuicClientSessionBase* session, | 26 QuicClientSessionBase* session, |
| 27 const NetLogWithSource& net_log) | 27 const NetLogWithSource& net_log) |
| 28 : QuicSpdyStream(id, session), | 28 : QuicSpdyStream(id, session), |
| 29 net_log_(net_log), | 29 net_log_(net_log), |
| 30 delegate_(nullptr), | 30 delegate_(nullptr), |
| 31 headers_delivered_(false), | 31 headers_delivered_(false), |
| 32 initial_headers_sent_(false), |
| 32 session_(session), | 33 session_(session), |
| 33 can_migrate_(true), | 34 can_migrate_(true), |
| 34 weak_factory_(this) {} | 35 weak_factory_(this) {} |
| 35 | 36 |
| 36 QuicChromiumClientStream::~QuicChromiumClientStream() { | 37 QuicChromiumClientStream::~QuicChromiumClientStream() { |
| 37 if (delegate_) | 38 if (delegate_) |
| 38 delegate_->OnClose(); | 39 delegate_->OnClose(); |
| 39 } | 40 } |
| 40 | 41 |
| 41 void QuicChromiumClientStream::OnInitialHeadersComplete( | 42 void QuicChromiumClientStream::OnInitialHeadersComplete( |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 QuicReferenceCountedPointer<QuicAckListenerInterface> ack_listener) { | 127 QuicReferenceCountedPointer<QuicAckListenerInterface> ack_listener) { |
| 127 if (!session()->IsCryptoHandshakeConfirmed()) { | 128 if (!session()->IsCryptoHandshakeConfirmed()) { |
| 128 auto entry = header_block.find(":method"); | 129 auto entry = header_block.find(":method"); |
| 129 DCHECK(entry != header_block.end()); | 130 DCHECK(entry != header_block.end()); |
| 130 DCHECK_NE("POST", entry->second); | 131 DCHECK_NE("POST", entry->second); |
| 131 } | 132 } |
| 132 net_log_.AddEvent( | 133 net_log_.AddEvent( |
| 133 NetLogEventType::QUIC_CHROMIUM_CLIENT_STREAM_SEND_REQUEST_HEADERS, | 134 NetLogEventType::QUIC_CHROMIUM_CLIENT_STREAM_SEND_REQUEST_HEADERS, |
| 134 base::Bind(&QuicRequestNetLogCallback, id(), &header_block, | 135 base::Bind(&QuicRequestNetLogCallback, id(), &header_block, |
| 135 QuicSpdyStream::priority())); | 136 QuicSpdyStream::priority())); |
| 136 return QuicSpdyStream::WriteHeaders(std::move(header_block), fin, | 137 size_t len = QuicSpdyStream::WriteHeaders(std::move(header_block), fin, |
| 137 std::move(ack_listener)); | 138 std::move(ack_listener)); |
| 139 initial_headers_sent_ = true; |
| 140 return len; |
| 138 } | 141 } |
| 139 | 142 |
| 140 SpdyPriority QuicChromiumClientStream::priority() const { | 143 SpdyPriority QuicChromiumClientStream::priority() const { |
| 141 if (delegate_ && delegate_->HasSendHeadersComplete()) { | 144 return initial_headers_sent_ ? QuicSpdyStream::priority() |
| 142 return QuicSpdyStream::priority(); | 145 : kV3HighestPriority; |
| 143 } | |
| 144 return net::kV3HighestPriority; | |
| 145 } | 146 } |
| 146 | 147 |
| 147 int QuicChromiumClientStream::WriteStreamData( | 148 int QuicChromiumClientStream::WriteStreamData( |
| 148 QuicStringPiece data, | 149 QuicStringPiece data, |
| 149 bool fin, | 150 bool fin, |
| 150 const CompletionCallback& callback) { | 151 const CompletionCallback& callback) { |
| 151 // We should not have data buffered. | 152 // We should not have data buffered. |
| 152 DCHECK(!HasBufferedData()); | 153 DCHECK(!HasBufferedData()); |
| 153 // Writes the data, or buffers it. | 154 // Writes the data, or buffers it. |
| 154 WriteOrBufferData(data, fin, nullptr); | 155 WriteOrBufferData(data, fin, nullptr); |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 | 274 |
| 274 void QuicChromiumClientStream::DisableConnectionMigration() { | 275 void QuicChromiumClientStream::DisableConnectionMigration() { |
| 275 can_migrate_ = false; | 276 can_migrate_ = false; |
| 276 } | 277 } |
| 277 | 278 |
| 278 bool QuicChromiumClientStream::IsFirstStream() { | 279 bool QuicChromiumClientStream::IsFirstStream() { |
| 279 return id() == kHeadersStreamId + 2; | 280 return id() == kHeadersStreamId + 2; |
| 280 } | 281 } |
| 281 | 282 |
| 282 } // namespace net | 283 } // namespace net |
| OLD | NEW |