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

Unified Diff: net/http/bidirectional_stream.h

Issue 1856073002: Coalesce small buffers in net::BidirectionalStream (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address Andrei's comments 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 side-by-side diff with in-line comments
Download patch
Index: net/http/bidirectional_stream.h
diff --git a/net/http/bidirectional_stream.h b/net/http/bidirectional_stream.h
index 7e6152a48f9d699b62d8853419dfdde9267e1e51..a4dc7d79d7794deb44e2f50c940e407ba0b23586 100644
--- a/net/http/bidirectional_stream.h
+++ b/net/http/bidirectional_stream.h
@@ -29,8 +29,9 @@ struct BidirectionalStreamRequestInfo;
struct SSLConfig;
// A class to do HTTP/2 bidirectional streaming. Note that at most one each of
-// ReadData or SendData should be in flight until the operation completes.
-// The BidirectionalStream must be torn down before the HttpNetworkSession.
+// ReadData or SendData/SendvData should be in flight until the operation
+// completes. The BidirectionalStream must be torn down before the
+// HttpNetworkSession.
class NET_EXPORT BidirectionalStream
: public NON_EXPORTED_BASE(BidirectionalStreamImpl::Delegate),
public NON_EXPORTED_BASE(HttpStreamRequest::Delegate) {
@@ -41,13 +42,13 @@ class NET_EXPORT BidirectionalStream
public:
Delegate();
- // Called when headers have been sent. This is called at most once for
- // the lifetime of a stream.
+ // Called when the stream is ready for writing and reading. This is called
+ // at most once for the lifetime of a stream.
// The delegate may call BidirectionalStream::ReadData to start reading,
// or call BidirectionalStream::SendData to send data.
// The delegate should not call BidirectionalStream::Cancel
// during this callback.
- virtual void OnHeadersSent() = 0;
+ virtual void OnStreamReady() = 0;
// Called when headers are received. This is called at most once for the
// lifetime of a stream.
@@ -93,12 +94,14 @@ class NET_EXPORT BidirectionalStream
// |session| and |delegate| must outlive |this|.
BidirectionalStream(scoped_ptr<BidirectionalStreamRequestInfo> request_info,
HttpNetworkSession* session,
+ bool disable_auto_flush,
Delegate* delegate);
// Constructor that accepts a Timer, which can be used in tests to control
// the buffering of received data.
BidirectionalStream(scoped_ptr<BidirectionalStreamRequestInfo> request_info,
HttpNetworkSession* session,
+ bool disable_auto_flush,
Delegate* delegate,
scoped_ptr<base::Timer> timer);
@@ -121,6 +124,11 @@ class NET_EXPORT BidirectionalStream
// flag.
void SendData(IOBuffer* data, int length, bool end_stream);
+ // Same as SendData except this takes in a vector of IOBuffers.
+ void SendvData(const std::vector<IOBuffer*>& buffers,
+ const std::vector<int>& lengths,
+ bool end_stream);
+
// If |stream_request_| is non-NULL, cancel it. If |stream_impl_| is
// established, cancel it. No delegate method will be called after Cancel().
// Any pending operations may or may not succeed.
@@ -147,7 +155,7 @@ class NET_EXPORT BidirectionalStream
private:
// BidirectionalStreamImpl::Delegate implementation:
- void OnHeadersSent() override;
+ void OnStreamReady() override;
void OnHeadersReceived(const SpdyHeaderBlock& response_headers) override;
void OnDataRead(int bytes_read) override;
void OnDataSent() override;
@@ -190,6 +198,7 @@ class NET_EXPORT BidirectionalStream
HttpNetworkSession* session_;
+ bool disable_auto_flush_;
Delegate* const delegate_;
// Timer used to buffer data received in short time-spans and send a single

Powered by Google App Engine
This is Rietveld 408576698