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

Unified Diff: net/socket/tcp_socket_posix.h

Issue 1376473003: Notify NQE of TCP RTT values (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Reorder initialization in constructor Created 4 years, 8 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/socket/tcp_server_socket_unittest.cc ('k') | net/socket/tcp_socket_posix.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..d092b572da72d4361c43be637a3ba176f6c25486 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();
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_;
+
+ // Minimum interval betweeen consecutive notifications to
+ // |socket_performance_watcher_|.
+ const base::TimeDelta rtt_notifications_minimum_interval_;
+
+ // 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_;
« no previous file with comments | « net/socket/tcp_server_socket_unittest.cc ('k') | net/socket/tcp_socket_posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698