Index: net/quic/quic_connection.cc |
diff --git a/net/quic/quic_connection.cc b/net/quic/quic_connection.cc |
index f663111c2cdaf13369d6d438ac02004586c5511f..91b8dcb2a0862e66845713e125d9c3a3289b46ec 100644 |
--- a/net/quic/quic_connection.cc |
+++ b/net/quic/quic_connection.cc |
@@ -244,14 +244,16 @@ QuicConnection::QueuedPacket::QueuedPacket( |
#define ENDPOINT \ |
(perspective_ == Perspective::IS_SERVER ? "Server: " : "Client: ") |
-QuicConnection::QuicConnection(QuicConnectionId connection_id, |
- IPEndPoint address, |
- QuicConnectionHelperInterface* helper, |
- const PacketWriterFactory& writer_factory, |
- bool owns_writer, |
- Perspective perspective, |
- bool is_secure, |
- const QuicVersionVector& supported_versions) |
+QuicConnection::QuicConnection( |
+ QuicConnectionId connection_id, |
+ IPEndPoint address, |
+ QuicConnectionHelperInterface* helper, |
+ const PacketWriterFactory& writer_factory, |
+ bool owns_writer, |
+ Perspective perspective, |
+ bool is_secure, |
+ const QuicVersionVector& supported_versions, |
+ scoped_ptr<SocketPerformanceWatcher> socket_performance_watcher) |
: framer_(supported_versions, |
helper->GetClock()->ApproximateNow(), |
perspective), |
@@ -320,7 +322,8 @@ QuicConnection::QuicConnection(QuicConnectionId connection_id, |
next_mtu_probe_at_(kPacketsBetweenMtuProbesBase), |
largest_received_packet_size_(0), |
goaway_sent_(false), |
- goaway_received_(false) { |
+ goaway_received_(false), |
+ socket_performance_watcher_(socket_performance_watcher.Pass()) { |
DVLOG(1) << ENDPOINT << "Created connection with connection_id: " |
<< connection_id; |
framer_.set_visitor(this); |
@@ -1388,6 +1391,14 @@ void QuicConnection::ProcessUdpPacket(const IPEndPoint& self_address, |
MaybeProcessRevivedPacket(); |
MaybeSendInResponseToPacket(); |
SetPingAlarm(); |
+ |
+ // Notify socket performance watcher of the updated RTT value. |
+ if (socket_performance_watcher_) { |
+ socket_performance_watcher_->OnUpdatedRTTAvailable( |
+ base::TimeDelta::FromMicroseconds(sent_packet_manager_.GetRttStats() |
+ ->smoothed_rtt() |
+ .ToMicroseconds())); |
+ } |
} |
void QuicConnection::CheckForAddressMigration( |
@@ -1730,6 +1741,13 @@ bool QuicConnection::WritePacketInner(QueuedPacket* packet) { |
return false; |
} |
+ // Notify socket performance watcher of the updated RTT value. |
+ if (socket_performance_watcher_) { |
+ socket_performance_watcher_->OnUpdatedRTTAvailable( |
+ base::TimeDelta::FromMicroseconds(sent_packet_manager_.GetRttStats() |
+ ->smoothed_rtt() |
+ .ToMicroseconds())); |
+ } |
return true; |
} |