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

Unified Diff: net/quic/quic_alarm.cc

Issue 2158263003: Landing Recent QUIC changes until 7/18/2016 11:21:53 UTC (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Running flag flipping script and rebase to master Created 4 years, 5 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/quic/quic_alarm.h ('k') | net/quic/quic_connection.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/quic_alarm.cc
diff --git a/net/quic/quic_alarm.cc b/net/quic/quic_alarm.cc
index 3067a29c35c0a76d1308b3e5712e690271970d95..26021fb8893b39fc01e0ee4769c603f41810f871 100644
--- a/net/quic/quic_alarm.cc
+++ b/net/quic/quic_alarm.cc
@@ -39,8 +39,18 @@ void QuicAlarm::Update(QuicTime new_deadline, QuicTime::Delta granularity) {
granularity.ToMicroseconds()) {
return;
}
- Cancel();
- Set(new_deadline);
+ if (FLAGS_quic_change_alarms_efficiently) {
+ const bool was_set = IsSet();
+ deadline_ = new_deadline;
+ if (was_set) {
+ UpdateImpl();
+ } else {
+ SetImpl();
+ }
+ } else {
+ Cancel();
+ Set(new_deadline);
+ }
}
bool QuicAlarm::IsSet() const {
@@ -56,4 +66,16 @@ void QuicAlarm::Fire() {
delegate_->OnAlarm();
}
+void QuicAlarm::UpdateImpl() {
+ // CancelImpl and SetImpl take the new deadline by way of the deadline_
+ // member, so save and restore deadline_ before canceling.
+ const QuicTime new_deadline = deadline_;
+
+ deadline_ = QuicTime::Zero();
+ CancelImpl();
+
+ deadline_ = new_deadline;
+ SetImpl();
+}
+
} // namespace net
« no previous file with comments | « net/quic/quic_alarm.h ('k') | net/quic/quic_connection.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698