diff options
author | akalin@chromium.org <akalin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-10-17 00:03:22 +0000 |
---|---|---|
committer | akalin@chromium.org <akalin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-10-17 00:03:22 +0000 |
commit | 03edc773bfe6c8545b2891762a80a66e71f424a8 (patch) | |
tree | 84f8a9cfc0f7a1920db6b45f11732c578ae03986 /net/spdy | |
parent | 6a6db0a585e2908711cc87e69228ee0908627fdf (diff) | |
download | chromium_src-03edc773bfe6c8545b2891762a80a66e71f424a8.zip chromium_src-03edc773bfe6c8545b2891762a80a66e71f424a8.tar.gz chromium_src-03edc773bfe6c8545b2891762a80a66e71f424a8.tar.bz2 |
[SPDY] Log SPDY priority for SYN_STREAMs
Also use different logging functions for SYN_REPLY and HEADER
frames.
BUG=307757
R=rch@chromium.org
Review URL: https://codereview.chromium.org/27425002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@229005 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/spdy')
-rw-r--r-- | net/spdy/spdy_session.cc | 91 |
1 files changed, 62 insertions, 29 deletions
diff --git a/net/spdy/spdy_session.cc b/net/spdy/spdy_session.cc index f9e4581..a0e0f7e 100644 --- a/net/spdy/spdy_session.cc +++ b/net/spdy/spdy_session.cc @@ -54,27 +54,60 @@ const SpdyStreamId kFirstStreamId = 1; // Minimum seconds that unclaimed pushed streams will be kept in memory. const int kMinPushedStreamLifetimeSeconds = 300; -base::Value* NetLogSpdySynCallback(const SpdyHeaderBlock* headers, - bool fin, - bool unidirectional, - SpdyStreamId stream_id, - SpdyStreamId associated_stream, - NetLog::LogLevel /* log_level */) { +scoped_ptr<base::ListValue> SpdyHeaderBlockToListValue( + const SpdyHeaderBlock& headers) { + scoped_ptr<base::ListValue> headers_list(new base::ListValue()); + for (SpdyHeaderBlock::const_iterator it = headers.begin(); + it != headers.end(); ++it) { + headers_list->AppendString( + it->first + ": " + + (ShouldShowHttpHeaderValue(it->first) ? it->second : "[elided]")); + } + return headers_list.Pass(); +} + +base::Value* NetLogSpdySynStreamSentCallback(const SpdyHeaderBlock* headers, + bool fin, + bool unidirectional, + SpdyPriority spdy_priority, + SpdyStreamId stream_id, + NetLog::LogLevel /* log_level */) { base::DictionaryValue* dict = new base::DictionaryValue(); - base::ListValue* headers_list = new base::ListValue(); - for (SpdyHeaderBlock::const_iterator it = headers->begin(); - it != headers->end(); ++it) { - headers_list->Append(new base::StringValue(base::StringPrintf( - "%s: %s", it->first.c_str(), - (ShouldShowHttpHeaderValue( - it->first) ? it->second : "[elided]").c_str()))); - } + dict->Set("headers", SpdyHeaderBlockToListValue(*headers).release()); + dict->SetBoolean("fin", fin); + dict->SetBoolean("unidirectional", unidirectional); + dict->SetInteger("spdy_priority", static_cast<int>(spdy_priority)); + dict->SetInteger("stream_id", stream_id); + return dict; +} + +base::Value* NetLogSpdySynStreamReceivedCallback( + const SpdyHeaderBlock* headers, + bool fin, + bool unidirectional, + SpdyPriority spdy_priority, + SpdyStreamId stream_id, + SpdyStreamId associated_stream, + NetLog::LogLevel /* log_level */) { + base::DictionaryValue* dict = new base::DictionaryValue(); + dict->Set("headers", SpdyHeaderBlockToListValue(*headers).release()); dict->SetBoolean("fin", fin); dict->SetBoolean("unidirectional", unidirectional); - dict->Set("headers", headers_list); + dict->SetInteger("spdy_priority", static_cast<int>(spdy_priority)); + dict->SetInteger("stream_id", stream_id); + dict->SetInteger("associated_stream", associated_stream); + return dict; +} + +base::Value* NetLogSpdySynReplyOrHeadersReceivedCallback( + const SpdyHeaderBlock* headers, + bool fin, + SpdyStreamId stream_id, + NetLog::LogLevel /* log_level */) { + base::DictionaryValue* dict = new base::DictionaryValue(); + dict->Set("headers", SpdyHeaderBlockToListValue(*headers).release()); + dict->SetBoolean("fin", fin); dict->SetInteger("stream_id", stream_id); - if (associated_stream) - dict->SetInteger("associated_stream", associated_stream); return dict; } @@ -797,10 +830,11 @@ scoped_ptr<SpdyFrame> SpdySession::CreateSynStream( SendPrefacePingIfNoneInFlight(); DCHECK(buffered_spdy_framer_.get()); + SpdyPriority spdy_priority = + ConvertRequestPriorityToSpdyPriority(priority, GetProtocolVersion()); scoped_ptr<SpdyFrame> syn_frame( buffered_spdy_framer_->CreateSynStream( - stream_id, 0, - ConvertRequestPriorityToSpdyPriority(priority, GetProtocolVersion()), + stream_id, 0, spdy_priority, credential_slot, flags, enable_compression_, &headers)); base::StatsCounter spdy_requests("spdy.requests"); @@ -810,10 +844,11 @@ scoped_ptr<SpdyFrame> SpdySession::CreateSynStream( if (net_log().IsLoggingAllEvents()) { net_log().AddEvent( NetLog::TYPE_SPDY_SESSION_SYN_STREAM, - base::Bind(&NetLogSpdySynCallback, &headers, + base::Bind(&NetLogSpdySynStreamSentCallback, &headers, (flags & CONTROL_FLAG_FIN) != 0, (flags & CONTROL_FLAG_UNIDIRECTIONAL) != 0, - stream_id, 0)); + spdy_priority, + stream_id)); } return syn_frame.Pass(); @@ -1982,8 +2017,8 @@ void SpdySession::OnSynStream(SpdyStreamId stream_id, if (net_log_.IsLoggingAllEvents()) { net_log_.AddEvent( NetLog::TYPE_SPDY_SESSION_PUSHED_SYN_STREAM, - base::Bind(&NetLogSpdySynCallback, - &headers, fin, unidirectional, + base::Bind(&NetLogSpdySynStreamReceivedCallback, + &headers, fin, unidirectional, priority, stream_id, associated_stream_id)); } @@ -2162,9 +2197,8 @@ void SpdySession::OnSynReply(SpdyStreamId stream_id, if (net_log().IsLoggingAllEvents()) { net_log().AddEvent( NetLog::TYPE_SPDY_SESSION_SYN_REPLY, - base::Bind(&NetLogSpdySynCallback, - &headers, fin, false, // not unidirectional - stream_id, 0)); + base::Bind(&NetLogSpdySynReplyOrHeadersReceivedCallback, + &headers, fin, stream_id)); } ActiveStreamMap::iterator it = active_streams_.find(stream_id); @@ -2200,9 +2234,8 @@ void SpdySession::OnHeaders(SpdyStreamId stream_id, if (net_log().IsLoggingAllEvents()) { net_log().AddEvent( NetLog::TYPE_SPDY_SESSION_RECV_HEADERS, - base::Bind(&NetLogSpdySynCallback, - &headers, fin, /*unidirectional=*/false, - stream_id, 0)); + base::Bind(&NetLogSpdySynReplyOrHeadersReceivedCallback, + &headers, fin, stream_id)); } ActiveStreamMap::iterator it = active_streams_.find(stream_id); |