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

Unified Diff: net/quic/chromium/quic_http_stream.cc

Issue 2900533002: Add an async ReadTrailers 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_http_stream.cc
diff --git a/net/quic/chromium/quic_http_stream.cc b/net/quic/chromium/quic_http_stream.cc
index 80be4521cee557c501cc44e6ec50a77e8ecd394f..6611fba87b302be51da3fa8fd45256b1d9e78f3d 100644
--- a/net/quic/chromium/quic_http_stream.cc
+++ b/net/quic/chromium/quic_http_stream.cc
@@ -464,10 +464,22 @@ void QuicHttpStream::OnReadResponseHeadersComplete(int rv) {
}
}
-void QuicHttpStream::OnTrailingHeadersAvailable(const SpdyHeaderBlock& headers,
- size_t frame_len) {
+void QuicHttpStream::ReadTrailingHeaders() {
+ if (!stream_)
xunjieli 2017/05/26 15:53:06 Is the null check needed? I thought the handle is
Ryan Hamilton 2017/05/26 22:35:50 It's still null out in ResetStream, as of this CL.
xunjieli 2017/05/29 14:06:08 Acknowledged.
+ return;
+
+ int rv = stream_->ReadTrailingHeaders(
+ &trailing_header_block_,
+ base::Bind(&QuicHttpStream::OnReadTrailingHeadersComplete,
+ weak_factory_.GetWeakPtr()));
+
+ OnReadTrailingHeadersComplete(rv);
xunjieli 2017/05/26 15:53:05 Should we test (rv != ERR_IO_PENDING) before calli
Ryan Hamilton 2017/05/26 22:35:50 Good point. Amusingly, OnReadTrailingHeadersComple
+}
+
+void QuicHttpStream::OnReadTrailingHeadersComplete(int rv) {
DCHECK(response_headers_received_);
- headers_bytes_received_ += frame_len;
+ if (rv > 0)
+ headers_bytes_received_ += rv;
// QuicHttpStream ignores trailers.
if (stream_->IsDoneReading()) {
@@ -751,6 +763,11 @@ int QuicHttpStream::ProcessResponseHeaders(const SpdyHeaderBlock& headers) {
// Populate |connect_timing_| when response headers are received. This should
// take care of 0-RTT where request is sent before handshake is confirmed.
connect_timing_ = quic_session()->GetConnectTiming();
+
+ base::ThreadTaskRunnerHandle::Get()->PostTask(
+ FROM_HERE, base::Bind(&QuicHttpStream::ReadTrailingHeaders,
+ weak_factory_.GetWeakPtr()));
+
return OK;
}

Powered by Google App Engine
This is Rietveld 408576698