summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authormbelshe@chromium.org <mbelshe@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-30 05:23:06 +0000
committermbelshe@chromium.org <mbelshe@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-30 05:23:06 +0000
commit6cd3bd20cd448bc1bca33748395bf4381dfb7fc6 (patch)
tree1f51c74ac1b2f56e29110ff6bf683fbfeb6d5441 /net
parent23114b4023e75494403e7c991e5707590a77ee7f (diff)
downloadchromium_src-6cd3bd20cd448bc1bca33748395bf4381dfb7fc6.zip
chromium_src-6cd3bd20cd448bc1bca33748395bf4381dfb7fc6.tar.gz
chromium_src-6cd3bd20cd448bc1bca33748395bf4381dfb7fc6.tar.bz2
Add logging to the spdy session pool.
BUG=none TEST=none Review URL: http://codereview.chromium.org/3280003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@57833 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r--net/base/net_log_event_type_list.h32
-rw-r--r--net/spdy/spdy_session.cc18
-rw-r--r--net/spdy/spdy_session.h2
-rw-r--r--net/spdy/spdy_session_pool.cc18
4 files changed, 66 insertions, 4 deletions
diff --git a/net/base/net_log_event_type_list.h b/net/base/net_log_event_type_list.h
index 5c495f0..459b3fb 100644
--- a/net/base/net_log_event_type_list.h
+++ b/net/base/net_log_event_type_list.h
@@ -524,6 +524,10 @@ EVENT_TYPE(HTTP_TRANSACTION_DRAIN_BODY_FOR_AUTH_RESTART)
// ------------------------------------------------------------------------
// The start/end of a SpdySession.
+// {
+// "host": <The host-port string>,
+// "proxy": <The Proxy PAC string>,
+// }
EVENT_TYPE(SPDY_SESSION)
// On sending a SPDY SETTINGS frame.
@@ -558,6 +562,34 @@ EVENT_TYPE(SPDY_SESSION_GOAWAY)
EVENT_TYPE(SPDY_SESSION_PUSHED_SYN_STREAM)
// ------------------------------------------------------------------------
+// SpdySessionPool
+// ------------------------------------------------------------------------
+
+// This event indicates the pool is reusing an existing session
+// {
+// "id": <The session id>,
+// }
+EVENT_TYPE(SPDY_SESSION_POOL_FOUND_EXISTING_SESSION)
+
+// This event indicates the pool created a new session
+// {
+// "id": <The session id>,
+// }
+EVENT_TYPE(SPDY_SESSION_POOL_CREATED_NEW_SESSION)
+
+// This event indicates that a SSL socket has been upgraded to a SPDY session.
+// {
+// "id": <The session id>,
+// }
+EVENT_TYPE(SPDY_SESSION_POOL_IMPORTED_SESSION_FROM_SOCKET)
+
+// This event indicates that the session has been removed.
+// {
+// "id": <The session id>,
+// }
+EVENT_TYPE(SPDY_SESSION_POOL_REMOVE_SESSION)
+
+// ------------------------------------------------------------------------
// SpdyStream
// ------------------------------------------------------------------------
diff --git a/net/spdy/spdy_session.cc b/net/spdy/spdy_session.cc
index 50a0a21..7402e5d 100644
--- a/net/spdy/spdy_session.cc
+++ b/net/spdy/spdy_session.cc
@@ -74,6 +74,21 @@ void AdjustSocketBufferSizes(ClientSocket* socket) {
socket->SetSendBufferSize(kSocketBufferSize);
}
+class NetLogSpdySessionParameter : public NetLog::EventParameters {
+ public:
+ explicit NetLogSpdySessionParameter(const HostPortProxyPair& host_pair)
+ : host_pair_(host_pair) {}
+ virtual Value* ToValue() const {
+ DictionaryValue* dict = new DictionaryValue();
+ dict->Set("host", new StringValue(host_pair_.first.ToString()));
+ dict->Set("proxy", new StringValue(host_pair_.second.ToPacString()));
+ return dict;
+ }
+ private:
+ const HostPortProxyPair host_pair_;
+ DISALLOW_COPY_AND_ASSIGN(NetLogSpdySessionParameter);
+};
+
class NetLogSpdySynParameter : public NetLog::EventParameters {
public:
NetLogSpdySynParameter(const linked_ptr<spdy::SpdyHeaderBlock>& headers,
@@ -176,8 +191,7 @@ SpdySession::SpdySession(const HostPortProxyPair& host_port_proxy_pair,
net_log_(BoundNetLog::Make(net_log, NetLog::SOURCE_SPDY_SESSION)) {
net_log_.BeginEvent(
NetLog::TYPE_SPDY_SESSION,
- new NetLogStringParameter("host_port",
- host_port_proxy_pair_.first.ToString()));
+ new NetLogSpdySessionParameter(host_port_proxy_pair_));
// TODO(mbelshe): consider randomization of the stream_hi_water_mark.
diff --git a/net/spdy/spdy_session.h b/net/spdy/spdy_session.h
index d200e6c..76f105c 100644
--- a/net/spdy/spdy_session.h
+++ b/net/spdy/spdy_session.h
@@ -174,6 +174,8 @@ class SpdySession : public base::RefCounted<SpdySession>,
return unclaimed_pushed_streams_.size();
}
+ const BoundNetLog& net_log() const { return net_log_; }
+
private:
friend class base::RefCounted<SpdySession>;
FRIEND_TEST_ALL_PREFIXES(SpdySessionTest, GetActivePushStream);
diff --git a/net/spdy/spdy_session_pool.cc b/net/spdy/spdy_session_pool.cc
index 4eb70e6..01ad56d 100644
--- a/net/spdy/spdy_session_pool.cc
+++ b/net/spdy/spdy_session_pool.cc
@@ -33,16 +33,23 @@ scoped_refptr<SpdySession> SpdySessionPool::Get(
if (list->size() >= static_cast<unsigned int>(g_max_sessions_per_domain)) {
spdy_session = list->front();
list->pop_front();
+ net_log.AddEvent(NetLog::TYPE_SPDY_SESSION_POOL_FOUND_EXISTING_SESSION,
+ new NetLogSourceParameter("session",
+ spdy_session->net_log().source()));
}
} else {
list = AddSessionList(host_port_proxy_pair);
}
DCHECK(list);
- if (!spdy_session)
+ if (!spdy_session) {
spdy_session = new SpdySession(host_port_proxy_pair,
session,
net_log.net_log());
+ net_log.AddEvent(NetLog::TYPE_SPDY_SESSION_POOL_CREATED_NEW_SESSION,
+ new NetLogSourceParameter("session",
+ spdy_session->net_log().source()));
+ }
DCHECK(spdy_session);
list->push_back(spdy_session);
@@ -67,9 +74,13 @@ net::Error SpdySessionPool::GetSpdySessionFromSocket(
DCHECK(list->empty());
list->push_back(*spdy_session);
+ net_log.AddEvent(NetLog::TYPE_SPDY_SESSION_POOL_IMPORTED_SESSION_FROM_SOCKET,
+ new NetLogSourceParameter("session",
+ (*spdy_session)->net_log().source()));
+
// Now we can initialize the session with the SSL socket.
return (*spdy_session)->InitializeWithSocket(connection, is_secure,
- certificate_error_code);
+ certificate_error_code);
}
bool SpdySessionPool::HasSession(
@@ -85,6 +96,9 @@ void SpdySessionPool::Remove(const scoped_refptr<SpdySession>& session) {
if (!list)
return;
list->remove(session);
+ session->net_log().AddEvent(NetLog::TYPE_SPDY_SESSION_POOL_REMOVE_SESSION,
+ new NetLogSourceParameter("session",
+ session->net_log().source()));
if (list->empty())
RemoveSessionList(session->host_port_proxy_pair());
}