Index: net/quic/quic_alarm.cc |
diff --git a/net/quic/quic_alarm.cc b/net/quic/quic_alarm.cc |
index e1d4a16ae9c1d2a99dc929bac84884777a767a85..b5aca8caa175aae288f0d6f7c23f39b61bfed29a 100644 |
--- a/net/quic/quic_alarm.cc |
+++ b/net/quic/quic_alarm.cc |
@@ -27,6 +27,19 @@ void QuicAlarm::Cancel() { |
CancelImpl(); |
} |
+void QuicAlarm::Update(QuicTime deadline, QuicTime::Delta granularity) { |
+ if (!deadline.IsInitialized()) { |
+ Cancel(); |
+ return; |
+ } |
+ if (std::abs(deadline.Subtract(deadline_).ToMicroseconds()) < |
+ granularity.ToMicroseconds()) { |
+ return; |
+ } |
+ Cancel(); |
+ Set(deadline); |
+} |
+ |
bool QuicAlarm::IsSet() const { |
return deadline_.IsInitialized(); |
} |