diff options
author | jar@chromium.org <jar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-06 07:10:24 +0000 |
---|---|---|
committer | jar@chromium.org <jar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-06 07:10:24 +0000 |
commit | 9008c86f2a99b112300ef7833d35f2ff1696a88a (patch) | |
tree | 9ba3e6a50b61f76612f3db42b18e5f10ae6f364a /net/socket/client_socket.h | |
parent | 6a054ffaae82f5ac8d6b876d7c85f0d87d892e42 (diff) | |
download | chromium_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.h')
-rw-r--r-- | net/socket/client_socket.h | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/net/socket/client_socket.h b/net/socket/client_socket.h index 29d297e..44ee085 100644 --- a/net/socket/client_socket.h +++ b/net/socket/client_socket.h @@ -15,6 +15,26 @@ class BoundNetLog; class ClientSocket : public Socket { public: + ClientSocket(); + + // Destructor emits statistics for this socket's lifetime. + virtual ~ClientSocket(); + + // Set the annotation to indicate this socket was created for speculative + // reasons. Note that if the socket was used before calling this method, then + // the call will be ignored (no annotation will be added). + void SetSubresourceSpeculation(); + void SetOmniboxSpeculation(); + + // Establish values of was_ever_connected_ and was_used_to_transmit_data_. + // The argument indicates if the socket's state, as reported by a + // ClientSocketHandle::is_reused(), should show that the socket has already + // been used to transmit data. + // This is typically called when a transaction finishes, and + // ClientSocketHandle is being destroyed. Calling at that point it allows us + // to aggregates the impact of that connect job into this instance. + void UpdateConnectivityState(bool is_reused); + // Called to establish a connection. Returns OK if the connection could be // established synchronously. Otherwise, ERR_IO_PENDING is returned and the // given callback will run asynchronously when the connection is established @@ -54,6 +74,24 @@ class ClientSocket : public Socket { // Gets the NetLog for this socket. virtual const BoundNetLog& NetLog() const = 0; + + private: + // Publish histogram to help evaluate preconnection utilization. + void EmitPreconnectionHistograms() const; + + // Indicate if any ClientSocketHandle that used this socket was connected as + // would be indicated by the IsConnected() method. This variable set by a + // ClientSocketHandle before releasing this ClientSocket. + bool was_ever_connected_; + + // Indicate if this socket was first created for speculative use, and identify + // the motivation. + bool omnibox_speculation_; + bool subresource_speculation_; + + // Indicate if this socket was ever used. This state is set by a + // ClientSocketHandle before releasing this ClientSocket. + bool was_used_to_transmit_data_; }; } // namespace net |