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