Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(57)

Side by Side Diff: net/http/bidirectional_stream_impl.h

Issue 1856073002: Coalesce small buffers in net::BidirectionalStream (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix javadoc Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/http/bidirectional_stream.cc ('k') | net/http/bidirectional_stream_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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>
(...skipping 18 matching lines...) Expand all
29 // operation completes synchronously or asynchronously. 29 // operation completes synchronously or asynchronously.
30 // BidirectionalStreamImpl once created by HttpStreamFactoryImpl should be owned 30 // BidirectionalStreamImpl once created by HttpStreamFactoryImpl should be owned
31 // by BidirectionalStream. 31 // by BidirectionalStream.
32 class NET_EXPORT_PRIVATE BidirectionalStreamImpl { 32 class NET_EXPORT_PRIVATE BidirectionalStreamImpl {
33 public: 33 public:
34 // Delegate to handle BidirectionalStreamImpl events. 34 // Delegate to handle BidirectionalStreamImpl events.
35 class NET_EXPORT_PRIVATE Delegate { 35 class NET_EXPORT_PRIVATE Delegate {
36 public: 36 public:
37 Delegate(); 37 Delegate();
38 38
39 // Called when the request headers have been sent. 39 // Called when the stream is ready for reading and writing.
40 // The delegate may call BidirectionalStreamImpl::ReadData to start reading, 40 // The delegate may call BidirectionalStreamImpl::ReadData to start reading,
41 // call BidirectionalStreamImpl::SendData to send data, 41 // call BidirectionalStreamImpl::SendData to send data,
42 // or call BidirectionalStreamImpl::Cancel to cancel the stream. 42 // or call BidirectionalStreamImpl::Cancel to cancel the stream.
43 // The delegate should not call BidirectionalStreamImpl::Cancel 43 // The delegate should not call BidirectionalStreamImpl::Cancel
44 // during this callback. 44 // during this callback.
45 virtual void OnHeadersSent() = 0; 45 virtual void OnStreamReady() = 0;
46 46
47 // Called when response headers are received. 47 // Called when response headers are received.
48 // This is called at most once for the lifetime of a stream. 48 // This is called at most once for the lifetime of a stream.
49 // The delegate may call BidirectionalStreamImpl::ReadData to start 49 // The delegate may call BidirectionalStreamImpl::ReadData to start
50 // reading, call BidirectionalStreamImpl::SendData to send data, 50 // reading, call BidirectionalStreamImpl::SendData to send data,
51 // or call BidirectionalStreamImpl::Cancel to cancel the stream. 51 // or call BidirectionalStreamImpl::Cancel to cancel the stream.
52 virtual void OnHeadersReceived(const SpdyHeaderBlock& response_headers) = 0; 52 virtual void OnHeadersReceived(const SpdyHeaderBlock& response_headers) = 0;
53 53
54 // Called when read is completed asynchronously. |bytes_read| specifies how 54 // Called when read is completed asynchronously. |bytes_read| specifies how
55 // much data is available. 55 // much data is available.
(...skipping 28 matching lines...) Expand all
84 84
85 BidirectionalStreamImpl(); 85 BidirectionalStreamImpl();
86 86
87 // |this| should not be destroyed during Delegate::OnHeadersSent or 87 // |this| should not be destroyed during Delegate::OnHeadersSent or
88 // Delegate::OnDataSent. 88 // Delegate::OnDataSent.
89 virtual ~BidirectionalStreamImpl(); 89 virtual ~BidirectionalStreamImpl();
90 90
91 // Starts the BidirectionalStreamImpl and sends request headers. 91 // Starts the BidirectionalStreamImpl and sends request headers.
92 virtual void Start(const BidirectionalStreamRequestInfo* request_info, 92 virtual void Start(const BidirectionalStreamRequestInfo* request_info,
93 const BoundNetLog& net_log, 93 const BoundNetLog& net_log,
94 bool disable_auto_flush,
94 BidirectionalStreamImpl::Delegate* delegate, 95 BidirectionalStreamImpl::Delegate* delegate,
95 std::unique_ptr<base::Timer> timer) = 0; 96 std::unique_ptr<base::Timer> timer) = 0;
96 97
97 // Reads at most |buf_len| bytes into |buf|. Returns the number of bytes read, 98 // Reads at most |buf_len| bytes into |buf|. Returns the number of bytes read,
98 // ERR_IO_PENDING if the read is to be completed asynchronously, or an error 99 // ERR_IO_PENDING if the read is to be completed asynchronously, or an error
99 // code if any error occurred. If returns 0, there is no more data to read. 100 // code if any error occurred. If returns 0, there is no more data to read.
100 // This should not be called before Delegate::OnHeadersReceived is invoked, 101 // This should not be called before Delegate::OnHeadersReceived is invoked,
101 // and should not be called again unless it returns with number greater than 102 // and should not be called again unless it returns with number greater than
102 // 0 or until Delegate::OnDataRead is invoked. 103 // 0 or until Delegate::OnDataRead is invoked.
103 virtual int ReadData(IOBuffer* buf, int buf_len) = 0; 104 virtual int ReadData(IOBuffer* buf, int buf_len) = 0;
104 105
105 // Sends data. This should not be called be called before 106 // Sends data. This should not be called be called before
106 // Delegate::OnHeadersSent is invoked, and should not be called again until 107 // Delegate::OnHeadersSent is invoked, and should not be called again until
107 // Delegate::OnDataSent is invoked. If |end_stream| is true, the DATA frame 108 // Delegate::OnDataSent is invoked. If |end_stream| is true, the DATA frame
108 // will have an END_STREAM flag. 109 // will have an END_STREAM flag.
109 virtual void SendData(IOBuffer* data, int length, bool end_stream) = 0; 110 virtual void SendData(IOBuffer* data, int length, bool end_stream) = 0;
110 111
112 virtual void SendvData(const std::vector<IOBuffer*>& buffers,
113 const std::vector<int>& lengths,
114 bool end_stream) = 0;
115
111 // Cancels the stream. No Delegate method will be called. Any pending 116 // Cancels the stream. No Delegate method will be called. Any pending
112 // operations may or may not succeed. 117 // operations may or may not succeed.
113 virtual void Cancel() = 0; 118 virtual void Cancel() = 0;
114 119
115 // Returns the protocol used by this stream. If stream has not been 120 // Returns the protocol used by this stream. If stream has not been
116 // established, return kProtoUnknown. 121 // established, return kProtoUnknown.
117 virtual NextProto GetProtocol() const = 0; 122 virtual NextProto GetProtocol() const = 0;
118 123
119 // Total number of bytes received over the network of SPDY data, headers, and 124 // Total number of bytes received over the network of SPDY data, headers, and
120 // push_promise frames associated with this stream, including the size of 125 // push_promise frames associated with this stream, including the size of
121 // frame headers, after SSL decryption and not including proxy overhead. 126 // frame headers, after SSL decryption and not including proxy overhead.
122 virtual int64_t GetTotalReceivedBytes() const = 0; 127 virtual int64_t GetTotalReceivedBytes() const = 0;
123 128
124 // Total number of bytes sent over the network of SPDY frames associated with 129 // Total number of bytes sent over the network of SPDY frames associated with
125 // this stream, including the size of frame headers, before SSL encryption and 130 // this stream, including the size of frame headers, before SSL encryption and
126 // not including proxy overhead. Note that some SPDY frames such as pings are 131 // not including proxy overhead. Note that some SPDY frames such as pings are
127 // not associated with any stream, and are not included in this value. 132 // not associated with any stream, and are not included in this value.
128 virtual int64_t GetTotalSentBytes() const = 0; 133 virtual int64_t GetTotalSentBytes() const = 0;
129 134
130 private: 135 private:
131 DISALLOW_COPY_AND_ASSIGN(BidirectionalStreamImpl); 136 DISALLOW_COPY_AND_ASSIGN(BidirectionalStreamImpl);
132 }; 137 };
133 138
134 } // namespace net 139 } // namespace net
135 140
136 #endif // NET_HTTP_BIDIRECTIONAL_STREAM_IMPL_H_ 141 #endif // NET_HTTP_BIDIRECTIONAL_STREAM_IMPL_H_
OLDNEW
« no previous file with comments | « net/http/bidirectional_stream.cc ('k') | net/http/bidirectional_stream_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698