| 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 reliable streams. |
| 6 | 6 |
| 7 #ifndef NET_QUIC_RELIABLE_QUIC_STREAM_H_ | 7 #ifndef NET_QUIC_RELIABLE_QUIC_STREAM_H_ |
| 8 #define NET_QUIC_RELIABLE_QUIC_STREAM_H_ | 8 #define NET_QUIC_RELIABLE_QUIC_STREAM_H_ |
| 9 | 9 |
| 10 #include <sys/types.h> | 10 #include <sys/types.h> |
| 11 | 11 |
| 12 #include <list> | 12 #include <list> |
| 13 #include <string> |
| 13 | 14 |
| 14 #include "base/basictypes.h" | 15 #include "base/basictypes.h" |
| 15 #include "base/memory/ref_counted.h" | 16 #include "base/memory/ref_counted.h" |
| 16 #include "base/strings/string_piece.h" | 17 #include "base/strings/string_piece.h" |
| 17 #include "net/base/iovec.h" | 18 #include "net/base/iovec.h" |
| 18 #include "net/base/net_export.h" | 19 #include "net/base/net_export.h" |
| 19 #include "net/quic/quic_ack_notifier.h" | 20 #include "net/quic/quic_ack_notifier.h" |
| 20 #include "net/quic/quic_flow_controller.h" | 21 #include "net/quic/quic_flow_controller.h" |
| 21 #include "net/quic/quic_protocol.h" | 22 #include "net/quic/quic_protocol.h" |
| 22 #include "net/quic/quic_stream_sequencer.h" | 23 #include "net/quic/quic_stream_sequencer.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 virtual void OnFinRead(); | 61 virtual void OnFinRead(); |
| 61 | 62 |
| 62 virtual uint32 ProcessRawData(const char* data, uint32 data_len) = 0; | 63 virtual uint32 ProcessRawData(const char* data, uint32 data_len) = 0; |
| 63 | 64 |
| 64 // Called to reset the stream from this end. | 65 // Called to reset the stream from this end. |
| 65 virtual void Reset(QuicRstStreamErrorCode error); | 66 virtual void Reset(QuicRstStreamErrorCode error); |
| 66 | 67 |
| 67 // Called to close the entire connection from this end. | 68 // Called to close the entire connection from this end. |
| 68 virtual void CloseConnection(QuicErrorCode error); | 69 virtual void CloseConnection(QuicErrorCode error); |
| 69 virtual void CloseConnectionWithDetails(QuicErrorCode error, | 70 virtual void CloseConnectionWithDetails(QuicErrorCode error, |
| 70 const string& details); | 71 const std::string& details); |
| 71 | 72 |
| 72 // Returns the effective priority for the stream. This value may change | 73 // Returns the effective priority for the stream. This value may change |
| 73 // during the life of the stream. | 74 // during the life of the stream. |
| 74 virtual QuicPriority EffectivePriority() const = 0; | 75 virtual QuicPriority EffectivePriority() const = 0; |
| 75 | 76 |
| 76 QuicStreamId id() const { return id_; } | 77 QuicStreamId id() const { return id_; } |
| 77 | 78 |
| 78 QuicRstStreamErrorCode stream_error() const { return stream_error_; } | 79 QuicRstStreamErrorCode stream_error() const { return stream_error_; } |
| 79 QuicErrorCode connection_error() const { return connection_error_; } | 80 QuicErrorCode connection_error() const { return connection_error_; } |
| 80 | 81 |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 void DisableConnectionFlowControlForThisStream() { | 175 void DisableConnectionFlowControlForThisStream() { |
| 175 stream_contributes_to_connection_flow_control_ = false; | 176 stream_contributes_to_connection_flow_control_ = false; |
| 176 } | 177 } |
| 177 | 178 |
| 178 private: | 179 private: |
| 179 friend class test::ReliableQuicStreamPeer; | 180 friend class test::ReliableQuicStreamPeer; |
| 180 friend class QuicStreamUtils; | 181 friend class QuicStreamUtils; |
| 181 class ProxyAckNotifierDelegate; | 182 class ProxyAckNotifierDelegate; |
| 182 | 183 |
| 183 struct PendingData { | 184 struct PendingData { |
| 184 PendingData(string data_in, | 185 PendingData(std::string data_in, |
| 185 scoped_refptr<ProxyAckNotifierDelegate> delegate_in); | 186 scoped_refptr<ProxyAckNotifierDelegate> delegate_in); |
| 186 ~PendingData(); | 187 ~PendingData(); |
| 187 | 188 |
| 188 string data; | 189 std::string data; |
| 189 // Delegate that should be notified when the pending data is acked. | 190 // Delegate that should be notified when the pending data is acked. |
| 190 // Can be nullptr. | 191 // Can be nullptr. |
| 191 scoped_refptr<ProxyAckNotifierDelegate> delegate; | 192 scoped_refptr<ProxyAckNotifierDelegate> delegate; |
| 192 }; | 193 }; |
| 193 | 194 |
| 194 // Calls MaybeSendBlocked on our flow controller, and connection level flow | 195 // Calls MaybeSendBlocked on our flow controller, and connection level flow |
| 195 // controller. If we are flow control blocked, marks this stream as write | 196 // controller. If we are flow control blocked, marks this stream as write |
| 196 // blocked. | 197 // blocked. |
| 197 void MaybeSendBlocked(); | 198 void MaybeSendBlocked(); |
| 198 | 199 |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 // connection level flow control limits (but are stream level flow control | 249 // connection level flow control limits (but are stream level flow control |
| 249 // limited). | 250 // limited). |
| 250 bool stream_contributes_to_connection_flow_control_; | 251 bool stream_contributes_to_connection_flow_control_; |
| 251 | 252 |
| 252 DISALLOW_COPY_AND_ASSIGN(ReliableQuicStream); | 253 DISALLOW_COPY_AND_ASSIGN(ReliableQuicStream); |
| 253 }; | 254 }; |
| 254 | 255 |
| 255 } // namespace net | 256 } // namespace net |
| 256 | 257 |
| 257 #endif // NET_QUIC_RELIABLE_QUIC_STREAM_H_ | 258 #endif // NET_QUIC_RELIABLE_QUIC_STREAM_H_ |
| OLD | NEW |