| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #ifndef NET_HTTP_BIDIRECTIONAL_STREAM_H_ | 5 #ifndef NET_HTTP_BIDIRECTIONAL_STREAM_H_ |
| 6 #define NET_HTTP_BIDIRECTIONAL_STREAM_H_ | 6 #define NET_HTTP_BIDIRECTIONAL_STREAM_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 // error code if any error occurred. If returns 0, there is no more data to | 119 // error code if any error occurred. If returns 0, there is no more data to |
| 120 // read. This should not be called before Delegate::OnHeadersReceived is | 120 // read. This should not be called before Delegate::OnHeadersReceived is |
| 121 // invoked, and should not be called again unless it returns with number | 121 // invoked, and should not be called again unless it returns with number |
| 122 // greater than 0 or until Delegate::OnDataRead is invoked. | 122 // greater than 0 or until Delegate::OnDataRead is invoked. |
| 123 int ReadData(IOBuffer* buf, int buf_len); | 123 int ReadData(IOBuffer* buf, int buf_len); |
| 124 | 124 |
| 125 // Sends data. This should not be called before Delegate::OnHeadersSent is | 125 // Sends data. This should not be called before Delegate::OnHeadersSent is |
| 126 // invoked, and should not be called again until Delegate::OnDataSent is | 126 // invoked, and should not be called again until Delegate::OnDataSent is |
| 127 // invoked. If |end_stream| is true, the DATA frame will have an END_STREAM | 127 // invoked. If |end_stream| is true, the DATA frame will have an END_STREAM |
| 128 // flag. | 128 // flag. |
| 129 void SendData(IOBuffer* data, int length, bool end_stream); | 129 void SendData(const scoped_refptr<IOBuffer>& data, |
| 130 int length, |
| 131 bool end_stream); |
| 130 | 132 |
| 131 // Same as SendData except this takes in a vector of IOBuffers. | 133 // Same as SendData except this takes in a vector of IOBuffers. |
| 132 void SendvData(const std::vector<IOBuffer*>& buffers, | 134 void SendvData(const std::vector<scoped_refptr<IOBuffer>>& buffers, |
| 133 const std::vector<int>& lengths, | 135 const std::vector<int>& lengths, |
| 134 bool end_stream); | 136 bool end_stream); |
| 135 | 137 |
| 136 // If |stream_request_| is non-NULL, cancel it. If |stream_impl_| is | 138 // If |stream_request_| is non-NULL, cancel it. If |stream_impl_| is |
| 137 // established, cancel it. No delegate method will be called after Cancel(). | 139 // established, cancel it. No delegate method will be called after Cancel(). |
| 138 // Any pending operations may or may not succeed. | 140 // Any pending operations may or may not succeed. |
| 139 void Cancel(); | 141 void Cancel(); |
| 140 | 142 |
| 141 // Returns the protocol used by this stream. If stream has not been | 143 // Returns the protocol used by this stream. If stream has not been |
| 142 // established, return kProtoUnknown. | 144 // established, return kProtoUnknown. |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 std::vector<scoped_refptr<IOBuffer>> write_buffer_list_; | 223 std::vector<scoped_refptr<IOBuffer>> write_buffer_list_; |
| 222 // List of buffer length. | 224 // List of buffer length. |
| 223 std::vector<int> write_buffer_len_list_; | 225 std::vector<int> write_buffer_len_list_; |
| 224 | 226 |
| 225 DISALLOW_COPY_AND_ASSIGN(BidirectionalStream); | 227 DISALLOW_COPY_AND_ASSIGN(BidirectionalStream); |
| 226 }; | 228 }; |
| 227 | 229 |
| 228 } // namespace net | 230 } // namespace net |
| 229 | 231 |
| 230 #endif // NET_HTTP_BIDIRECTIONAL_STREAM_H_ | 232 #endif // NET_HTTP_BIDIRECTIONAL_STREAM_H_ |
| OLD | NEW |