Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(432)

Unified Diff: net/socket/client_socket.h

Issue 3050040: Reland 54771 (and 54795) To enable TCP Preconnection by default... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/net.gyp ('k') | net/socket/client_socket.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/socket/client_socket.h
===================================================================
--- net/socket/client_socket.h (revision 55108)
+++ net/socket/client_socket.h (working copy)
@@ -15,6 +15,26 @@
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 @@
// 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
« no previous file with comments | « net/net.gyp ('k') | net/socket/client_socket.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698