| 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 reliable 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 ReliableQuicStream | 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 ReliableQuicStream 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_RELIABLE_QUIC_STREAM_H_ | 17 #ifndef NET_QUIC_CORE_QUIC_STREAM_H_ |
| 18 #define NET_QUIC_RELIABLE_QUIC_STREAM_H_ | 18 #define NET_QUIC_CORE_QUIC_STREAM_H_ |
| 19 | 19 |
| 20 #include <stddef.h> | 20 #include <stddef.h> |
| 21 #include <stdint.h> | 21 #include <stdint.h> |
| 22 #include <sys/types.h> | 22 #include <sys/types.h> |
| 23 | 23 |
| 24 #include <list> | 24 #include <list> |
| 25 #include <string> | 25 #include <string> |
| 26 | 26 |
| 27 #include "base/macros.h" | 27 #include "base/macros.h" |
| 28 #include "base/memory/ref_counted.h" | 28 #include "base/memory/ref_counted.h" |
| 29 #include "base/strings/string_piece.h" | 29 #include "base/strings/string_piece.h" |
| 30 #include "net/base/iovec.h" | 30 #include "net/base/iovec.h" |
| 31 #include "net/base/net_export.h" | 31 #include "net/base/net_export.h" |
| 32 #include "net/quic/core/quic_flow_controller.h" | 32 #include "net/quic/core/quic_flow_controller.h" |
| 33 #include "net/quic/core/quic_protocol.h" | 33 #include "net/quic/core/quic_protocol.h" |
| 34 #include "net/quic/core/quic_stream_sequencer.h" | 34 #include "net/quic/core/quic_stream_sequencer.h" |
| 35 #include "net/quic/core/quic_types.h" | 35 #include "net/quic/core/quic_types.h" |
| 36 | 36 |
| 37 namespace net { | 37 namespace net { |
| 38 | 38 |
| 39 namespace test { | 39 namespace test { |
| 40 class ReliableQuicStreamPeer; | 40 class QuicStreamPeer; |
| 41 } // namespace test | 41 } // namespace test |
| 42 | 42 |
| 43 class QuicSession; | 43 class QuicSession; |
| 44 | 44 |
| 45 class NET_EXPORT_PRIVATE ReliableQuicStream { | 45 class NET_EXPORT_PRIVATE QuicStream { |
| 46 public: | 46 public: |
| 47 ReliableQuicStream(QuicStreamId id, QuicSession* session); | 47 QuicStream(QuicStreamId id, QuicSession* session); |
| 48 | 48 |
| 49 virtual ~ReliableQuicStream(); | 49 virtual ~QuicStream(); |
| 50 | 50 |
| 51 // Not in use currently. | 51 // Not in use currently. |
| 52 void SetFromConfig(); | 52 void SetFromConfig(); |
| 53 | 53 |
| 54 // Called by the session when a (potentially duplicate) stream frame has been | 54 // Called by the session when a (potentially duplicate) stream frame has been |
| 55 // received for this stream. | 55 // received for this stream. |
| 56 virtual void OnStreamFrame(const QuicStreamFrame& frame); | 56 virtual void OnStreamFrame(const QuicStreamFrame& frame); |
| 57 | 57 |
| 58 // Called by the session when the connection becomes writeable to allow the | 58 // Called by the session when the connection becomes writeable to allow the |
| 59 // stream to write any pending data. | 59 // stream to write any pending data. |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 QuicSession* session() { return session_; } | 216 QuicSession* session() { return session_; } |
| 217 | 217 |
| 218 const QuicStreamSequencer* sequencer() const { return &sequencer_; } | 218 const QuicStreamSequencer* sequencer() const { return &sequencer_; } |
| 219 QuicStreamSequencer* sequencer() { return &sequencer_; } | 219 QuicStreamSequencer* sequencer() { return &sequencer_; } |
| 220 | 220 |
| 221 void DisableConnectionFlowControlForThisStream() { | 221 void DisableConnectionFlowControlForThisStream() { |
| 222 stream_contributes_to_connection_flow_control_ = false; | 222 stream_contributes_to_connection_flow_control_ = false; |
| 223 } | 223 } |
| 224 | 224 |
| 225 private: | 225 private: |
| 226 friend class test::ReliableQuicStreamPeer; | 226 friend class test::QuicStreamPeer; |
| 227 friend class QuicStreamUtils; | 227 friend class QuicStreamUtils; |
| 228 | 228 |
| 229 // Close the read side of the socket. May cause the stream to be closed. | 229 // Close the read side of the socket. May cause the stream to be closed. |
| 230 // Subclasses and consumers should use StopReading to terminate reading early. | 230 // Subclasses and consumers should use StopReading to terminate reading early. |
| 231 void CloseReadSide(); | 231 void CloseReadSide(); |
| 232 | 232 |
| 233 // Subclasses and consumers should use reading_stopped. | 233 // Subclasses and consumers should use reading_stopped. |
| 234 bool read_side_closed() const { return read_side_closed_; } | 234 bool read_side_closed() const { return read_side_closed_; } |
| 235 | 235 |
| 236 struct PendingData { | 236 struct PendingData { |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 QuicFlowController* connection_flow_controller_; | 306 QuicFlowController* connection_flow_controller_; |
| 307 | 307 |
| 308 // Special streams, such as the crypto and headers streams, do not respect | 308 // Special streams, such as the crypto and headers streams, do not respect |
| 309 // connection level flow control limits (but are stream level flow control | 309 // connection level flow control limits (but are stream level flow control |
| 310 // limited). | 310 // limited). |
| 311 bool stream_contributes_to_connection_flow_control_; | 311 bool stream_contributes_to_connection_flow_control_; |
| 312 | 312 |
| 313 // For debugging only, used for busy loop check. | 313 // For debugging only, used for busy loop check. |
| 314 size_t busy_counter_; | 314 size_t busy_counter_; |
| 315 | 315 |
| 316 DISALLOW_COPY_AND_ASSIGN(ReliableQuicStream); | 316 DISALLOW_COPY_AND_ASSIGN(QuicStream); |
| 317 }; | 317 }; |
| 318 | 318 |
| 319 } // namespace net | 319 } // namespace net |
| 320 | 320 |
| 321 #endif // NET_QUIC_RELIABLE_QUIC_STREAM_H_ | 321 #endif // NET_QUIC_CORE_QUIC_STREAM_H_ |
| OLD | NEW |