Chromium Code Reviews| Index: net/socket/tcp_socket_posix.h |
| diff --git a/net/socket/tcp_socket_posix.h b/net/socket/tcp_socket_posix.h |
| index 98849e45a1918d1e34e1cbc550d18621e4f22d47..f95f9af1aab81e6948113e8da5a05d11f3984586 100644 |
| --- a/net/socket/tcp_socket_posix.h |
| +++ b/net/socket/tcp_socket_posix.h |
| @@ -15,8 +15,13 @@ |
| #include "net/base/address_family.h" |
| #include "net/base/completion_callback.h" |
| #include "net/base/net_export.h" |
| +#include "net/base/socket_performance_watcher.h" |
| #include "net/log/net_log.h" |
| +namespace base { |
| +class TickClock; |
| +} |
| + |
| namespace net { |
| class AddressList; |
| @@ -26,7 +31,12 @@ class SocketPosix; |
| class NET_EXPORT TCPSocketPosix { |
| public: |
| - TCPSocketPosix(NetLog* net_log, const NetLog::Source& source); |
| + // |socket_performance_watcher| is notified of the performance metrics related |
| + // to this socket. |socket_performance_watcher| may be null. |
| + TCPSocketPosix( |
| + scoped_ptr<SocketPerformanceWatcher> socket_performance_watcher, |
| + NetLog* net_log, |
| + const NetLog::Source& source); |
| virtual ~TCPSocketPosix(); |
| int Open(AddressFamily family); |
| @@ -95,6 +105,8 @@ class NET_EXPORT TCPSocketPosix { |
| void StartLoggingMultipleConnectAttempts(const AddressList& addresses); |
| void EndLoggingMultipleConnectAttempts(int net_error); |
| + void SetTickClockForTesting(scoped_ptr<base::TickClock> tick_clock); |
| + |
| const BoundNetLog& net_log() const { return net_log_; } |
| private: |
| @@ -177,8 +189,8 @@ class NET_EXPORT TCPSocketPosix { |
| int BuildTcpSocketPosix(scoped_ptr<TCPSocketPosix>* tcp_socket, |
| IPEndPoint* address); |
| - void ConnectCompleted(const CompletionCallback& callback, int rv) const; |
| - int HandleConnectCompleted(int rv) const; |
| + void ConnectCompleted(const CompletionCallback& callback, int rv); |
| + int HandleConnectCompleted(int rv); |
| void LogConnectBegin(const AddressList& addresses) const; |
| void LogConnectEnd(int net_error) const; |
| @@ -195,12 +207,30 @@ class NET_EXPORT TCPSocketPosix { |
| int buf_len, |
| const CompletionCallback& callback); |
| + // Notifies |socket_performance_watcher_| of the latest RTT estimate available |
| + // from the tcp_info struct for this TCP socket. |
| + void NotifySocketPerformanceWatcher(); |
| + |
| // Called after the first read completes on a TCP FastOpen socket. |
| void UpdateTCPFastOpenStatusAfterRead(); |
| + // Minimum interval betweeen consecutive notifications to |
| + // |socket_performance_watcher_|. |
| + const base::TimeDelta rtt_notifications_minimum_interval_; |
|
Ryan Sleevi
2016/04/11 22:06:56
This seems like a very odd ordering to add this me
tbansal1
2016/04/12 16:14:33
Done.
|
| + |
| scoped_ptr<SocketPosix> socket_; |
| scoped_ptr<SocketPosix> accept_socket_; |
| + // Socket performance statistics (such as RTT) are reported to the |
| + // |socket_performance_watcher_|. May be nullptr. |
| + scoped_ptr<SocketPerformanceWatcher> socket_performance_watcher_; |
| + |
| + scoped_ptr<base::TickClock> tick_clock_; |
| + |
| + // Time when the |socket_performance_watcher_| was last notified of updated |
| + // RTT. |
| + base::TimeTicks last_rtt_notification_; |
| + |
| // Enables experimental TCP FastOpen option. |
| bool use_tcp_fastopen_; |