Chromium Code Reviews| 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_STREAM_INTERFACE_H_ | |
| 6 #define NET_QUIC_QUARTC_QUARTC_STREAM_INTERFACE_H_ | |
| 7 | |
| 8 namespace net { | |
| 9 | |
| 10 // QuartcSession will create implementations of this interface to send and | |
| 11 // 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.
| |
| 12 class QuartcStreamInterface { | |
| 13 public: | |
| 14 virtual ~QuartcStreamInterface() {} | |
| 15 | |
| 16 // 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.
| |
| 17 virtual uint32_t stream_id() = 0; | |
| 18 | |
| 19 // The size of unsent data which is buffered by the QuicConnection so far. | |
| 20 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.
| |
| 21 | |
| 22 // For forward-compatibility | |
|
pthatcher2
2016/10/05 22:12:08
This comment can probably be removed.
zhihuang1
2016/10/13 06:22:41
Done.
| |
| 23 struct WriteParameters { | |
| 24 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.
| |
| 25 }; | |
| 26 | |
| 27 // 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.
| |
| 28 virtual void Write(const char* data, | |
| 29 size_t size, | |
| 30 const WriteParameters& param) = 0; | |
| 31 | |
| 32 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.
| |
| 33 | |
| 34 // Implemented by the WebRTC code. | |
|
pthatcher2
2016/10/05 22:12:07
This would be more clear as "Implemented by the us
| |
| 35 class Delegate { | |
| 36 public: | |
| 37 virtual ~Delegate() {} | |
| 38 | |
| 39 // 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.
| |
| 40 virtual void OnReceived(QuartcStreamInterface* stream, | |
| 41 const char* data, | |
| 42 size_t size) = 0; | |
| 43 | |
| 44 // TODO(zhihuang) Creates a map from the integer error_code to WebRTC native | |
| 45 // 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
| |
| 46 virtual void OnClose(QuartcStreamInterface* stream, int error_code) = 0; | |
| 47 | |
| 48 // 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
| |
| 49 virtual void OnBufferedAmountChanged(QuartcStreamInterface* stream) = 0; | |
| 50 }; | |
| 51 | |
| 52 // The |delegate| is not owned by QuartcStream. This method should only be | |
| 53 // called once. | |
|
pthatcher2
2016/10/05 22:12:08
Why should it only be called once? If the API use
| |
| 54 virtual void SetDelegate(Delegate* delegate) = 0; | |
| 55 }; | |
| 56 | |
| 57 } // namespace net | |
| 58 | |
| 59 #endif // NET_QUIC_QUARTC_QUARTC_STREAM_INTERFACE_H_ | |
| OLD | NEW |