Chromium Code Reviews| Index: net/quic/quartc/quartc_stream_interface.h |
| diff --git a/net/quic/quartc/quartc_stream_interface.h b/net/quic/quartc/quartc_stream_interface.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..d01c70cce60eee3604b300f0247422e4ef639ad1 |
| --- /dev/null |
| +++ b/net/quic/quartc/quartc_stream_interface.h |
| @@ -0,0 +1,59 @@ |
| +// 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_STREAM_INTERFACE_H_ |
| +#define NET_QUIC_QUARTC_QUARTC_STREAM_INTERFACE_H_ |
| + |
| +namespace net { |
| + |
| +// QuartcSession will create implementations of this interface to send and |
| +// receive data. |
|
pthatcher2
2016/10/05 22:12:08
It would be more clear as "Sends and receives data
zhihuang1
2016/10/13 06:22:41
Done.
|
| +class QuartcStreamInterface { |
| + public: |
| + virtual ~QuartcStreamInterface() {} |
| + |
| + // Return the ID of the underlying QUIC stream. |
|
pthatcher2
2016/10/05 22:12:08
Just "The QUIC stream ID" would be enough.
zhihuang1
2016/10/13 06:22:40
Done.
|
| + virtual uint32_t stream_id() = 0; |
| + |
| + // The size of unsent data which is buffered by the QuicConnection so far. |
| + virtual uint64_t buffered_amount() = 0; |
|
pthatcher2
2016/10/05 22:12:07
Just "The amount of data buffered by the QuicConne
zhihuang1
2016/10/13 06:22:41
Done.
|
| + |
| + // For forward-compatibility |
|
pthatcher2
2016/10/05 22:12:08
This comment can probably be removed.
zhihuang1
2016/10/13 06:22:41
Done.
|
| + struct WriteParameters { |
| + bool fin = false; |
|
pthatcher2
2016/10/05 22:12:07
This could use a comment. When should one set fin
zhihuang1
2016/10/13 06:22:41
Done.
|
| + }; |
| + |
| + // Write data to the stream. |
|
pthatcher2
2016/10/05 22:12:07
Perhaps "Sends data reliably and in-order, bufferi
zhihuang1
2016/10/13 06:22:41
Done.
|
| + virtual void Write(const char* data, |
| + size_t size, |
| + const WriteParameters& param) = 0; |
| + |
| + virtual void Close() = 0; |
|
pthatcher2
2016/10/05 22:12:07
This could use a comment like "Once Close is calle
pthatcher2
2016/10/05 22:12:07
What happens to reading data when Close is called?
zhihuang1
2016/10/13 06:22:40
Done.
|
| + |
| + // Implemented by the WebRTC code. |
|
pthatcher2
2016/10/05 22:12:07
This would be more clear as "Implemented by the us
|
| + class Delegate { |
| + public: |
| + virtual ~Delegate() {} |
| + |
| + // Called when the data are ready(processed by QUIC). |
|
pthatcher2
2016/10/05 22:12:08
Would be more clear as "Called when data has been
zhihuang1
2016/10/13 06:22:41
Done.
|
| + virtual void OnReceived(QuartcStreamInterface* stream, |
| + const char* data, |
| + size_t size) = 0; |
| + |
| + // TODO(zhihuang) Creates a map from the integer error_code to WebRTC native |
| + // error code. |
|
pthatcher2
2016/10/05 22:12:08
Would be more clear as "Called when the stream is
zhihuang1
2016/10/13 06:22:41
Done.
There are quite a few QuicErrorCode. Should
|
| + virtual void OnClose(QuartcStreamInterface* stream, int error_code) = 0; |
| + |
| + // Called when the buffered data has been sent. |
|
pthatcher2
2016/10/05 22:12:08
When it changes or only when it decreases? If the
zhihuang1
2016/10/13 06:22:40
In our case, the buffered amount will change only
|
| + virtual void OnBufferedAmountChanged(QuartcStreamInterface* stream) = 0; |
| + }; |
| + |
| + // The |delegate| is not owned by QuartcStream. This method should only be |
| + // called once. |
|
pthatcher2
2016/10/05 22:12:08
Why should it only be called once? If the API use
|
| + virtual void SetDelegate(Delegate* delegate) = 0; |
| +}; |
| + |
| +} // namespace net |
| + |
| +#endif // NET_QUIC_QUARTC_QUARTC_STREAM_INTERFACE_H_ |