| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "net/socket/client_socket.h" | 5 #include "net/socket/client_socket.h" |
| 6 | 6 |
| 7 #include "base/histogram.h" | 7 #include "base/histogram.h" |
| 8 | 8 |
| 9 namespace net { | 9 namespace net { |
| 10 | 10 |
| 11 ClientSocket::ClientSocket() | 11 ClientSocket::ClientSocket() |
| 12 : omnibox_speculation_(false), | 12 : was_ever_connected_(false), |
| 13 omnibox_speculation_(false), |
| 13 subresource_speculation_(false), | 14 subresource_speculation_(false), |
| 14 was_used_to_transmit_data_(false) {} | 15 was_used_to_transmit_data_(false) {} |
| 15 | 16 |
| 16 ClientSocket::~ClientSocket() { | 17 ClientSocket::~ClientSocket() { |
| 17 EmitPreconnectionHistograms(); | 18 EmitPreconnectionHistograms(); |
| 18 } | 19 } |
| 19 | 20 |
| 20 void ClientSocket::EmitPreconnectionHistograms() const { | 21 void ClientSocket::EmitPreconnectionHistograms() const { |
| 21 DCHECK(!subresource_speculation_ || !omnibox_speculation_); | 22 DCHECK(!subresource_speculation_ || !omnibox_speculation_); |
| 22 // 0 ==> non-speculative, never connected. | 23 // 0 ==> non-speculative, never connected. |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 // Record if this connection has every actually connected successfully. | 60 // Record if this connection has every actually connected successfully. |
| 60 // Note that IsConnected() won't be defined at destruction time, so we need | 61 // Note that IsConnected() won't be defined at destruction time, so we need |
| 61 // to record this data now, while the derived class is present. | 62 // to record this data now, while the derived class is present. |
| 62 was_ever_connected_ |= IsConnected(); | 63 was_ever_connected_ |= IsConnected(); |
| 63 // A socket is_reused only after it has transmitted some data. | 64 // A socket is_reused only after it has transmitted some data. |
| 64 was_used_to_transmit_data_ |= is_reused; | 65 was_used_to_transmit_data_ |= is_reused; |
| 65 } | 66 } |
| 66 | 67 |
| 67 } // namespace net | 68 } // namespace net |
| 68 | 69 |
| OLD | NEW |