| 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_chromium_client_stream.h" | 5 #include "net/quic/quic_chromium_client_stream.h" |
| 6 | 6 |
| 7 #include <utility> |
| 8 |
| 7 #include "base/callback_helpers.h" | 9 #include "base/callback_helpers.h" |
| 8 #include "base/location.h" | 10 #include "base/location.h" |
| 9 #include "base/threading/thread_task_runner_handle.h" | 11 #include "base/threading/thread_task_runner_handle.h" |
| 10 #include "net/base/io_buffer.h" | 12 #include "net/base/io_buffer.h" |
| 11 #include "net/base/net_errors.h" | 13 #include "net/base/net_errors.h" |
| 12 #include "net/quic/quic_chromium_client_session.h" | 14 #include "net/quic/quic_chromium_client_session.h" |
| 13 #include "net/quic/quic_http_utils.h" | 15 #include "net/quic/quic_http_utils.h" |
| 14 #include "net/quic/quic_spdy_session.h" | 16 #include "net/quic/quic_spdy_session.h" |
| 15 #include "net/quic/quic_write_blocked_list.h" | 17 #include "net/quic/quic_write_blocked_list.h" |
| 16 #include "net/quic/spdy_utils.h" | 18 #include "net/quic/spdy_utils.h" |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 | 131 |
| 130 void QuicChromiumClientStream::OnCanWrite() { | 132 void QuicChromiumClientStream::OnCanWrite() { |
| 131 ReliableQuicStream::OnCanWrite(); | 133 ReliableQuicStream::OnCanWrite(); |
| 132 | 134 |
| 133 if (!HasBufferedData() && !callback_.is_null()) { | 135 if (!HasBufferedData() && !callback_.is_null()) { |
| 134 base::ResetAndReturn(&callback_).Run(OK); | 136 base::ResetAndReturn(&callback_).Run(OK); |
| 135 } | 137 } |
| 136 } | 138 } |
| 137 | 139 |
| 138 size_t QuicChromiumClientStream::WriteHeaders( | 140 size_t QuicChromiumClientStream::WriteHeaders( |
| 139 const SpdyHeaderBlock& header_block, | 141 SpdyHeaderBlock header_block, |
| 140 bool fin, | 142 bool fin, |
| 141 QuicAckListenerInterface* ack_notifier_delegate) { | 143 QuicAckListenerInterface* ack_notifier_delegate) { |
| 142 if (!session()->IsCryptoHandshakeConfirmed()) { | 144 if (!session()->IsCryptoHandshakeConfirmed()) { |
| 143 auto entry = header_block.find(":method"); | 145 auto entry = header_block.find(":method"); |
| 144 DCHECK(entry != header_block.end()); | 146 DCHECK(entry != header_block.end()); |
| 145 DCHECK_NE("POST", entry->second); | 147 DCHECK_NE("POST", entry->second); |
| 146 } | 148 } |
| 147 net_log_.AddEvent( | 149 net_log_.AddEvent( |
| 148 NetLog::TYPE_QUIC_CHROMIUM_CLIENT_STREAM_SEND_REQUEST_HEADERS, | 150 NetLog::TYPE_QUIC_CHROMIUM_CLIENT_STREAM_SEND_REQUEST_HEADERS, |
| 149 base::Bind(&QuicRequestNetLogCallback, id(), &header_block, | 151 base::Bind(&QuicRequestNetLogCallback, id(), &header_block, |
| 150 QuicSpdyStream::priority())); | 152 QuicSpdyStream::priority())); |
| 151 return QuicSpdyStream::WriteHeaders(header_block, fin, ack_notifier_delegate); | 153 return QuicSpdyStream::WriteHeaders(std::move(header_block), fin, |
| 154 ack_notifier_delegate); |
| 152 } | 155 } |
| 153 | 156 |
| 154 SpdyPriority QuicChromiumClientStream::priority() const { | 157 SpdyPriority QuicChromiumClientStream::priority() const { |
| 155 if (delegate_ && delegate_->HasSendHeadersComplete()) { | 158 if (delegate_ && delegate_->HasSendHeadersComplete()) { |
| 156 return QuicSpdyStream::priority(); | 159 return QuicSpdyStream::priority(); |
| 157 } | 160 } |
| 158 return net::kV3HighestPriority; | 161 return net::kV3HighestPriority; |
| 159 } | 162 } |
| 160 | 163 |
| 161 int QuicChromiumClientStream::WriteStreamData( | 164 int QuicChromiumClientStream::WriteStreamData( |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 } else { | 291 } else { |
| 289 delegate_tasks_.push_back(closure); | 292 delegate_tasks_.push_back(closure); |
| 290 } | 293 } |
| 291 } | 294 } |
| 292 | 295 |
| 293 void QuicChromiumClientStream::DisableConnectionMigration() { | 296 void QuicChromiumClientStream::DisableConnectionMigration() { |
| 294 can_migrate_ = false; | 297 can_migrate_ = false; |
| 295 } | 298 } |
| 296 | 299 |
| 297 } // namespace net | 300 } // namespace net |
| OLD | NEW |