Add net log entries that summarize transmit and receive byte counts.

Tx/Rx summaries are integrated into the net log at the last point that bytes were transmitted or received.

Hopefully this will help resolve http://crbug.com/37729 by showing if we've received bytes over the network when we hit the "Waiting for cache" bug.

This change also modernizes the use of NetLog:
 - ClientSocket now has a net_log() accessor
 - ClientSocket::Connect no longer takes a NetLog, instead the TCPClientSocket constructor takes one, others use their transport socket's NetLog
 - TCPClientSocket creates a new source id with source type SOCKET

Also updates PassiveLogCollector infrastructure:
 - The LiveRequestsObserver lets a RequestTracker update a RequestInfo just before it is displayed.  This allows ConnectJobs to be associated with URLRequests while connecting and then reassociated if they are late-bound to a different request.

BUG=37729
TEST=tx/rx lines show up in chrome://net-internals/

Review URL: http://codereview.chromium.org/1696005

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@45449 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/net/socket/ssl_client_socket_nss.cc b/net/socket/ssl_client_socket_nss.cc
index 7fdc424..a033c797 100644
--- a/net/socket/ssl_client_socket_nss.cc
+++ b/net/socket/ssl_client_socket_nss.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
@@ -253,7 +253,8 @@
       completed_handshake_(false),
       next_handshake_state_(STATE_NONE),
       nss_fd_(NULL),
-      nss_bufs_(NULL) {
+      nss_bufs_(NULL),
+      net_log_(transport_socket->NetLog()) {
   EnterFunction("");
 }
 
@@ -281,8 +282,7 @@
   return OK;
 }
 
-int SSLClientSocketNSS::Connect(CompletionCallback* callback,
-                                const BoundNetLog& net_log) {
+int SSLClientSocketNSS::Connect(CompletionCallback* callback) {
   EnterFunction("");
   DCHECK(transport_.get());
   DCHECK(next_handshake_state_ == STATE_NONE);
@@ -292,17 +292,17 @@
   DCHECK(!user_read_buf_);
   DCHECK(!user_write_buf_);
 
-  net_log.BeginEvent(NetLog::TYPE_SSL_CONNECT);
+  net_log_.BeginEvent(NetLog::TYPE_SSL_CONNECT);
 
   int rv = Init();
   if (rv != OK) {
-    net_log.EndEvent(NetLog::TYPE_SSL_CONNECT);
+    net_log_.EndEvent(NetLog::TYPE_SSL_CONNECT);
     return rv;
   }
 
   rv = InitializeSSLOptions();
   if (rv != OK) {
-    net_log.EndEvent(NetLog::TYPE_SSL_CONNECT);
+    net_log_.EndEvent(NetLog::TYPE_SSL_CONNECT);
     return rv;
   }
 
@@ -310,9 +310,8 @@
   rv = DoHandshakeLoop(OK);
   if (rv == ERR_IO_PENDING) {
     user_connect_callback_ = callback;
-    net_log_ = net_log;
   } else {
-    net_log.EndEvent(NetLog::TYPE_SSL_CONNECT);
+    net_log_.EndEvent(NetLog::TYPE_SSL_CONNECT);
   }
 
   LeaveFunction("");
@@ -819,7 +818,6 @@
   int rv = DoHandshakeLoop(result);
   if (rv != ERR_IO_PENDING) {
     net_log_.EndEvent(net::NetLog::TYPE_SSL_CONNECT);
-    net_log_ = BoundNetLog();
     DoConnectCallback(rv);
   }
   LeaveFunction("");