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

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

Issue 2324183002: Implement QuicHttpStream::GetLoadTimingInfo (Closed)
Patch Set: add test Created 4 years, 3 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 9ec364ce0833da527ac00ce86cea55bbf0ba219a..2c6dbcb245ce97a91e182785fd6fed932d93ab19 100644
--- a/net/quic/chromium/quic_http_stream.cc
+++ b/net/quic/chromium/quic_http_stream.cc
@@ -58,6 +58,7 @@ QuicHttpStream::QuicHttpStream(
headers_bytes_sent_(0),
closed_stream_received_bytes_(0),
closed_stream_sent_bytes_(0),
+ closed_stream_id_(kInvalidStreamId),
user_buffer_len_(0),
quic_connection_error_(QUIC_NO_ERROR),
port_migration_detected_(false),
@@ -416,7 +417,20 @@ int64_t QuicHttpStream::GetTotalSentBytes() const {
}
bool QuicHttpStream::GetLoadTimingInfo(LoadTimingInfo* load_timing_info) const {
- // TODO(mmenke): Figure out what to do here.
+ QuicStreamId stream_id = closed_stream_id_;
+ if (stream_)
+ stream_id = stream_->id();
+ if (stream_id == kInvalidStreamId)
+ return false;
+ // First stream on a session starts at 5. Any id larger on 5 means session is
+ // reused. If session is reused, do not populate |connect_timing|.
+ // FIXME: any constant that I can use to avoid hardcoding 5?
Ryan Hamilton 2016/09/09 20:02:49 kHeadersStreamId + 2. But that being said, I thin
xunjieli 2016/09/09 21:26:59 Done. I added a static method to QuicChromiumClien
+ if (stream_id > 5) {
+ load_timing_info->socket_reused = true;
+ } else {
+ load_timing_info->connect_timing = connect_timing_;
+ load_timing_info->socket_reused = false;
+ }
return true;
}
@@ -641,6 +655,7 @@ int QuicHttpStream::DoStreamRequest() {
return was_handshake_confirmed_ ? ERR_CONNECTION_CLOSED
: ERR_QUIC_HANDSHAKE_FAILED;
}
+ connect_timing_ = session_->GetConnectTiming();
int rv = stream_request_.StartRequest(
session_, &stream_,
base::Bind(&QuicHttpStream::OnStreamReady, weak_factory_.GetWeakPtr()));
@@ -834,6 +849,7 @@ void QuicHttpStream::ResetStream() {
return;
closed_stream_received_bytes_ = stream_->stream_bytes_read();
closed_stream_sent_bytes_ = stream_->stream_bytes_written();
+ closed_stream_id_ = stream_->id();
stream_ = nullptr;
// If |request_body_stream_| is non-NULL, Reset it, to abort any in progress

Powered by Google App Engine
This is Rietveld 408576698