Index: net/quic/quic_headers_stream.cc |
diff --git a/net/quic/quic_headers_stream.cc b/net/quic/quic_headers_stream.cc |
index 786048d9a21b2a891024bb22608c99237e4583a1..6b3e23836108fe401514554dae071654f40b01ad 100644 |
--- a/net/quic/quic_headers_stream.cc |
+++ b/net/quic/quic_headers_stream.cc |
@@ -10,6 +10,7 @@ |
#include "net/quic/quic_bug_tracker.h" |
#include "net/quic/quic_flags.h" |
#include "net/quic/quic_headers_stream.h" |
+#include "net/quic/quic_header_list.h" |
#include "net/quic/quic_spdy_session.h" |
#include "net/quic/quic_time.h" |
@@ -75,13 +76,18 @@ class QuicHeadersStream::SpdyFramerVisitor |
} |
SpdyHeadersHandlerInterface* OnHeaderFrameStart( |
- SpdyStreamId stream_id) override { |
- LOG(FATAL); |
- return nullptr; |
+ SpdyStreamId /* stream_id */) override { |
+ return &header_list_; |
} |
- void OnHeaderFrameEnd(SpdyStreamId stream_id, bool end_headers) override { |
- LOG(FATAL); |
+ void OnHeaderFrameEnd(SpdyStreamId /* stream_id */, |
+ bool end_headers) override { |
+ if (end_headers) { |
+ if (stream_->IsConnected()) { |
+ stream_->OnHeaderList(header_list_); |
+ } |
+ header_list_.Clear(); |
+ } |
} |
void OnError(SpdyFramer* framer) override { |
@@ -184,6 +190,7 @@ class QuicHeadersStream::SpdyFramerVisitor |
private: |
QuicHeadersStream* stream_; |
+ QuicHeaderList header_list_; |
DISALLOW_COPY_AND_ASSIGN(SpdyFramerVisitor); |
}; |
@@ -356,6 +363,36 @@ void QuicHeadersStream::OnControlFrameHeaderData(SpdyStreamId stream_id, |
} |
} |
+void QuicHeadersStream::OnHeaderList(const QuicHeaderList& header_list) { |
+ if (measure_headers_hol_blocking_time_) { |
+ if (prev_max_timestamp_ > cur_max_timestamp_) { |
+ // prev_max_timestamp_ > cur_max_timestamp_ implies that |
+ // headers from lower numbered streams actually came off the |
+ // wire after headers for the current stream, hence there was |
+ // HOL blocking. |
+ QuicTime::Delta delta = prev_max_timestamp_.Subtract(cur_max_timestamp_); |
+ DVLOG(1) << "stream " << stream_id_ |
+ << ": Net.QuicSession.HeadersHOLBlockedTime " |
ramant (doing other things)
2016/04/11 18:11:57
nit: indentation for lines 375-376.
Zhongyi Shi
2016/04/11 18:27:31
it's already fixed in Final.
|
+ << delta.ToMilliseconds(); |
+ spdy_session_->OnHeadersHeadOfLineBlocking(delta); |
+ } |
+ prev_max_timestamp_ = std::max(prev_max_timestamp_, cur_max_timestamp_); |
+ cur_max_timestamp_ = QuicTime::Zero(); |
+ } |
+ if (promised_stream_id_ == kInvalidStreamId) { |
+ spdy_session_->OnStreamHeaderList(stream_id_, fin_, frame_len_, |
+ header_list); |
+ } else { |
+ spdy_session_->OnPromiseHeaderList(stream_id_, promised_stream_id_, |
+ frame_len_, header_list); |
+ } |
+ // Reset state for the next frame. |
+ promised_stream_id_ = kInvalidStreamId; |
+ stream_id_ = kInvalidStreamId; |
+ fin_ = false; |
+ frame_len_ = 0; |
+} |
+ |
void QuicHeadersStream::OnCompressedFrameSize(size_t frame_len) { |
frame_len_ += frame_len; |
} |