Index: net/quic/quic_connection_logger.cc |
diff --git a/net/quic/quic_connection_logger.cc b/net/quic/quic_connection_logger.cc |
index c0eb82c68e5be162b63be4606af284ca2708d4df..a0c4c76cee8604f4396a421a2a47bdb51cb0c598 100644 |
--- a/net/quic/quic_connection_logger.cc |
+++ b/net/quic/quic_connection_logger.cc |
@@ -21,6 +21,7 @@ |
#include "net/quic/crypto/crypto_handshake_message.h" |
#include "net/quic/crypto/crypto_protocol.h" |
#include "net/quic/quic_address_mismatch.h" |
+#include "net/quic/quic_sent_packet_manager.h" |
#include "net/quic/quic_socket_address_coder.h" |
using base::StringPiece; |
@@ -289,7 +290,9 @@ AddressFamily GetRealAddressFamily(const IPAddressNumber& address) { |
QuicConnectionLogger::QuicConnectionLogger( |
QuicSpdySession* session, |
const char* const connection_description, |
- const BoundNetLog& net_log) |
+ const BoundNetLog& net_log, |
+ QuicConnection* connection, |
+ scoped_ptr<SocketPerformanceWatcher> socket_performance_watcher) |
: net_log_(net_log), |
session_(session), |
last_received_packet_number_(0), |
@@ -309,7 +312,9 @@ QuicConnectionLogger::QuicConnectionLogger( |
num_duplicate_packets_(0), |
num_blocked_frames_received_(0), |
num_blocked_frames_sent_(0), |
- connection_description_(connection_description) {} |
+ connection_description_(connection_description), |
+ connection_(connection), |
+ socket_performance_watcher_(socket_performance_watcher.Pass()) {} |
QuicConnectionLogger::~QuicConnectionLogger() { |
UMA_HISTOGRAM_COUNTS("Net.QuicSession.OutOfOrderPacketsReceived", |
@@ -459,6 +464,14 @@ void QuicConnectionLogger::OnPacketSent( |
base::Bind(&NetLogQuicPacketRetransmittedCallback, |
original_packet_number, serialized_packet.packet_number)); |
} |
+ // Notify socket performance watcher of the updated RTT value. |
+ if (socket_performance_watcher_ && connection_) { |
Ryan Hamilton
2015/09/17 01:59:49
Why would we not have a connection?
tbansal1
2015/09/17 22:23:42
Removed, I was just not sure, so tried to be on th
|
+ socket_performance_watcher_->OnUpdatedRTTAvailable( |
+ base::TimeDelta::FromMicroseconds(connection_->sent_packet_manager() |
+ .GetRttStats() |
+ ->smoothed_rtt() |
+ .ToMicroseconds())); |
+ } |
} |
void QuicConnectionLogger::OnPacketReceived(const IPEndPoint& self_address, |
@@ -477,6 +490,15 @@ void QuicConnectionLogger::OnPacketReceived(const IPEndPoint& self_address, |
NetLog::TYPE_QUIC_SESSION_PACKET_RECEIVED, |
base::Bind(&NetLogQuicPacketCallback, &self_address, &peer_address, |
packet.length())); |
+ |
+ // Notify socket performance watcher of the updated RTT value. |
+ if (socket_performance_watcher_ && connection_) { |
+ socket_performance_watcher_->OnUpdatedRTTAvailable( |
+ base::TimeDelta::FromMicroseconds(connection_->sent_packet_manager() |
+ .GetRttStats() |
+ ->smoothed_rtt() |
+ .ToMicroseconds())); |
+ } |
Ryan Hamilton
2015/09/17 01:59:49
I think smoothed_rtt() can return Zero. Is that OK
tbansal1
2015/09/17 22:23:42
Added check for zero.
|
} |
Ryan Hamilton
2015/09/17 01:59:49
Looking at this more closely, I see that you're re
tbansal1
2015/09/17 22:23:42
Done. That's much cleaner :)
|
void QuicConnectionLogger::OnUnauthenticatedHeader( |