Chromium Code Reviews| Index: net/quic/quartc/quartc_reliable_stream_interface.h |
| diff --git a/net/quic/quartc/quartc_reliable_stream_interface.h b/net/quic/quartc/quartc_reliable_stream_interface.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..9eab6f93be28bb6891b613eed5e59ac61b516116 |
| --- /dev/null |
| +++ b/net/quic/quartc/quartc_reliable_stream_interface.h |
| @@ -0,0 +1,46 @@ |
| +// Copyright (c) 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef NET_QUIC_QUARTC_QUARTC_RELIABLE_STREAM_INTERFACE_H_ |
| +#define NET_QUIC_QUARTC_QUARTC_RELIABLE_STREAM_INTERFACE_H_ |
| + |
| +namespace net { |
|
Ryan Hamilton
2016/09/23 19:56:44
nit: newline after
zhihuang1
2016/09/24 06:54:05
Done.
|
| +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 :)
|
| + public: |
| + 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
|
| + // 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
|
| + virtual uint64_t buffered_amount() = 0; |
| + |
| + // For forward-compatibility |
| + struct WriteParameters { |
| + bool fin = false; |
| + }; |
| + // Write the data to the stream. |
| + virtual void Write(const char* data, |
| + size_t size, |
| + const WriteParameters& param) = 0; |
| + 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
|
| + |
| + // Implemented on the WebRTC side. |
| + class Observer { |
|
Ryan Hamilton
2016/09/23 19:56:44
nit: From a recent net discussion I think Delegate
|
| + public: |
| + // Called when the data are ready. |
| + virtual void OnReceived(QuartcReliableStreamInterface* stream, |
| + const char* data, |
| + size_t size) = 0; |
| + |
| + // TODO(zhihuang) Creates a map from the integer error_code to WebRTC native |
| + // error code. |
| + virtual void OnClose(QuartcReliableStreamInterface* stream, |
| + int error_code) = 0; |
| + |
| + // Called when the buffered data has been sent. |
| + virtual void OnBufferedAmountChanged( |
| + QuartcReliableStreamInterface* stream) = 0; |
| + }; |
| + 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
|
| +}; |
| +} // namespace net |
| + |
| +#endif // NET_QUIC_QUARTC_QUARTC_RELIABLE_STREAM_INTERFACE_H_ |