| 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 // NOTE: This code is not shared between Google and Chrome. | 5 // NOTE: This code is not shared between Google and Chrome. |
| 6 | 6 |
| 7 #ifndef NET_QUIC_QUIC_RELIABLE_CLIENT_STREAM_H_ | 7 #ifndef NET_QUIC_QUIC_RELIABLE_CLIENT_STREAM_H_ |
| 8 #define NET_QUIC_QUIC_RELIABLE_CLIENT_STREAM_H_ | 8 #define NET_QUIC_QUIC_RELIABLE_CLIENT_STREAM_H_ |
| 9 | 9 |
| 10 #include "net/base/ip_endpoint.h" | 10 #include "net/base/ip_endpoint.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 // Called when data is received. | 41 // Called when data is received. |
| 42 // Returns network error code. OK when it successfully receives data. | 42 // Returns network error code. OK when it successfully receives data. |
| 43 virtual int OnDataReceived(const char* data, int length) = 0; | 43 virtual int OnDataReceived(const char* data, int length) = 0; |
| 44 | 44 |
| 45 // Called when the stream is closed by the peer. | 45 // Called when the stream is closed by the peer. |
| 46 virtual void OnClose(QuicErrorCode error) = 0; | 46 virtual void OnClose(QuicErrorCode error) = 0; |
| 47 | 47 |
| 48 // Called when the stream is closed because of an error. | 48 // Called when the stream is closed because of an error. |
| 49 virtual void OnError(int error) = 0; | 49 virtual void OnError(int error) = 0; |
| 50 | 50 |
| 51 // Returns true if sending of headers has completed. |
| 52 virtual bool HasSendHeadersComplete() = 0; |
| 53 |
| 51 protected: | 54 protected: |
| 52 virtual ~Delegate() {} | 55 virtual ~Delegate() {} |
| 53 | 56 |
| 54 private: | 57 private: |
| 55 DISALLOW_COPY_AND_ASSIGN(Delegate); | 58 DISALLOW_COPY_AND_ASSIGN(Delegate); |
| 56 }; | 59 }; |
| 57 | 60 |
| 58 QuicReliableClientStream(QuicStreamId id, | 61 QuicReliableClientStream(QuicStreamId id, |
| 59 QuicSession* session, | 62 QuicSession* session, |
| 60 const BoundNetLog& net_log); | 63 const BoundNetLog& net_log); |
| 61 | 64 |
| 62 virtual ~QuicReliableClientStream(); | 65 virtual ~QuicReliableClientStream(); |
| 63 | 66 |
| 64 // ReliableQuicStream | 67 // ReliableQuicStream |
| 65 virtual uint32 ProcessData(const char* data, uint32 data_len) OVERRIDE; | 68 virtual uint32 ProcessData(const char* data, uint32 data_len) OVERRIDE; |
| 66 virtual void TerminateFromPeer(bool half_close) OVERRIDE; | 69 virtual void TerminateFromPeer(bool half_close) OVERRIDE; |
| 67 virtual void OnCanWrite() OVERRIDE; | 70 virtual void OnCanWrite() OVERRIDE; |
| 71 virtual QuicPriority EffectivePriority() const OVERRIDE; |
| 72 |
| 73 // While the server's set_priority shouldn't be called externally, the creator |
| 74 // of client-side streams should be able to set the priority. |
| 75 using ReliableQuicStream::set_priority; |
| 68 | 76 |
| 69 int WriteStreamData(base::StringPiece data, | 77 int WriteStreamData(base::StringPiece data, |
| 70 bool fin, | 78 bool fin, |
| 71 const CompletionCallback& callback); | 79 const CompletionCallback& callback); |
| 72 // Set new |delegate|. |delegate| must not be NULL. | 80 // Set new |delegate|. |delegate| must not be NULL. |
| 73 // If this stream has already received data, OnDataReceived() will be | 81 // If this stream has already received data, OnDataReceived() will be |
| 74 // called on the delegate. | 82 // called on the delegate. |
| 75 void SetDelegate(Delegate* delegate); | 83 void SetDelegate(Delegate* delegate); |
| 76 Delegate* GetDelegate() { return delegate_; } | 84 Delegate* GetDelegate() { return delegate_; } |
| 77 void OnError(int error); | 85 void OnError(int error); |
| 78 | 86 |
| 79 const BoundNetLog& net_log() const { return net_log_; } | 87 const BoundNetLog& net_log() const { return net_log_; } |
| 80 | 88 |
| 81 private: | 89 private: |
| 82 BoundNetLog net_log_; | 90 BoundNetLog net_log_; |
| 83 Delegate* delegate_; | 91 Delegate* delegate_; |
| 84 | 92 |
| 85 CompletionCallback callback_; | 93 CompletionCallback callback_; |
| 86 | 94 |
| 87 DISALLOW_COPY_AND_ASSIGN(QuicReliableClientStream); | 95 DISALLOW_COPY_AND_ASSIGN(QuicReliableClientStream); |
| 88 }; | 96 }; |
| 89 | 97 |
| 90 } // namespace net | 98 } // namespace net |
| 91 | 99 |
| 92 #endif // NET_QUIC_QUIC_RELIABLE_CLIENT_STREAM_H_ | 100 #endif // NET_QUIC_QUIC_RELIABLE_CLIENT_STREAM_H_ |
| OLD | NEW |