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

Unified Diff: net/quic/quic_stream_sequencer.cc

Issue 935333002: Update from https://crrev.com/316786 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/quic/quic_stream_sequencer.h ('k') | net/quic/quic_stream_sequencer_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/quic_stream_sequencer.cc
diff --git a/net/quic/quic_stream_sequencer.cc b/net/quic/quic_stream_sequencer.cc
index ceeaa943a4898c3c2b08f85f8ba9fa141cb1b0fe..7f06ec46d9a6600e3fa3475c0c9852471e4b8fcf 100644
--- a/net/quic/quic_stream_sequencer.cc
+++ b/net/quic/quic_stream_sequencer.cc
@@ -11,7 +11,6 @@
#include "base/metrics/sparse_histogram.h"
#include "net/quic/reliable_quic_stream.h"
-using std::make_pair;
using std::min;
using std::numeric_limits;
using std::string;
@@ -25,7 +24,8 @@ QuicStreamSequencer::QuicStreamSequencer(ReliableQuicStream* quic_stream)
blocked_(false),
num_bytes_buffered_(0),
num_frames_received_(0),
- num_duplicate_frames_received_(0) {
+ num_duplicate_frames_received_(0),
+ num_early_frames_received_(0) {
}
QuicStreamSequencer::~QuicStreamSequencer() {
@@ -64,6 +64,10 @@ void QuicStreamSequencer::OnStreamFrame(const QuicStreamFrame& frame) {
IOVector data;
data.AppendIovec(frame.data.iovec(), frame.data.Size());
+ if (byte_offset > num_bytes_consumed_) {
+ ++num_early_frames_received_;
+ }
+
// If the frame has arrived in-order then we can process it immediately, only
// buffering if the stream is unable to process it.
if (!blocked_ && byte_offset == num_bytes_consumed_) {
@@ -98,7 +102,7 @@ void QuicStreamSequencer::OnStreamFrame(const QuicStreamFrame& frame) {
for (size_t i = 0; i < data.Size(); ++i) {
DVLOG(1) << "Buffering stream data at offset " << byte_offset;
const iovec& iov = data.iovec()[i];
- buffered_frames_.insert(make_pair(
+ buffered_frames_.insert(std::make_pair(
byte_offset, string(static_cast<char*>(iov.iov_base), iov.iov_len)));
byte_offset += iov.iov_len;
num_bytes_buffered_ += iov.iov_len;
@@ -190,8 +194,8 @@ int QuicStreamSequencer::Readv(const struct iovec* iov, size_t iov_len) {
}
// We've finished copying. If we have a partial frame, update it.
if (frame_offset != 0) {
- buffered_frames_.insert(
- make_pair(it->first + frame_offset, it->second.substr(frame_offset)));
+ buffered_frames_.insert(std::make_pair(it->first + frame_offset,
+ it->second.substr(frame_offset)));
buffered_frames_.erase(buffered_frames_.begin());
RecordBytesConsumed(frame_offset);
}
@@ -278,7 +282,7 @@ void QuicStreamSequencer::FlushBufferedFrames() {
} else {
string new_data = it->second.substr(bytes_consumed);
buffered_frames_.erase(it);
- buffered_frames_.insert(make_pair(num_bytes_consumed_, new_data));
+ buffered_frames_.insert(std::make_pair(num_bytes_consumed_, new_data));
return;
}
}
« no previous file with comments | « net/quic/quic_stream_sequencer.h ('k') | net/quic/quic_stream_sequencer_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698