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

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

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
« no previous file with comments | « net/quic/chromium/quic_http_stream.h ('k') | net/quic/chromium/quic_http_stream_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 d7a0a739955f1636b6b8982e282dcbda5a7a132b..ba7477f9d00a4729a62335297860ca1274d56852 100644
--- a/net/quic/chromium/quic_http_stream.cc
+++ b/net/quic/chromium/quic_http_stream.cc
@@ -313,14 +313,28 @@ int QuicHttpStream::ReadResponseHeaders(const CompletionCallback& callback) {
if (stream_ == nullptr)
return GetResponseStatus();
+
+ int rv = stream_->ReadInitialHeaders(
+ &response_header_block_,
+ base::Bind(&QuicHttpStream::OnReadResponseHeadersComplete,
+ weak_factory_.GetWeakPtr()));
+
+ if (rv == ERR_IO_PENDING) {
+ // Still waiting for the response, return IO_PENDING.
+ CHECK(callback_.is_null());
+ callback_ = callback;
+ return ERR_IO_PENDING;
+ }
+
+ if (rv < 0)
+ return rv;
+
// Check if we already have the response headers. If so, return synchronously.
if (response_headers_received_)
return OK;
- // Still waiting for the response, return IO_PENDING.
- CHECK(callback_.is_null());
- callback_ = callback;
- return ERR_IO_PENDING;
+ headers_bytes_received_ += rv;
+ return ProcessResponseHeaders(response_header_block_);
}
int QuicHttpStream::ReadResponseBody(IOBuffer* buf,
@@ -432,12 +446,13 @@ void QuicHttpStream::SetPriority(RequestPriority priority) {
priority_ = priority;
}
-void QuicHttpStream::OnInitialHeadersAvailable(const SpdyHeaderBlock& headers,
- size_t frame_len) {
+void QuicHttpStream::OnReadResponseHeadersComplete(int rv) {
+ DCHECK(callback_);
DCHECK(!response_headers_received_);
- headers_bytes_received_ += frame_len;
-
- int rv = ProcessResponseHeaders(headers);
+ if (rv > 0) {
+ headers_bytes_received_ += rv;
+ rv = ProcessResponseHeaders(response_header_block_);
+ }
if (rv != ERR_IO_PENDING && !callback_.is_null()) {
DoCallback(rv);
}
« no previous file with comments | « net/quic/chromium/quic_http_stream.h ('k') | net/quic/chromium/quic_http_stream_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698