OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef NET_QUIC_QUARTC_QUARTC_RELIABLE_STREAM_INTERFACE_H_ | |
6 #define NET_QUIC_QUARTC_QUARTC_RELIABLE_STREAM_INTERFACE_H_ | |
7 | |
8 namespace net { | |
Ryan Hamilton
2016/09/23 19:56:44
nit: newline after
zhihuang1
2016/09/24 06:54:05
Done.
| |
9 class QuartcReliableStreamInterface { | |
Ryan Hamilton
2016/09/23 19:56:44
nit: Just to make this shorter, I'd drop "Reliable
Ryan Hamilton
2016/09/23 19:56:44
Please add a class comment.
zhihuang1
2016/09/24 06:54:05
Sounds good. I like shorter name :)
| |
10 public: | |
11 virtual uint32_t stream_id() = 0; | |
Ryan Hamilton
2016/09/23 19:56:43
nit: it's common in net to have a newline after ea
| |
12 // The size of how much data has been buffered by the QuicConnection so far. | |
Ryan Hamilton
2016/09/23 19:56:44
What does it mean for data to be buffered by the c
zhihuang1
2016/09/24 06:54:05
This means when the underlying WebRTC network is n
| |
13 virtual uint64_t buffered_amount() = 0; | |
14 | |
15 // For forward-compatibility | |
16 struct WriteParameters { | |
17 bool fin = false; | |
18 }; | |
19 // Write the data to the stream. | |
20 virtual void Write(const char* data, | |
21 size_t size, | |
22 const WriteParameters& param) = 0; | |
23 virtual void Close() = 0; | |
Ryan Hamilton
2016/09/23 19:56:44
I assume this does not delete the stream?
zhihuang1
2016/09/24 06:54:05
I think it does.
This will unregister the stream
| |
24 | |
25 // Implemented on the WebRTC side. | |
26 class Observer { | |
Ryan Hamilton
2016/09/23 19:56:44
nit: From a recent net discussion I think Delegate
| |
27 public: | |
28 // Called when the data are ready. | |
29 virtual void OnReceived(QuartcReliableStreamInterface* stream, | |
30 const char* data, | |
31 size_t size) = 0; | |
32 | |
33 // TODO(zhihuang) Creates a map from the integer error_code to WebRTC native | |
34 // error code. | |
35 virtual void OnClose(QuartcReliableStreamInterface* stream, | |
36 int error_code) = 0; | |
37 | |
38 // Called when the buffered data has been sent. | |
39 virtual void OnBufferedAmountChanged( | |
40 QuartcReliableStreamInterface* stream) = 0; | |
41 }; | |
42 virtual void SetObserver(Observer*) = 0; | |
Ryan Hamilton
2016/09/23 19:56:44
Can you comment on lifetime/ownership here? I assu
zhihuang1
2016/09/24 06:54:05
You are right. The delegate will not be owned and
| |
43 }; | |
44 } // namespace net | |
45 | |
46 #endif // NET_QUIC_QUARTC_QUARTC_RELIABLE_STREAM_INTERFACE_H_ | |
OLD | NEW |