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

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

Issue 2900533002: Add an async ReadTrailers method to QuicChromiumClientStream::Handle (Closed)
Patch Set: Rebase and fix test 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 e512b457b9a8126c425b76047aa182ee0871f3c5..e95d47840629d81a4c5940db3c8f7877a47ce6a0 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 trailing headers are available.
- virtual void OnTrailingHeadersAvailable(const SpdyHeaderBlock& headers,
- size_t frame_len) = 0;
-
// Called when the stream is closed by the peer.
virtual void OnClose() = 0;
@@ -82,6 +78,15 @@ class NET_EXPORT_PRIVATE QuicChromiumClientStream : public QuicSpdyStream {
int buffer_len,
const CompletionCallback& callback);
+ // Reads trailing 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 ReadTrailingHeaders(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.
@@ -154,8 +159,7 @@ class NET_EXPORT_PRIVATE QuicChromiumClientStream : public QuicSpdyStream {
// Methods invoked by the stream.
void OnInitialHeadersAvailable();
- void OnTrailingHeadersAvailable(const SpdyHeaderBlock& headers,
- size_t frame_len);
+ void OnTrailingHeadersAvailable();
void OnDataAvailable();
void OnCanWrite();
void OnClose();
@@ -260,16 +264,16 @@ class NET_EXPORT_PRIVATE QuicChromiumClientStream : public QuicSpdyStream {
bool DeliverInitialHeaders(SpdyHeaderBlock* header_block, int* frame_len);
+ bool DeliverTrailingHeaders(SpdyHeaderBlock* header_block, int* frame_len);
+
using QuicSpdyStream::HasBufferedData;
using QuicStream::sequencer;
private:
void NotifyHandleOfInitialHeadersAvailableLater();
void NotifyHandleOfInitialHeadersAvailable();
- void NotifyHandleOfTrailingHeadersAvailableLater(SpdyHeaderBlock headers,
- size_t frame_len);
- void NotifyHandleOfTrailingHeadersAvailable(SpdyHeaderBlock headers,
- size_t frame_len);
+ void NotifyHandleOfTrailingHeadersAvailableLater();
+ void NotifyHandleOfTrailingHeadersAvailable();
void NotifyHandleOfDataAvailableLater();
void NotifyHandleOfDataAvailable();
@@ -291,6 +295,9 @@ class NET_EXPORT_PRIVATE QuicChromiumClientStream : public QuicSpdyStream {
// Length of the HEADERS frame containing initial headers.
size_t initial_headers_frame_len_;
+ // Length of the HEADERS frame containing trailing headers.
+ size_t trailing_headers_frame_len_;
xunjieli 2017/05/29 14:06:08 nit: need to default initialize this size_t in Qui
Ryan Hamilton 2017/05/29 16:27:23 Done.
+
base::WeakPtrFactory<QuicChromiumClientStream> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(QuicChromiumClientStream);

Powered by Google App Engine
This is Rietveld 408576698