| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_CORE_QUIC_HEADERS_STREAM_H_ | 5 #ifndef NET_QUIC_CORE_QUIC_HEADERS_STREAM_H_ |
| 6 #define NET_QUIC_CORE_QUIC_HEADERS_STREAM_H_ | 6 #define NET_QUIC_CORE_QUIC_HEADERS_STREAM_H_ |
| 7 | 7 |
| 8 #include <cstddef> | 8 #include <cstddef> |
| 9 #include <deque> |
| 9 #include <memory> | 10 #include <memory> |
| 10 | 11 |
| 11 #include "base/macros.h" | 12 #include "base/macros.h" |
| 12 #include "net/quic/core/quic_header_list.h" | 13 #include "net/quic/core/quic_header_list.h" |
| 13 #include "net/quic/core/quic_packets.h" | 14 #include "net/quic/core/quic_packets.h" |
| 14 #include "net/quic/core/quic_stream.h" | 15 #include "net/quic/core/quic_stream.h" |
| 15 #include "net/quic/platform/api/quic_export.h" | 16 #include "net/quic/platform/api/quic_export.h" |
| 16 #include "net/spdy/core/spdy_framer.h" | 17 #include "net/spdy/core/spdy_framer.h" |
| 17 | 18 |
| 18 namespace net { | 19 namespace net { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 30 public: | 31 public: |
| 31 explicit QuicHeadersStream(QuicSpdySession* session); | 32 explicit QuicHeadersStream(QuicSpdySession* session); |
| 32 ~QuicHeadersStream() override; | 33 ~QuicHeadersStream() override; |
| 33 | 34 |
| 34 // QuicStream implementation | 35 // QuicStream implementation |
| 35 void OnDataAvailable() override; | 36 void OnDataAvailable() override; |
| 36 | 37 |
| 37 // Release underlying buffer if allowed. | 38 // Release underlying buffer if allowed. |
| 38 void MaybeReleaseSequencerBuffer(); | 39 void MaybeReleaseSequencerBuffer(); |
| 39 | 40 |
| 41 void OnStreamFrameAcked(const QuicStreamFrame& frame, |
| 42 QuicTime::Delta ack_delay_time) override; |
| 43 |
| 44 void OnStreamFrameRetransmitted(const QuicStreamFrame& frame) override; |
| 45 |
| 40 private: | 46 private: |
| 41 friend class test::QuicHeadersStreamPeer; | 47 friend class test::QuicHeadersStreamPeer; |
| 42 | 48 |
| 49 // Override to store mapping from offset, length to ack_listener. This |
| 50 // ack_listener is notified once data within [offset, offset + length] is |
| 51 // acked or retransmitted. |
| 52 QuicConsumedData WritevDataInner( |
| 53 QuicIOVector iov, |
| 54 QuicStreamOffset offset, |
| 55 bool fin, |
| 56 QuicReferenceCountedPointer<QuicAckListenerInterface> ack_listener) |
| 57 override; |
| 58 |
| 59 // CompressedHeaderInfo includes simple information of a header, including |
| 60 // offset in headers stream, unacked length and ack listener of this header. |
| 61 struct QUIC_EXPORT_PRIVATE CompressedHeaderInfo { |
| 62 CompressedHeaderInfo( |
| 63 QuicStreamOffset headers_stream_offset, |
| 64 QuicStreamOffset full_length, |
| 65 QuicReferenceCountedPointer<QuicAckListenerInterface> ack_listener); |
| 66 CompressedHeaderInfo(const CompressedHeaderInfo& other); |
| 67 ~CompressedHeaderInfo(); |
| 68 |
| 69 // Offset the header was sent on the headers stream. |
| 70 QuicStreamOffset headers_stream_offset; |
| 71 // The full length of the header. |
| 72 QuicByteCount full_length; |
| 73 // The remaining bytes to be acked. |
| 74 QuicByteCount unacked_length; |
| 75 // Ack listener of this header, and it is notified once any of the bytes has |
| 76 // been acked or retransmitted. |
| 77 QuicReferenceCountedPointer<QuicAckListenerInterface> ack_listener; |
| 78 }; |
| 79 |
| 43 // Returns true if the session is still connected. | 80 // Returns true if the session is still connected. |
| 44 bool IsConnected(); | 81 bool IsConnected(); |
| 45 | 82 |
| 46 QuicSpdySession* spdy_session_; | 83 QuicSpdySession* spdy_session_; |
| 47 | 84 |
| 85 // Headers that have not been fully acked. |
| 86 std::deque<CompressedHeaderInfo> unacked_headers_; |
| 87 |
| 48 DISALLOW_COPY_AND_ASSIGN(QuicHeadersStream); | 88 DISALLOW_COPY_AND_ASSIGN(QuicHeadersStream); |
| 49 }; | 89 }; |
| 50 | 90 |
| 51 } // namespace net | 91 } // namespace net |
| 52 | 92 |
| 53 #endif // NET_QUIC_CORE_QUIC_HEADERS_STREAM_H_ | 93 #endif // NET_QUIC_CORE_QUIC_HEADERS_STREAM_H_ |
| OLD | NEW |