From 6cd3bd20cd448bc1bca33748395bf4381dfb7fc6 Mon Sep 17 00:00:00 2001
From: "mbelshe@chromium.org"
 <mbelshe@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>
Date: Mon, 30 Aug 2010 05:23:06 +0000
Subject: 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
---
 net/spdy/spdy_session.cc | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

(limited to 'net/spdy/spdy_session.cc')

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.
 
-- 
cgit v1.1