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_stream_sequencer.h" | 5 #include "net/quic/quic_stream_sequencer.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 close_offset_ = offset; | 98 close_offset_ = offset; |
99 | 99 |
100 MaybeCloseStream(); | 100 MaybeCloseStream(); |
101 } | 101 } |
102 | 102 |
103 bool QuicStreamSequencer::MaybeCloseStream() { | 103 bool QuicStreamSequencer::MaybeCloseStream() { |
104 if (!blocked_ && IsClosed()) { | 104 if (!blocked_ && IsClosed()) { |
105 DVLOG(1) << "Passing up termination, as we've processed " | 105 DVLOG(1) << "Passing up termination, as we've processed " |
106 << num_bytes_consumed_ << " of " << close_offset_ | 106 << num_bytes_consumed_ << " of " << close_offset_ |
107 << " bytes."; | 107 << " bytes."; |
| 108 // This will cause the stream to consume the fin. |
108 // Technically it's an error if num_bytes_consumed isn't exactly | 109 // Technically it's an error if num_bytes_consumed isn't exactly |
109 // equal, but error handling seems silly at this point. | 110 // equal, but error handling seems silly at this point. |
110 stream_->OnFinRead(); | 111 stream_->OnDataAvailable(); |
111 buffered_frames_.clear(); | 112 buffered_frames_.clear(); |
112 num_bytes_buffered_ = 0; | 113 num_bytes_buffered_ = 0; |
113 return true; | 114 return true; |
114 } | 115 } |
115 return false; | 116 return false; |
116 } | 117 } |
117 | 118 |
118 int QuicStreamSequencer::GetReadableRegions(iovec* iov, size_t iov_len) const { | 119 int QuicStreamSequencer::GetReadableRegions(iovec* iov, size_t iov_len) const { |
119 DCHECK(!blocked_); | 120 DCHECK(!blocked_); |
120 FrameList::const_iterator it = buffered_frames_.begin(); | 121 FrameList::const_iterator it = buffered_frames_.begin(); |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 } | 289 } |
289 | 290 |
290 void QuicStreamSequencer::RecordBytesConsumed(size_t bytes_consumed) { | 291 void QuicStreamSequencer::RecordBytesConsumed(size_t bytes_consumed) { |
291 num_bytes_consumed_ += bytes_consumed; | 292 num_bytes_consumed_ += bytes_consumed; |
292 num_bytes_buffered_ -= bytes_consumed; | 293 num_bytes_buffered_ -= bytes_consumed; |
293 | 294 |
294 stream_->AddBytesConsumed(bytes_consumed); | 295 stream_->AddBytesConsumed(bytes_consumed); |
295 } | 296 } |
296 | 297 |
297 } // namespace net | 298 } // namespace net |
OLD | NEW |