summaryrefslogtreecommitdiffstats
path: root/net/socket/client_socket_handle.h
diff options
context:
space:
mode:
authorjar@chromium.org <jar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-06 07:10:24 +0000
committerjar@chromium.org <jar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-06 07:10:24 +0000
commit9008c86f2a99b112300ef7833d35f2ff1696a88a (patch)
tree9ba3e6a50b61f76612f3db42b18e5f10ae6f364a /net/socket/client_socket_handle.h
parent6a054ffaae82f5ac8d6b876d7c85f0d87d892e42 (diff)
downloadchromium_src-9008c86f2a99b112300ef7833d35f2ff1696a88a.zip
chromium_src-9008c86f2a99b112300ef7833d35f2ff1696a88a.tar.gz
chromium_src-9008c86f2a99b112300ef7833d35f2ff1696a88a.tar.bz2
Reland 54771 (and 54795) To enable TCP Preconnection by default
I pulled out the code to update the socket connectivity stats. I added defensive code which should preclude the crash that was reported on the stability bot. I added a second call to update the stats from ~ClientSocketHandle to ensure that we updated the related ClientSocket when we are torn down. As noted in the original checkin: Enable speculative preconnection by default Added histogram to track preconnection utilization (vs waste). BUG=42694 r=mbelshe Review URL: http://codereview.chromium.org/3050040 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@55197 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/socket/client_socket_handle.h')
-rw-r--r--net/socket/client_socket_handle.h14
1 files changed, 13 insertions, 1 deletions
diff --git a/net/socket/client_socket_handle.h b/net/socket/client_socket_handle.h
index adccc89..a3de0d6 100644
--- a/net/socket/client_socket_handle.h
+++ b/net/socket/client_socket_handle.h
@@ -132,7 +132,10 @@ class ClientSocketHandle {
const std::string& group_name() const { return group_name_; }
int id() const { return pool_id_; }
ClientSocket* socket() { return socket_.get(); }
- ClientSocket* release_socket() { return socket_.release(); }
+ ClientSocket* release_socket() {
+ UpdateConnectivityStateForSocket();
+ return socket_.release();
+ }
bool is_reused() const { return is_reused_; }
base::TimeDelta idle_time() const { return idle_time_; }
SocketReuseType reuse_type() const {
@@ -174,6 +177,15 @@ class ClientSocketHandle {
// Resets the supplemental error state.
void ResetErrorState();
+ // Update the base class to record things like whether we've ever transmitted
+ // data, and whether the connection was able to be established. We use this
+ // data to construct histograms indicating whether a speculative connection
+ // was ever used, etc., when the ClientSocket is eventually discarded.
+ void UpdateConnectivityStateForSocket() const {
+ if (socket_.get())
+ socket_->UpdateConnectivityState(is_reused());
+ }
+
bool is_initialized_;
scoped_refptr<ClientSocketPool> pool_;
scoped_ptr<ClientSocket> socket_;