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

Side by Side Diff: net/quic/test_tools/quic_stream_sequencer_buffer_peer.cc

Issue 2487613002: Landing Recent QUIC changes until 12:43 PM, Nov 5, 2016 UTC+8 (Closed)
Patch Set: Created 4 years, 1 month 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/test_tools/quic_stream_peer.cc ('k') | net/quic/test_tools/quic_test_utils.h » ('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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/test_tools/quic_stream_sequencer_buffer_peer.h" 5 #include "net/quic/test_tools/quic_stream_sequencer_buffer_peer.h"
6 6
7 #include "net/quic/core/quic_flags.h" 7 #include "net/quic/core/quic_flags.h"
8 #include "net/test/gtest_util.h" 8 #include "net/test/gtest_util.h"
9 9
10 typedef net::QuicStreamSequencerBuffer::BufferBlock BufferBlock; 10 typedef net::QuicStreamSequencerBuffer::BufferBlock BufferBlock;
(...skipping 23 matching lines...) Expand all
34 return bytes_read; 34 return bytes_read;
35 } 35 }
36 36
37 // If buffer is empty, the blocks_ array must be empty, which means all 37 // If buffer is empty, the blocks_ array must be empty, which means all
38 // blocks are deallocated. 38 // blocks are deallocated.
39 bool QuicStreamSequencerBufferPeer::CheckEmptyInvariants() { 39 bool QuicStreamSequencerBufferPeer::CheckEmptyInvariants() {
40 return !buffer_->Empty() || IsBlockArrayEmpty(); 40 return !buffer_->Empty() || IsBlockArrayEmpty();
41 } 41 }
42 42
43 bool QuicStreamSequencerBufferPeer::IsBlockArrayEmpty() { 43 bool QuicStreamSequencerBufferPeer::IsBlockArrayEmpty() {
44 if (FLAGS_quic_reduce_sequencer_buffer_memory_life_time && // NOLINT 44 if (buffer_->blocks_ == nullptr) {
45 buffer_->blocks_ == nullptr) {
46 return true; 45 return true;
47 } 46 }
48 47
49 size_t count = buffer_->blocks_count_; 48 size_t count = buffer_->blocks_count_;
50 for (size_t i = 0; i < count; i++) { 49 for (size_t i = 0; i < count; i++) {
51 if (buffer_->blocks_[i] != nullptr) { 50 if (buffer_->blocks_[i] != nullptr) {
52 return false; 51 return false;
53 } 52 }
54 } 53 }
55 return true; 54 return true;
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 void QuicStreamSequencerBufferPeer::set_gaps(const std::list<Gap>& gaps) { 132 void QuicStreamSequencerBufferPeer::set_gaps(const std::list<Gap>& gaps) {
134 buffer_->gaps_ = gaps; 133 buffer_->gaps_ = gaps;
135 } 134 }
136 135
137 bool QuicStreamSequencerBufferPeer::IsBufferAllocated() { 136 bool QuicStreamSequencerBufferPeer::IsBufferAllocated() {
138 return buffer_->blocks_ != nullptr; 137 return buffer_->blocks_ != nullptr;
139 } 138 }
140 139
141 } // namespace test 140 } // namespace test
142 } // namespace net 141 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/test_tools/quic_stream_peer.cc ('k') | net/quic/test_tools/quic_test_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698