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/upload_data_stream.h" | 11 #include "net/base/upload_data_stream.h" |
11 #include "net/http/http_request_info.h" | 12 #include "net/http/http_request_info.h" |
12 #include "net/http/http_response_info.h" | 13 #include "net/http/http_response_info.h" |
13 #include "net/http/http_stream.h" | 14 #include "net/http/http_stream.h" |
14 #include "net/quic/reliable_quic_stream.h" | 15 #include "net/quic/reliable_quic_stream.h" |
15 | 16 |
16 namespace net { | 17 namespace net { |
17 | 18 |
18 class QuicClientSession; | 19 class QuicClientSession; |
19 | 20 |
| 21 // A client-initiated ReliableQuicStream. Instances of this class |
| 22 // are owned by the QuicClientSession which created them. |
20 class NET_EXPORT_PRIVATE QuicReliableClientStream : public ReliableQuicStream { | 23 class NET_EXPORT_PRIVATE QuicReliableClientStream : public ReliableQuicStream { |
21 public: | 24 public: |
22 // Delegate handles protocol specific behavior of a quic stream. | 25 // Delegate handles protocol specific behavior of a quic stream. |
23 class Delegate { | 26 class NET_EXPORT_PRIVATE Delegate { |
24 public: | 27 public: |
25 Delegate() {} | 28 Delegate() {} |
26 | 29 |
27 // Called when stream is ready to send data. | 30 // Called when stream is ready to send data. |
28 // Returns network error code. OK when it successfully sent data. | 31 // Returns network error code. OK when it successfully sent data. |
29 // ERR_IO_PENDING when performing operation asynchronously. | 32 // ERR_IO_PENDING when performing operation asynchronously. |
30 virtual int OnSendData() = 0; | 33 virtual int OnSendData() = 0; |
31 | 34 |
32 // Called when data has been sent. |status| indicates network error | 35 // Called when data has been sent. |status| indicates network error |
33 // or number of bytes that has been sent. On return, |eof| is set to true | 36 // or number of bytes that has been sent. On return, |eof| is set to true |
(...skipping 16 matching lines...) Expand all Loading... |
50 }; | 53 }; |
51 | 54 |
52 QuicReliableClientStream(QuicStreamId id, | 55 QuicReliableClientStream(QuicStreamId id, |
53 QuicSession* session); | 56 QuicSession* session); |
54 | 57 |
55 virtual ~QuicReliableClientStream(); | 58 virtual ~QuicReliableClientStream(); |
56 | 59 |
57 // ReliableQuicStream | 60 // ReliableQuicStream |
58 virtual uint32 ProcessData(const char* data, uint32 data_len) OVERRIDE; | 61 virtual uint32 ProcessData(const char* data, uint32 data_len) OVERRIDE; |
59 virtual void TerminateFromPeer(bool half_close) OVERRIDE; | 62 virtual void TerminateFromPeer(bool half_close) OVERRIDE; |
| 63 using ReliableQuicStream::WriteData; |
60 | 64 |
61 // Set new |delegate|. |delegate| must not be NULL. | 65 // Set new |delegate|. |delegate| must not be NULL. |
62 // If this stream has already received data, OnDataReceived() will be | 66 // If this stream has already received data, OnDataReceived() will be |
63 // called on the delegate. | 67 // called on the delegate. |
64 void SetDelegate(Delegate* delegate); | 68 void SetDelegate(Delegate* delegate); |
65 Delegate* GetDelegate() { return delegate_; } | 69 Delegate* GetDelegate() { return delegate_; } |
66 | 70 |
67 private: | 71 private: |
68 Delegate* delegate_; | 72 Delegate* delegate_; |
69 | 73 |
70 DISALLOW_COPY_AND_ASSIGN(QuicReliableClientStream); | 74 DISALLOW_COPY_AND_ASSIGN(QuicReliableClientStream); |
71 }; | 75 }; |
72 | 76 |
73 } // namespace net | 77 } // namespace net |
74 | 78 |
75 #endif // NET_QUIC_QUIC_RELIABLE_CLIENT_STREAM_H_ | 79 #endif // NET_QUIC_QUIC_RELIABLE_CLIENT_STREAM_H_ |
OLD | NEW |