Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1510)

Side by Side Diff: net/quic/core/quic_stream_sequencer.cc

Issue 2430973004: Landing Recent QUIC changes until 10:38 AM, Oct 17, 2016 UTC-4 (Closed)
Patch Set: Improving flagsaver logging Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/quic/core/quic_spdy_stream_test.cc ('k') | net/quic/core/quic_stream_sequencer_buffer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/core/quic_stream_sequencer.h" 5 #include "net/quic/core/quic_stream_sequencer.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 DCHECK(!blocked_); 135 DCHECK(!blocked_);
136 return buffered_frames_.GetReadableRegion(iov, timestamp); 136 return buffered_frames_.GetReadableRegion(iov, timestamp);
137 } 137 }
138 138
139 int QuicStreamSequencer::Readv(const struct iovec* iov, size_t iov_len) { 139 int QuicStreamSequencer::Readv(const struct iovec* iov, size_t iov_len) {
140 DCHECK(!blocked_); 140 DCHECK(!blocked_);
141 string error_details; 141 string error_details;
142 size_t bytes_read; 142 size_t bytes_read;
143 QuicErrorCode read_error = 143 QuicErrorCode read_error =
144 buffered_frames_.Readv(iov, iov_len, &bytes_read, &error_details); 144 buffered_frames_.Readv(iov, iov_len, &bytes_read, &error_details);
145 if (FLAGS_quic_stream_sequencer_buffer_debug && read_error != QUIC_NO_ERROR) { 145 if (read_error != QUIC_NO_ERROR) {
146 string details = StringPrintf("Stream %" PRIu32 ": %s", stream_->id(), 146 string details = StringPrintf("Stream %" PRIu32 ": %s", stream_->id(),
147 error_details.c_str()); 147 error_details.c_str());
148 stream_->CloseConnectionWithDetails(read_error, details); 148 stream_->CloseConnectionWithDetails(read_error, details);
149 return static_cast<int>(bytes_read); 149 return static_cast<int>(bytes_read);
150 } 150 }
151 151
152 stream_->AddBytesConsumed(bytes_read); 152 stream_->AddBytesConsumed(bytes_read);
153 return static_cast<int>(bytes_read); 153 return static_cast<int>(bytes_read);
154 } 154 }
155 155
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 } 191 }
192 ignore_read_data_ = true; 192 ignore_read_data_ = true;
193 FlushBufferedFrames(); 193 FlushBufferedFrames();
194 } 194 }
195 195
196 void QuicStreamSequencer::ReleaseBuffer() { 196 void QuicStreamSequencer::ReleaseBuffer() {
197 buffered_frames_.ReleaseWholeBuffer(); 197 buffered_frames_.ReleaseWholeBuffer();
198 } 198 }
199 199
200 void QuicStreamSequencer::ReleaseBufferIfEmpty() { 200 void QuicStreamSequencer::ReleaseBufferIfEmpty() {
201 if (FLAGS_quic_release_crypto_stream_buffer && buffered_frames_.Empty()) { 201 if (buffered_frames_.Empty()) {
202 buffered_frames_.ReleaseWholeBuffer(); 202 buffered_frames_.ReleaseWholeBuffer();
203 } 203 }
204 } 204 }
205 205
206 void QuicStreamSequencer::FlushBufferedFrames() { 206 void QuicStreamSequencer::FlushBufferedFrames() {
207 DCHECK(ignore_read_data_); 207 DCHECK(ignore_read_data_);
208 size_t bytes_flushed = buffered_frames_.FlushBufferedFrames(); 208 size_t bytes_flushed = buffered_frames_.FlushBufferedFrames();
209 DVLOG(1) << "Flushing buffered data at offset " 209 DVLOG(1) << "Flushing buffered data at offset "
210 << buffered_frames_.BytesConsumed() << " length " << bytes_flushed 210 << buffered_frames_.BytesConsumed() << " length " << bytes_flushed
211 << " for stream " << stream_->id(); 211 << " for stream " << stream_->id();
(...skipping 15 matching lines...) Expand all
227 "\n bytes buffered: " + IntToString(NumBytesBuffered()) + 227 "\n bytes buffered: " + IntToString(NumBytesBuffered()) +
228 "\n bytes consumed: " + IntToString( NumBytesConsumed()) + 228 "\n bytes consumed: " + IntToString( NumBytesConsumed()) +
229 "\n has bytes to read: " + (HasBytesToRead() ? "true" : "false") + 229 "\n has bytes to read: " + (HasBytesToRead() ? "true" : "false") +
230 "\n frames received: " + IntToString(num_frames_received()) + 230 "\n frames received: " + IntToString(num_frames_received()) +
231 "\n close offset bytes: " + IntToString( close_offset_) + 231 "\n close offset bytes: " + IntToString( close_offset_) +
232 "\n is closed: " + (IsClosed() ? "true" : "false"); 232 "\n is closed: " + (IsClosed() ? "true" : "false");
233 // clang-format on 233 // clang-format on
234 } 234 }
235 235
236 } // namespace net 236 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/core/quic_spdy_stream_test.cc ('k') | net/quic/core/quic_stream_sequencer_buffer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698