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

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

Issue 2877063002: Add an async ReadBody method to QuicChromiumClientStream::Handle (Closed)
Patch Set: format 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
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 9192d5cc3ff368297897919c398ab965566fa7c1..14901d8edcfdfbbc67c6c7b1fd53a7a1f3410581 100644
--- a/net/quic/chromium/quic_chromium_client_stream.h
+++ b/net/quic/chromium/quic_chromium_client_stream.h
@@ -43,9 +43,6 @@ class NET_EXPORT_PRIVATE QuicChromiumClientStream : public QuicSpdyStream {
virtual void OnTrailingHeadersAvailable(const SpdyHeaderBlock& headers,
size_t frame_len) = 0;
- // Called when data is available to be read.
- virtual void OnDataAvailable() = 0;
-
// Called when the stream is closed by the peer.
virtual void OnClose() = 0;
@@ -76,6 +73,15 @@ class NET_EXPORT_PRIVATE QuicChromiumClientStream : public QuicSpdyStream {
int ReadInitialHeaders(SpdyHeaderBlock* header_block,
const CompletionCallback& callback);
+ // Reads at most |buffer_len| bytes of body into |buffer| and returns the
+ // number of bytes read. If body is not available, returns ERR_IO_PENDING
+ // and will invoke |callback| asynchronously when data arrive.
+ // TODO(rch): Invoke |callback| when there is a stream or connection error
+ // instead of calling OnClose() or OnError().
+ int ReadBody(IOBuffer* buffer,
+ int buffer_len,
+ const CompletionCallback& callback);
+
// Writes |header_block| to the peer. Closes the write side if |fin| is
// true. If non-null, |ack_notifier_delegate| will be notified when the
// headers are ACK'd by the peer.
@@ -163,6 +169,10 @@ class NET_EXPORT_PRIVATE QuicChromiumClientStream : public QuicSpdyStream {
CompletionCallback read_headers_callback_;
SpdyHeaderBlock* read_headers_buffer_;
+ CompletionCallback read_body_callback_;
+ IOBuffer* read_body_buffer_;
+ int read_body_buffer_len_;
+
QuicStreamId id_;
QuicErrorCode connection_error_;
QuicRstStreamErrorCode stream_error_;
« no previous file with comments | « net/quic/chromium/bidirectional_stream_quic_impl_unittest.cc ('k') | net/quic/chromium/quic_chromium_client_stream.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698