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

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

Issue 2873963003: Add an async ReadInitialHeaders method to QuicChromiumClientStream::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
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 e8d05e96ba88735e189821e65d50ed7db657cef2..9192d5cc3ff368297897919c398ab965566fa7c1 100644
--- a/net/quic/chromium/quic_chromium_client_stream.h
+++ b/net/quic/chromium/quic_chromium_client_stream.h
@@ -39,10 +39,6 @@ class NET_EXPORT_PRIVATE QuicChromiumClientStream : public QuicSpdyStream {
public:
Delegate() {}
- // Called when initial headers are available.
- virtual void OnInitialHeadersAvailable(const SpdyHeaderBlock& headers,
- size_t frame_len) = 0;
-
// Called when trailing headers are available.
virtual void OnTrailingHeadersAvailable(const SpdyHeaderBlock& headers,
size_t frame_len) = 0;
@@ -71,6 +67,15 @@ class NET_EXPORT_PRIVATE QuicChromiumClientStream : public QuicSpdyStream {
// Returns true if the stream is still connected.
bool IsOpen() { return stream_ != nullptr; }
+ // Reads initial headers into |header_block| and returns the length of
+ // the HEADERS frame which contained them. If headers are not available,
+ // returns ERR_IO_PENDING and will invoke |callback| asynchronously when
+ // the headers arrive.
+ // TODO(rch): Invoke |callback| when there is a stream or connection error
+ // instead of calling OnClose() or OnError().
+ int ReadInitialHeaders(SpdyHeaderBlock* header_block,
+ 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.
@@ -142,8 +147,7 @@ class NET_EXPORT_PRIVATE QuicChromiumClientStream : public QuicSpdyStream {
Handle(QuicChromiumClientStream* stream, Delegate* delegate);
// Methods invoked by the stream.
- void OnInitialHeadersAvailable(const SpdyHeaderBlock& headers,
- size_t frame_len);
+ void OnInitialHeadersAvailable();
void OnTrailingHeadersAvailable(const SpdyHeaderBlock& headers,
size_t frame_len);
void OnDataAvailable();
@@ -156,6 +160,9 @@ class NET_EXPORT_PRIVATE QuicChromiumClientStream : public QuicSpdyStream {
QuicChromiumClientStream* stream_; // Unowned.
Delegate* delegate_; // Owns this.
+ CompletionCallback read_headers_callback_;
+ SpdyHeaderBlock* read_headers_buffer_;
+
QuicStreamId id_;
QuicErrorCode connection_error_;
QuicRstStreamErrorCode stream_error_;
@@ -234,14 +241,14 @@ class NET_EXPORT_PRIVATE QuicChromiumClientStream : public QuicSpdyStream {
// True if this stream is the first data stream created on this session.
bool IsFirstStream();
+ bool DeliverInitialHeaders(SpdyHeaderBlock* header_block, int* frame_len);
+
using QuicSpdyStream::HasBufferedData;
using QuicStream::sequencer;
private:
- void NotifyHandleOfInitialHeadersAvailableLater(SpdyHeaderBlock headers,
- size_t frame_len);
- void NotifyHandleOfInitialHeadersAvailable(SpdyHeaderBlock headers,
- size_t frame_len);
+ void NotifyHandleOfInitialHeadersAvailableLater();
+ void NotifyHandleOfInitialHeadersAvailable();
void NotifyHandleOfTrailingHeadersAvailableLater(SpdyHeaderBlock headers,
size_t frame_len);
void NotifyHandleOfTrailingHeadersAvailable(SpdyHeaderBlock headers,
« 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