From 616925a61dcb63847f31809a1061d85fac9b57e6 Mon Sep 17 00:00:00 2001
From: "vandebo@chromium.org"
 <vandebo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>
Date: Tue, 2 Mar 2010 19:02:38 +0000
Subject: Remove connection failed histograms.

BUG=none - not used and blocks refactoring for bug 30357
TEST=unit tests

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@40397 0039d316-1c4b-4281-b951-d872f2087c98
---
 net/base/connection_type_histograms.cc | 10 +++-------
 net/base/connection_type_histograms.h  |  3 +--
 net/http/http_network_transaction.cc   |  8 +++-----
 net/socket/client_socket_pool_base.cc  |  4 ++--
 net/socket/ssl_client_socket_win.cc    | 17 +++++++++--------
 net/socket/ssl_client_socket_win.h     |  2 +-
 net/socket/tcp_client_socket_win.cc    |  6 ++++--
 net/spdy/spdy_session.cc               |  4 ++--
 8 files changed, 25 insertions(+), 29 deletions(-)

(limited to 'net')

diff --git a/net/base/connection_type_histograms.cc b/net/base/connection_type_histograms.cc
index 7326a92..988e96e 100644
--- a/net/base/connection_type_histograms.cc
+++ b/net/base/connection_type_histograms.cc
@@ -20,7 +20,7 @@ namespace net {
 //
 // Each histogram has an unused bucket at the end to allow seamless future
 // expansion.
-void UpdateConnectionTypeHistograms(ConnectionType type, bool success) {
+void UpdateConnectionTypeHistograms(ConnectionType type) {
   static bool had_connection_type[NUM_OF_CONNECTION_TYPES];
 
   if (type >= 0 && type < NUM_OF_CONNECTION_TYPES) {
@@ -30,12 +30,8 @@ void UpdateConnectionTypeHistograms(ConnectionType type, bool success) {
           type, NUM_OF_CONNECTION_TYPES);
     }
 
-    if (success)
-      UMA_HISTOGRAM_ENUMERATION("Net.ConnectionTypeCount2",
-          type, NUM_OF_CONNECTION_TYPES);
-    else
-      UMA_HISTOGRAM_ENUMERATION("Net.ConnectionTypeFailCount2",
-          type, NUM_OF_CONNECTION_TYPES);
+    UMA_HISTOGRAM_ENUMERATION("Net.ConnectionTypeCount2",
+        type, NUM_OF_CONNECTION_TYPES);
   } else {
     NOTREACHED();  // Someone's logging an invalid type!
   }
diff --git a/net/base/connection_type_histograms.h b/net/base/connection_type_histograms.h
index c8517ff..582f09d 100644
--- a/net/base/connection_type_histograms.h
+++ b/net/base/connection_type_histograms.h
@@ -33,8 +33,7 @@ enum ConnectionType {
 };
 
 // Update the connection type histograms.  |type| is the connection type.
-// |success| is whether or not the connection was successful or not.
-void UpdateConnectionTypeHistograms(ConnectionType type, bool success);
+void UpdateConnectionTypeHistograms(ConnectionType type);
 
 }  // namespace net
 
diff --git a/net/http/http_network_transaction.cc b/net/http/http_network_transaction.cc
index 1c979bf..091edd0 100644
--- a/net/http/http_network_transaction.cc
+++ b/net/http/http_network_transaction.cc
@@ -687,10 +687,8 @@ int HttpNetworkTransaction::DoInitConnection() {
 }
 
 int HttpNetworkTransaction::DoInitConnectionComplete(int result) {
-  if (result < 0) {
-    UpdateConnectionTypeHistograms(CONNECTION_HTTP, false);
+  if (result < 0)
     return ReconsiderProxyAfterError(result);
-  }
 
   DCHECK_EQ(OK, result);
 
@@ -711,7 +709,7 @@ int HttpNetworkTransaction::DoInitConnectionComplete(int result) {
   } else {
     // Now we have a TCP connected socket.  Perform other connection setup as
     // needed.
-    UpdateConnectionTypeHistograms(CONNECTION_HTTP, true);
+    UpdateConnectionTypeHistograms(CONNECTION_HTTP);
     if (proxy_mode_ == kSOCKSProxy)
       next_state_ = STATE_SOCKS_CONNECT;
     else if (using_ssl_ && proxy_mode_ == kDirectConnection) {
@@ -819,7 +817,7 @@ int HttpNetworkTransaction::DoSSLConnectComplete(int result) {
           base::TimeDelta::FromMinutes(10),
           100);
 
-      UpdateConnectionTypeHistograms(CONNECTION_SPDY, true);
+      UpdateConnectionTypeHistograms(CONNECTION_SPDY);
       next_state_ = STATE_SPDY_SEND_REQUEST;
     } else {
       UMA_HISTOGRAM_CUSTOM_TIMES("Net.SSL_Connection_Latency",
diff --git a/net/socket/client_socket_pool_base.cc b/net/socket/client_socket_pool_base.cc
index ed188fd..c6d9493 100644
--- a/net/socket/client_socket_pool_base.cc
+++ b/net/socket/client_socket_pool_base.cc
@@ -426,14 +426,14 @@ void ClientSocketPoolBaseHelper::DoReleaseSocket(const std::string& group_name,
     // We can't activate more sockets since we're already at our global limit.
     if (ReachedMaxSocketsLimit())
       return;
-    
+
     // |group| might now be deleted.
     i = group_map_.find(group_name);
     if (i == group_map_.end())
       return;
 
     group = i->second;
-    
+
     // If we already have enough ConnectJobs to satisfy the pending requests,
     // don't bother starting up more.
     if (group.pending_requests.size() <= group.jobs.size())
diff --git a/net/socket/ssl_client_socket_win.cc b/net/socket/ssl_client_socket_win.cc
index 5d464b5..ab3bca8 100644
--- a/net/socket/ssl_client_socket_win.cc
+++ b/net/socket/ssl_client_socket_win.cc
@@ -985,7 +985,8 @@ int SSLClientSocketWin::DoVerifyCertComplete(int result) {
       ssl_config_.IsAllowedBadCert(server_cert_))
     result = OK;
 
-  LogConnectionTypeMetrics(result >= 0);
+  if (result == OK)
+    LogConnectionTypeMetrics();
   if (renegotiating_) {
     DidCompleteRenegotiation();
     return result;
@@ -1325,18 +1326,18 @@ void SSLClientSocketWin::DidCompleteRenegotiation() {
   next_state_ = STATE_COMPLETED_RENEGOTIATION;
 }
 
-void SSLClientSocketWin::LogConnectionTypeMetrics(bool success) const {
-  UpdateConnectionTypeHistograms(CONNECTION_SSL, success);
+void SSLClientSocketWin::LogConnectionTypeMetrics() const {
+  UpdateConnectionTypeHistograms(CONNECTION_SSL);
   if (server_cert_verify_result_.has_md5)
-    UpdateConnectionTypeHistograms(CONNECTION_SSL_MD5, success);
+    UpdateConnectionTypeHistograms(CONNECTION_SSL_MD5);
   if (server_cert_verify_result_.has_md2)
-    UpdateConnectionTypeHistograms(CONNECTION_SSL_MD2, success);
+    UpdateConnectionTypeHistograms(CONNECTION_SSL_MD2);
   if (server_cert_verify_result_.has_md4)
-    UpdateConnectionTypeHistograms(CONNECTION_SSL_MD4, success);
+    UpdateConnectionTypeHistograms(CONNECTION_SSL_MD4);
   if (server_cert_verify_result_.has_md5_ca)
-    UpdateConnectionTypeHistograms(CONNECTION_SSL_MD5_CA, success);
+    UpdateConnectionTypeHistograms(CONNECTION_SSL_MD5_CA);
   if (server_cert_verify_result_.has_md2_ca)
-    UpdateConnectionTypeHistograms(CONNECTION_SSL_MD2_CA, success);
+    UpdateConnectionTypeHistograms(CONNECTION_SSL_MD2_CA);
 }
 
 void SSLClientSocketWin::FreeSendBuffer() {
diff --git a/net/socket/ssl_client_socket_win.h b/net/socket/ssl_client_socket_win.h
index 1321c00..84a42de 100644
--- a/net/socket/ssl_client_socket_win.h
+++ b/net/socket/ssl_client_socket_win.h
@@ -86,7 +86,7 @@ class SSLClientSocketWin : public SSLClientSocket {
   int DidCallInitializeSecurityContext();
   int DidCompleteHandshake();
   void DidCompleteRenegotiation();
-  void LogConnectionTypeMetrics(bool success) const;
+  void LogConnectionTypeMetrics() const;
   void FreeSendBuffer();
 
   // Internal callbacks as async operations complete.
diff --git a/net/socket/tcp_client_socket_win.cc b/net/socket/tcp_client_socket_win.cc
index 1f13d9f..1ec8b28 100644
--- a/net/socket/tcp_client_socket_win.cc
+++ b/net/socket/tcp_client_socket_win.cc
@@ -314,7 +314,8 @@ int TCPClientSocketWin::Connect(CompletionCallback* callback,
   } else {
     TRACE_EVENT_END("socket.connect", this, "");
     LoadLog::EndEvent(load_log, LoadLog::TYPE_TCP_CONNECT);
-    UpdateConnectionTypeHistograms(CONNECTION_ANY, rv >= 0);
+    if (rv == OK)
+      UpdateConnectionTypeHistograms(CONNECTION_ANY);
   }
 
   return rv;
@@ -677,7 +678,8 @@ void TCPClientSocketWin::DidCompleteConnect() {
   }
 
   if (result != ERR_IO_PENDING) {
-    UpdateConnectionTypeHistograms(CONNECTION_ANY, result >= 0);
+    if (result == OK)
+      UpdateConnectionTypeHistograms(CONNECTION_ANY);
     DoReadCallback(result);
   }
 }
diff --git a/net/spdy/spdy_session.cc b/net/spdy/spdy_session.cc
index e0eb9c5..b7887a4 100644
--- a/net/spdy/spdy_session.cc
+++ b/net/spdy/spdy_session.cc
@@ -455,12 +455,12 @@ void SpdySession::OnTCPConnect(int result) {
   // socket (or have an error trying to do so).
   DCHECK(!connection_->socket() || !connection_->is_reused());
 
-  UpdateConnectionTypeHistograms(CONNECTION_SPDY, result >= 0);
-
   if (result != net::OK) {
     DCHECK_LT(result, 0);
     CloseSessionOnError(static_cast<net::Error>(result));
     return;
+  } else {
+    UpdateConnectionTypeHistograms(CONNECTION_SPDY);
   }
 
   AdjustSocketBufferSizes(connection_->socket());
-- 
cgit v1.1