| 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 #ifndef NET_QUIC_QUIC_STREAM_SEQUENCER_H_ | 5 #ifndef NET_QUIC_QUIC_STREAM_SEQUENCER_H_ |
| 6 #define NET_QUIC_QUIC_STREAM_SEQUENCER_H_ | 6 #define NET_QUIC_QUIC_STREAM_SEQUENCER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "net/base/iovec.h" | 11 #include "net/base/iovec.h" |
| 12 #include "net/quic/quic_protocol.h" | 12 #include "net/quic/quic_protocol.h" |
| 13 | 13 |
| 14 using std::map; | |
| 15 using std::string; | |
| 16 | |
| 17 namespace net { | 14 namespace net { |
| 18 | 15 |
| 19 namespace test { | 16 namespace test { |
| 20 class QuicStreamSequencerPeer; | 17 class QuicStreamSequencerPeer; |
| 21 } // namespace test | 18 } // namespace test |
| 22 | 19 |
| 23 class QuicSession; | 20 class QuicSession; |
| 24 class ReliableQuicStream; | 21 class ReliableQuicStream; |
| 25 | 22 |
| 26 // Buffers frames until we have something which can be passed | 23 // Buffers frames until we have something which can be passed |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 ReliableQuicStream* stream_; | 93 ReliableQuicStream* stream_; |
| 97 | 94 |
| 98 // The last data consumed by the stream. | 95 // The last data consumed by the stream. |
| 99 QuicStreamOffset num_bytes_consumed_; | 96 QuicStreamOffset num_bytes_consumed_; |
| 100 | 97 |
| 101 // TODO(alyssar) use something better than strings. | 98 // TODO(alyssar) use something better than strings. |
| 102 // TODO(rjshade): In future we may support retransmission of partial stream | 99 // TODO(rjshade): In future we may support retransmission of partial stream |
| 103 // frames, in which case we will have to allow receipt of overlapping frames. | 100 // frames, in which case we will have to allow receipt of overlapping frames. |
| 104 // Maybe write new frames into a ring buffer, and keep track of consumed | 101 // Maybe write new frames into a ring buffer, and keep track of consumed |
| 105 // bytes, and gaps. | 102 // bytes, and gaps. |
| 106 typedef map<QuicStreamOffset, string> FrameMap; | 103 typedef std::map<QuicStreamOffset, std::string> FrameMap; |
| 107 | 104 |
| 108 // Stores buffered frames (maps from sequence number -> frame data as string). | 105 // Stores buffered frames (maps from sequence number -> frame data as string). |
| 109 FrameMap buffered_frames_; | 106 FrameMap buffered_frames_; |
| 110 | 107 |
| 111 // The offset, if any, we got a stream termination for. When this many bytes | 108 // The offset, if any, we got a stream termination for. When this many bytes |
| 112 // have been processed, the sequencer will be closed. | 109 // have been processed, the sequencer will be closed. |
| 113 QuicStreamOffset close_offset_; | 110 QuicStreamOffset close_offset_; |
| 114 | 111 |
| 115 // If true, the sequencer is blocked from passing data to the stream and will | 112 // If true, the sequencer is blocked from passing data to the stream and will |
| 116 // buffer all new incoming data until FlushBufferedFrames is called. | 113 // buffer all new incoming data until FlushBufferedFrames is called. |
| 117 bool blocked_; | 114 bool blocked_; |
| 118 | 115 |
| 119 // Tracks how many bytes the sequencer has buffered. | 116 // Tracks how many bytes the sequencer has buffered. |
| 120 size_t num_bytes_buffered_; | 117 size_t num_bytes_buffered_; |
| 121 | 118 |
| 122 // Count of the number of frames received. | 119 // Count of the number of frames received. |
| 123 int num_frames_received_; | 120 int num_frames_received_; |
| 124 | 121 |
| 125 // Count of the number of duplicate frames received. | 122 // Count of the number of duplicate frames received. |
| 126 int num_duplicate_frames_received_; | 123 int num_duplicate_frames_received_; |
| 127 | 124 |
| 128 DISALLOW_COPY_AND_ASSIGN(QuicStreamSequencer); | 125 DISALLOW_COPY_AND_ASSIGN(QuicStreamSequencer); |
| 129 }; | 126 }; |
| 130 | 127 |
| 131 } // namespace net | 128 } // namespace net |
| 132 | 129 |
| 133 #endif // NET_QUIC_QUIC_STREAM_SEQUENCER_H_ | 130 #endif // NET_QUIC_QUIC_STREAM_SEQUENCER_H_ |
| OLD | NEW |