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

Unified Diff: net/quic/quic_alarm.cc

Issue 1778243005: Call QuicAlarm::IsSet instead of looking at deadline_ directly, rename some variables for readabili… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@116142833
Patch Set: Created 4 years, 9 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') | no next file » | 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 e1f0384138c767dd0a1be416be6932525e5a2e5d..371cbe98d7f32aa356c741e64939e675e41ee20e 100644
--- a/net/quic/quic_alarm.cc
+++ b/net/quic/quic_alarm.cc
@@ -14,10 +14,10 @@ QuicAlarm::QuicAlarm(QuicArenaScopedPtr<Delegate> delegate)
QuicAlarm::~QuicAlarm() {}
-void QuicAlarm::Set(QuicTime deadline) {
+void QuicAlarm::Set(QuicTime new_deadline) {
DCHECK(!IsSet());
- DCHECK(deadline.IsInitialized());
- deadline_ = deadline;
+ DCHECK(new_deadline.IsInitialized());
+ deadline_ = new_deadline;
SetImpl();
}
@@ -30,17 +30,17 @@ void QuicAlarm::Cancel() {
CancelImpl();
}
-void QuicAlarm::Update(QuicTime deadline, QuicTime::Delta granularity) {
- if (!deadline.IsInitialized()) {
+void QuicAlarm::Update(QuicTime new_deadline, QuicTime::Delta granularity) {
+ if (!new_deadline.IsInitialized()) {
Cancel();
return;
}
- if (std::abs(deadline.Subtract(deadline_).ToMicroseconds()) <
+ if (std::abs(new_deadline.Subtract(deadline_).ToMicroseconds()) <
granularity.ToMicroseconds()) {
return;
}
Cancel();
- Set(deadline);
+ Set(new_deadline);
}
bool QuicAlarm::IsSet() const {
@@ -48,18 +48,18 @@ bool QuicAlarm::IsSet() const {
}
void QuicAlarm::Fire() {
- if (!deadline_.IsInitialized()) {
+ if (!IsSet()) {
return;
}
deadline_ = QuicTime::Zero();
- QuicTime deadline = delegate_->OnAlarm();
+ QuicTime new_deadline = delegate_->OnAlarm();
// delegate_->OnAlarm() might call Set(), in which case deadline_
// will already contain the new value, so don't overwrite it. Also,
// OnAlarm() might delete |this| so check |deadline| before
// |deadline_|.
- if (deadline.IsInitialized() && !deadline_.IsInitialized()) {
- Set(deadline);
+ if (new_deadline.IsInitialized() && !IsSet()) {
+ Set(new_deadline);
}
}
« no previous file with comments | « net/quic/quic_alarm.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698