| OLD | NEW |
| 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2015 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/stream_sequencer_buffer.h" | 5 #include "net/quic/stream_sequencer_buffer.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "net/quic/quic_bug_tracker.h" |
| 8 | 9 |
| 9 using std::min; | 10 using std::min; |
| 10 | 11 |
| 11 namespace net { | 12 namespace net { |
| 12 | 13 |
| 13 StreamSequencerBuffer::Gap::Gap(QuicStreamOffset begin_offset, | 14 StreamSequencerBuffer::Gap::Gap(QuicStreamOffset begin_offset, |
| 14 QuicStreamOffset end_offset) | 15 QuicStreamOffset end_offset) |
| 15 : begin_offset(begin_offset), end_offset(end_offset) {} | 16 : begin_offset(begin_offset), end_offset(end_offset) {} |
| 16 | 17 |
| 17 StreamSequencerBuffer::FrameInfo::FrameInfo() | 18 StreamSequencerBuffer::FrameInfo::FrameInfo() |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 | 58 |
| 58 QuicErrorCode StreamSequencerBuffer::OnStreamData( | 59 QuicErrorCode StreamSequencerBuffer::OnStreamData( |
| 59 QuicStreamOffset starting_offset, | 60 QuicStreamOffset starting_offset, |
| 60 base::StringPiece data, | 61 base::StringPiece data, |
| 61 QuicTime timestamp, | 62 QuicTime timestamp, |
| 62 size_t* const bytes_buffered) { | 63 size_t* const bytes_buffered) { |
| 63 *bytes_buffered = 0; | 64 *bytes_buffered = 0; |
| 64 QuicStreamOffset offset = starting_offset; | 65 QuicStreamOffset offset = starting_offset; |
| 65 size_t size = data.size(); | 66 size_t size = data.size(); |
| 66 if (size == 0) { | 67 if (size == 0) { |
| 67 LOG(DFATAL) << "Attempted to write 0 bytes of data."; | 68 QUIC_BUG << "Attempted to write 0 bytes of data."; |
| 68 return QUIC_INVALID_STREAM_FRAME; | 69 return QUIC_INVALID_STREAM_FRAME; |
| 69 } | 70 } |
| 70 | 71 |
| 71 // Find the first gap not ending before |offset|. This gap maybe the gap to | 72 // Find the first gap not ending before |offset|. This gap maybe the gap to |
| 72 // fill if the arriving frame doesn't overlaps with previous ones. | 73 // fill if the arriving frame doesn't overlaps with previous ones. |
| 73 std::list<Gap>::iterator current_gap = gaps_.begin(); | 74 std::list<Gap>::iterator current_gap = gaps_.begin(); |
| 74 while (current_gap != gaps_.end() && current_gap->end_offset <= offset) { | 75 while (current_gap != gaps_.end() && current_gap->end_offset <= offset) { |
| 75 ++current_gap; | 76 ++current_gap; |
| 76 } | 77 } |
| 77 | 78 |
| (...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 443 offset, FrameInfo(erased.first + erased.second.length - offset, | 444 offset, FrameInfo(erased.first + erased.second.length - offset, |
| 444 erased.second.timestamp)); | 445 erased.second.timestamp)); |
| 445 DVLOG(1) << "Inserted FrameInfo with offset: " << updated.first | 446 DVLOG(1) << "Inserted FrameInfo with offset: " << updated.first |
| 446 << " and length: " << updated.second.length; | 447 << " and length: " << updated.second.length; |
| 447 frame_arrival_time_map_.insert(updated); | 448 frame_arrival_time_map_.insert(updated); |
| 448 } | 449 } |
| 449 } | 450 } |
| 450 } | 451 } |
| 451 | 452 |
| 452 } // namespace net | 453 } // namespace net |
| OLD | NEW |