| 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_IMPL_H_ | 5 #ifndef NET_HTTP_BIDIRECTIONAL_STREAM_IMPL_H_ |
| 6 #define NET_HTTP_BIDIRECTIONAL_STREAM_IMPL_H_ | 6 #define NET_HTTP_BIDIRECTIONAL_STREAM_IMPL_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| 11 | 11 |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "base/memory/ref_counted.h" |
| 13 #include "net/base/net_export.h" | 14 #include "net/base/net_export.h" |
| 14 #include "net/socket/next_proto.h" | 15 #include "net/socket/next_proto.h" |
| 15 | 16 |
| 16 namespace base { | 17 namespace base { |
| 17 class Timer; | 18 class Timer; |
| 18 } // namespace base | 19 } // namespace base |
| 19 | 20 |
| 20 namespace net { | 21 namespace net { |
| 21 | 22 |
| 22 class BoundNetLog; | 23 class BoundNetLog; |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 // code if any error occurred. If returns 0, there is no more data to read. | 101 // code if any error occurred. If returns 0, there is no more data to read. |
| 101 // This should not be called before Delegate::OnHeadersReceived is invoked, | 102 // This should not be called before Delegate::OnHeadersReceived is invoked, |
| 102 // and should not be called again unless it returns with number greater than | 103 // and should not be called again unless it returns with number greater than |
| 103 // 0 or until Delegate::OnDataRead is invoked. | 104 // 0 or until Delegate::OnDataRead is invoked. |
| 104 virtual int ReadData(IOBuffer* buf, int buf_len) = 0; | 105 virtual int ReadData(IOBuffer* buf, int buf_len) = 0; |
| 105 | 106 |
| 106 // Sends data. This should not be called be called before | 107 // Sends data. This should not be called be called before |
| 107 // Delegate::OnHeadersSent is invoked, and should not be called again until | 108 // Delegate::OnHeadersSent is invoked, and should not be called again until |
| 108 // Delegate::OnDataSent is invoked. If |end_stream| is true, the DATA frame | 109 // Delegate::OnDataSent is invoked. If |end_stream| is true, the DATA frame |
| 109 // will have an END_STREAM flag. | 110 // will have an END_STREAM flag. |
| 110 virtual void SendData(IOBuffer* data, int length, bool end_stream) = 0; | 111 virtual void SendData(const scoped_refptr<IOBuffer>& data, |
| 112 int length, |
| 113 bool end_stream) = 0; |
| 111 | 114 |
| 112 virtual void SendvData(const std::vector<IOBuffer*>& buffers, | 115 virtual void SendvData(const std::vector<scoped_refptr<IOBuffer>>& buffers, |
| 113 const std::vector<int>& lengths, | 116 const std::vector<int>& lengths, |
| 114 bool end_stream) = 0; | 117 bool end_stream) = 0; |
| 115 | 118 |
| 116 // Cancels the stream. No Delegate method will be called. Any pending | 119 // Cancels the stream. No Delegate method will be called. Any pending |
| 117 // operations may or may not succeed. | 120 // operations may or may not succeed. |
| 118 virtual void Cancel() = 0; | 121 virtual void Cancel() = 0; |
| 119 | 122 |
| 120 // Returns the protocol used by this stream. If stream has not been | 123 // Returns the protocol used by this stream. If stream has not been |
| 121 // established, return kProtoUnknown. | 124 // established, return kProtoUnknown. |
| 122 virtual NextProto GetProtocol() const = 0; | 125 virtual NextProto GetProtocol() const = 0; |
| 123 | 126 |
| 124 // Total number of bytes received over the network of SPDY data, headers, and | 127 // Total number of bytes received over the network of SPDY data, headers, and |
| 125 // push_promise frames associated with this stream, including the size of | 128 // push_promise frames associated with this stream, including the size of |
| 126 // frame headers, after SSL decryption and not including proxy overhead. | 129 // frame headers, after SSL decryption and not including proxy overhead. |
| 127 virtual int64_t GetTotalReceivedBytes() const = 0; | 130 virtual int64_t GetTotalReceivedBytes() const = 0; |
| 128 | 131 |
| 129 // Total number of bytes sent over the network of SPDY frames associated with | 132 // Total number of bytes sent over the network of SPDY frames associated with |
| 130 // this stream, including the size of frame headers, before SSL encryption and | 133 // this stream, including the size of frame headers, before SSL encryption and |
| 131 // not including proxy overhead. Note that some SPDY frames such as pings are | 134 // not including proxy overhead. Note that some SPDY frames such as pings are |
| 132 // not associated with any stream, and are not included in this value. | 135 // not associated with any stream, and are not included in this value. |
| 133 virtual int64_t GetTotalSentBytes() const = 0; | 136 virtual int64_t GetTotalSentBytes() const = 0; |
| 134 | 137 |
| 135 private: | 138 private: |
| 136 DISALLOW_COPY_AND_ASSIGN(BidirectionalStreamImpl); | 139 DISALLOW_COPY_AND_ASSIGN(BidirectionalStreamImpl); |
| 137 }; | 140 }; |
| 138 | 141 |
| 139 } // namespace net | 142 } // namespace net |
| 140 | 143 |
| 141 #endif // NET_HTTP_BIDIRECTIONAL_STREAM_IMPL_H_ | 144 #endif // NET_HTTP_BIDIRECTIONAL_STREAM_IMPL_H_ |
| OLD | NEW |