| 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 // The base class for client/server QUIC streams. | 5 // The base class for client/server QUIC streams. |
| 6 | 6 |
| 7 // It does not contain the entire interface needed by an application to interact | 7 // It does not contain the entire interface needed by an application to interact |
| 8 // with a QUIC stream. Some parts of the interface must be obtained by | 8 // with a QUIC stream. Some parts of the interface must be obtained by |
| 9 // accessing the owning session object. A subclass of QuicStream | 9 // accessing the owning session object. A subclass of QuicStream |
| 10 // connects the object and the application that generates and consumes the data | 10 // connects the object and the application that generates and consumes the data |
| 11 // of the stream. | 11 // of the stream. |
| 12 | 12 |
| 13 // The QuicStream object has a dependent QuicStreamSequencer object, | 13 // The QuicStream object has a dependent QuicStreamSequencer object, |
| 14 // which is given the stream frames as they arrive, and provides stream data in | 14 // which is given the stream frames as they arrive, and provides stream data in |
| 15 // order by invoking ProcessRawData(). | 15 // order by invoking ProcessRawData(). |
| 16 | 16 |
| 17 #ifndef NET_QUIC_CORE_QUIC_STREAM_H_ | 17 #ifndef NET_QUIC_CORE_QUIC_STREAM_H_ |
| 18 #define NET_QUIC_CORE_QUIC_STREAM_H_ | 18 #define NET_QUIC_CORE_QUIC_STREAM_H_ |
| 19 | 19 |
| 20 #include <cstddef> | 20 #include <cstddef> |
| 21 #include <cstdint> | 21 #include <cstdint> |
| 22 #include <list> | 22 #include <list> |
| 23 #include <string> | 23 #include <string> |
| 24 | 24 |
| 25 #include "base/macros.h" | 25 #include "base/macros.h" |
| 26 #include "net/base/iovec.h" | 26 #include "net/base/iovec.h" |
| 27 #include "net/quic/core/quic_flow_controller.h" | 27 #include "net/quic/core/quic_flow_controller.h" |
| 28 #include "net/quic/core/quic_iovector.h" | 28 #include "net/quic/core/quic_iovector.h" |
| 29 #include "net/quic/core/quic_packets.h" | 29 #include "net/quic/core/quic_packets.h" |
| 30 #include "net/quic/core/quic_stream_send_buffer.h" |
| 30 #include "net/quic/core/quic_stream_sequencer.h" | 31 #include "net/quic/core/quic_stream_sequencer.h" |
| 31 #include "net/quic/core/quic_types.h" | 32 #include "net/quic/core/quic_types.h" |
| 32 #include "net/quic/core/stream_notifier_interface.h" | 33 #include "net/quic/core/stream_notifier_interface.h" |
| 33 #include "net/quic/platform/api/quic_export.h" | 34 #include "net/quic/platform/api/quic_export.h" |
| 34 #include "net/quic/platform/api/quic_reference_counted.h" | 35 #include "net/quic/platform/api/quic_reference_counted.h" |
| 35 #include "net/quic/platform/api/quic_string_piece.h" | 36 #include "net/quic/platform/api/quic_string_piece.h" |
| 36 | 37 |
| 37 namespace net { | 38 namespace net { |
| 38 | 39 |
| 39 namespace test { | 40 namespace test { |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 // If fin is true: if it is immediately passed on to the session, | 190 // If fin is true: if it is immediately passed on to the session, |
| 190 // write_side_closed() becomes true, otherwise fin_buffered_ becomes true. | 191 // write_side_closed() becomes true, otherwise fin_buffered_ becomes true. |
| 191 void WriteOrBufferData( | 192 void WriteOrBufferData( |
| 192 QuicStringPiece data, | 193 QuicStringPiece data, |
| 193 bool fin, | 194 bool fin, |
| 194 QuicReferenceCountedPointer<QuicAckListenerInterface> ack_listener); | 195 QuicReferenceCountedPointer<QuicAckListenerInterface> ack_listener); |
| 195 | 196 |
| 196 // Adds random padding after the fin is consumed for this stream. | 197 // Adds random padding after the fin is consumed for this stream. |
| 197 void AddRandomPaddingAfterFin(); | 198 void AddRandomPaddingAfterFin(); |
| 198 | 199 |
| 200 // Save |data_length| of data starts at |iov_offset| in |iov| to send buffer. |
| 201 void SaveStreamData(QuicIOVector iov, |
| 202 size_t iov_offset, |
| 203 QuicStreamOffset offset, |
| 204 QuicByteCount data_length); |
| 205 |
| 206 // Write |data_length| of data starts at |offset| from send buffer. |
| 207 bool WriteStreamData(QuicStreamOffset offset, |
| 208 QuicByteCount data_length, |
| 209 QuicDataWriter* writer); |
| 210 |
| 199 // StreamNotifierInterface methods: | 211 // StreamNotifierInterface methods: |
| 200 void OnStreamFrameAcked(const QuicStreamFrame& frame, | 212 void OnStreamFrameAcked(const QuicStreamFrame& frame, |
| 201 QuicTime::Delta ack_delay_time) override; | 213 QuicTime::Delta ack_delay_time) override; |
| 202 void OnStreamFrameRetransmitted(const QuicStreamFrame& frame) override; | 214 void OnStreamFrameRetransmitted(const QuicStreamFrame& frame) override; |
| 203 void OnStreamFrameDiscarded(const QuicStreamFrame& frame) override; | 215 void OnStreamFrameDiscarded(const QuicStreamFrame& frame) override; |
| 204 | 216 |
| 205 protected: | 217 protected: |
| 206 // Sends as many bytes in the first |count| buffers of |iov| to the connection | 218 // Sends as many bytes in the first |count| buffers of |iov| to the connection |
| 207 // as the connection will consume. | 219 // as the connection will consume. |
| 208 // If |ack_listener| is provided, then it will be notified once all | 220 // If |ack_listener| is provided, then it will be notified once all |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 343 size_t busy_counter_; | 355 size_t busy_counter_; |
| 344 | 356 |
| 345 // Indicates whether paddings will be added after the fin is consumed for this | 357 // Indicates whether paddings will be added after the fin is consumed for this |
| 346 // stream. | 358 // stream. |
| 347 bool add_random_padding_after_fin_; | 359 bool add_random_padding_after_fin_; |
| 348 | 360 |
| 349 // Ack listener of this stream, and it is notified when any of written bytes | 361 // Ack listener of this stream, and it is notified when any of written bytes |
| 350 // are acked. | 362 // are acked. |
| 351 QuicReferenceCountedPointer<QuicAckListenerInterface> ack_listener_; | 363 QuicReferenceCountedPointer<QuicAckListenerInterface> ack_listener_; |
| 352 | 364 |
| 365 // Send buffer of this stream. Send buffer is cleaned up when data gets acked |
| 366 // or discarded. |
| 367 QuicStreamSendBuffer send_buffer_; |
| 368 |
| 353 DISALLOW_COPY_AND_ASSIGN(QuicStream); | 369 DISALLOW_COPY_AND_ASSIGN(QuicStream); |
| 354 }; | 370 }; |
| 355 | 371 |
| 356 } // namespace net | 372 } // namespace net |
| 357 | 373 |
| 358 #endif // NET_QUIC_CORE_QUIC_STREAM_H_ | 374 #endif // NET_QUIC_CORE_QUIC_STREAM_H_ |
| OLD | NEW |