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

Unified Diff: net/quic/chromium/quic_chromium_client_stream.h

Issue 2880643004: Move the async write handling from QuicChromiumClientStream to the Handle (Closed)
Patch Set: Rebase Created 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | net/quic/chromium/quic_chromium_client_stream.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/chromium/quic_chromium_client_stream.h
diff --git a/net/quic/chromium/quic_chromium_client_stream.h b/net/quic/chromium/quic_chromium_client_stream.h
index 14901d8edcfdfbbc67c6c7b1fd53a7a1f3410581..e512b457b9a8126c425b76047aa182ee0871f3c5 100644
--- a/net/quic/chromium/quic_chromium_client_stream.h
+++ b/net/quic/chromium/quic_chromium_client_stream.h
@@ -157,6 +157,7 @@ class NET_EXPORT_PRIVATE QuicChromiumClientStream : public QuicSpdyStream {
void OnTrailingHeadersAvailable(const SpdyHeaderBlock& headers,
size_t frame_len);
void OnDataAvailable();
+ void OnCanWrite();
void OnClose();
void OnError(int error);
@@ -166,13 +167,19 @@ class NET_EXPORT_PRIVATE QuicChromiumClientStream : public QuicSpdyStream {
QuicChromiumClientStream* stream_; // Unowned.
Delegate* delegate_; // Owns this.
+ // Callback to be invoked when ReadHeaders completes asynchronously.
CompletionCallback read_headers_callback_;
SpdyHeaderBlock* read_headers_buffer_;
+ // Callback to be invoked when ReadBody completes asynchronously.
CompletionCallback read_body_callback_;
IOBuffer* read_body_buffer_;
int read_body_buffer_len_;
+ // Callback to be invoked when WriteStreamData or WritevStreamData completes
+ // asynchronously.
+ CompletionCallback write_callback_;
+
QuicStreamId id_;
QuicErrorCode connection_error_;
QuicRstStreamErrorCode stream_error_;
@@ -217,15 +224,15 @@ class NET_EXPORT_PRIVATE QuicChromiumClientStream : public QuicSpdyStream {
// of client-side streams should be able to set the priority.
using QuicSpdyStream::SetPriority;
- int WriteStreamData(QuicStringPiece data,
- bool fin,
- const CompletionCallback& callback);
+ // Writes |data| to the peer and closes the write side if |fin| is true.
+ // Returns true if the data have been fully written. If the data was not fully
+ // written, returns false and OnCanWrite() will be invoked later.
+ bool WriteStreamData(QuicStringPiece data, bool fin);
// Same as WriteStreamData except it writes data from a vector of IOBuffers,
// with the length of each buffer at the corresponding index in |lengths|.
- int WritevStreamData(const std::vector<scoped_refptr<IOBuffer>>& buffers,
- const std::vector<int>& lengths,
- bool fin,
- const CompletionCallback& callback);
+ bool WritevStreamData(const std::vector<scoped_refptr<IOBuffer>>& buffers,
+ const std::vector<int>& lengths,
+ bool fin);
// Creates a new Handle for this stream and sets |delegate| on the handle.
// Must only be called once.
@@ -274,10 +281,6 @@ class NET_EXPORT_PRIVATE QuicChromiumClientStream : public QuicSpdyStream {
// True when initial headers have been sent.
bool initial_headers_sent_;
- // Callback to be invoked when WriteStreamData or WritevStreamData completes
- // asynchronously.
- CompletionCallback write_callback_;
-
QuicClientSessionBase* session_;
// Set to false if this stream to not be migrated during connection migration.
« no previous file with comments | « no previous file | net/quic/chromium/quic_chromium_client_stream.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698