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

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

Issue 1992953004: [Cronet] Make delaying sending request headers explicit in bidirectional stream (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: self review Created 4 years, 7 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
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_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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 DISALLOW_COPY_AND_ASSIGN(Delegate); 90 DISALLOW_COPY_AND_ASSIGN(Delegate);
91 }; 91 };
92 92
93 // Constructs a BidirectionalStream. |request_info| contains information about 93 // Constructs a BidirectionalStream. |request_info| contains information about
94 // the request, and must be non-NULL. |session| is the http network session 94 // the request, and must be non-NULL. |session| is the http network session
95 // with which this request will be made. |delegate| must be non-NULL. 95 // with which this request will be made. |delegate| must be non-NULL.
96 // |session| and |delegate| must outlive |this|. 96 // |session| and |delegate| must outlive |this|.
97 BidirectionalStream( 97 BidirectionalStream(
98 std::unique_ptr<BidirectionalStreamRequestInfo> request_info, 98 std::unique_ptr<BidirectionalStreamRequestInfo> request_info,
99 HttpNetworkSession* session, 99 HttpNetworkSession* session,
100 bool disable_auto_flush, 100 bool delay_headers_until_next_send_data,
mef 2016/05/23 14:57:26 Um, shouldn't |disable_auto_flush| still be a thin
101 Delegate* delegate); 101 Delegate* delegate);
102 102
103 // Constructor that accepts a Timer, which can be used in tests to control 103 // Constructor that accepts a Timer, which can be used in tests to control
104 // the buffering of received data. 104 // the buffering of received data.
105 BidirectionalStream( 105 BidirectionalStream(
106 std::unique_ptr<BidirectionalStreamRequestInfo> request_info, 106 std::unique_ptr<BidirectionalStreamRequestInfo> request_info,
107 HttpNetworkSession* session, 107 HttpNetworkSession* session,
108 bool disable_auto_flush, 108 bool delay_headers_until_next_send_data,
109 Delegate* delegate, 109 Delegate* delegate,
110 std::unique_ptr<base::Timer> timer); 110 std::unique_ptr<base::Timer> timer);
111 111
112 // Cancels |stream_request_| or |stream_impl_| if applicable. 112 // Cancels |stream_request_| or |stream_impl_| if applicable.
113 // |this| should not be destroyed during Delegate::OnHeadersSent or 113 // |this| should not be destroyed during Delegate::OnHeadersSent or
114 // Delegate::OnDataSent. 114 // Delegate::OnDataSent.
115 ~BidirectionalStream() override; 115 ~BidirectionalStream() override;
116 116
117 // Reads at most |buf_len| bytes into |buf|. Returns the number of bytes read, 117 // Reads at most |buf_len| bytes into |buf|. Returns the number of bytes read,
118 // or ERR_IO_PENDING if the read is to be completed asynchronously, or an 118 // or ERR_IO_PENDING if the read is to be completed asynchronously, or an
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 const ProxyInfo& used_proxy_info, 197 const ProxyInfo& used_proxy_info,
198 HttpStream* stream) override; 198 HttpStream* stream) override;
199 void OnQuicBroken() override; 199 void OnQuicBroken() override;
200 200
201 // BidirectionalStreamRequestInfo used when requesting the stream. 201 // BidirectionalStreamRequestInfo used when requesting the stream.
202 std::unique_ptr<BidirectionalStreamRequestInfo> request_info_; 202 std::unique_ptr<BidirectionalStreamRequestInfo> request_info_;
203 const BoundNetLog net_log_; 203 const BoundNetLog net_log_;
204 204
205 HttpNetworkSession* session_; 205 HttpNetworkSession* session_;
206 206
207 bool disable_auto_flush_; 207 bool delay_headers_until_next_send_data_;
208 Delegate* const delegate_; 208 Delegate* const delegate_;
209 209
210 // Timer used to buffer data received in short time-spans and send a single 210 // Timer used to buffer data received in short time-spans and send a single
211 // read completion notification. 211 // read completion notification.
212 std::unique_ptr<base::Timer> timer_; 212 std::unique_ptr<base::Timer> timer_;
213 // HttpStreamRequest used to request a BidirectionalStreamImpl. This is NULL 213 // HttpStreamRequest used to request a BidirectionalStreamImpl. This is NULL
214 // if the request has been canceled or completed. 214 // if the request has been canceled or completed.
215 std::unique_ptr<HttpStreamRequest> stream_request_; 215 std::unique_ptr<HttpStreamRequest> stream_request_;
216 // The underlying BidirectioanlStreamImpl used for this stream. It is 216 // The underlying BidirectioanlStreamImpl used for this stream. It is
217 // non-NULL, if the |stream_request_| successfully finishes. 217 // non-NULL, if the |stream_request_| successfully finishes.
218 std::unique_ptr<BidirectionalStreamImpl> stream_impl_; 218 std::unique_ptr<BidirectionalStreamImpl> stream_impl_;
219 219
220 // Buffer used for reading. 220 // Buffer used for reading.
221 scoped_refptr<IOBuffer> read_buffer_; 221 scoped_refptr<IOBuffer> read_buffer_;
222 // List of buffers used for writing. 222 // List of buffers used for writing.
223 std::vector<scoped_refptr<IOBuffer>> write_buffer_list_; 223 std::vector<scoped_refptr<IOBuffer>> write_buffer_list_;
224 // List of buffer length. 224 // List of buffer length.
225 std::vector<int> write_buffer_len_list_; 225 std::vector<int> write_buffer_len_list_;
226 226
227 DISALLOW_COPY_AND_ASSIGN(BidirectionalStream); 227 DISALLOW_COPY_AND_ASSIGN(BidirectionalStream);
228 }; 228 };
229 229
230 } // namespace net 230 } // namespace net
231 231
232 #endif // NET_HTTP_BIDIRECTIONAL_STREAM_H_ 232 #endif // NET_HTTP_BIDIRECTIONAL_STREAM_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698