| 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 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 if (IsDoneReading()) | 209 if (IsDoneReading()) |
| 210 return 0; // EOF | 210 return 0; // EOF |
| 211 | 211 |
| 212 if (!HasBytesToRead()) | 212 if (!HasBytesToRead()) |
| 213 return ERR_IO_PENDING; | 213 return ERR_IO_PENDING; |
| 214 | 214 |
| 215 iovec iov; | 215 iovec iov; |
| 216 iov.iov_base = buf->data(); | 216 iov.iov_base = buf->data(); |
| 217 iov.iov_len = buf_len; | 217 iov.iov_len = buf_len; |
| 218 size_t bytes_read = Readv(&iov, 1); | 218 size_t bytes_read = Readv(&iov, 1); |
| 219 // If no more body bytes and trailers are to be delivered, return | 219 // Since HasBytesToRead is true, Readv() must of read some data. |
| 220 // ERR_IO_PENDING now because onDataAvailable() will be called after trailers. | 220 DCHECK_NE(0u, bytes_read); |
| 221 if (bytes_read == 0 && !FinishedReadingTrailers()) | |
| 222 return ERR_IO_PENDING; | |
| 223 return bytes_read; | 221 return bytes_read; |
| 224 } | 222 } |
| 225 | 223 |
| 226 bool QuicChromiumClientStream::CanWrite(const CompletionCallback& callback) { | 224 bool QuicChromiumClientStream::CanWrite(const CompletionCallback& callback) { |
| 227 bool can_write = session()->connection()->CanWrite(HAS_RETRANSMITTABLE_DATA); | 225 bool can_write = session()->connection()->CanWrite(HAS_RETRANSMITTABLE_DATA); |
| 228 if (!can_write) { | 226 if (!can_write) { |
| 229 session()->MarkConnectionLevelWriteBlocked(id()); | 227 session()->MarkConnectionLevelWriteBlocked(id()); |
| 230 DCHECK(callback_.is_null()); | 228 DCHECK(callback_.is_null()); |
| 231 callback_ = callback; | 229 callback_ = callback; |
| 232 } | 230 } |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 | 283 |
| 286 void QuicChromiumClientStream::DisableConnectionMigration() { | 284 void QuicChromiumClientStream::DisableConnectionMigration() { |
| 287 can_migrate_ = false; | 285 can_migrate_ = false; |
| 288 } | 286 } |
| 289 | 287 |
| 290 bool QuicChromiumClientStream::IsFirstStream() { | 288 bool QuicChromiumClientStream::IsFirstStream() { |
| 291 return id() == kHeadersStreamId + 2; | 289 return id() == kHeadersStreamId + 2; |
| 292 } | 290 } |
| 293 | 291 |
| 294 } // namespace net | 292 } // namespace net |
| OLD | NEW |