| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "net/quic/quic_alarm.h" | 5 #include "net/quic/quic_alarm.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 | 8 |
| 9 namespace net { | 9 namespace net { |
| 10 | 10 |
| 11 QuicAlarm::QuicAlarm(Delegate* delegate) | 11 QuicAlarm::QuicAlarm(QuicArenaScopedPtr<Delegate> delegate) |
| 12 : delegate_(delegate), deadline_(QuicTime::Zero()) {} | 12 : delegate_(std::move(delegate)), deadline_(QuicTime::Zero()) {} |
| 13 | 13 |
| 14 QuicAlarm::~QuicAlarm() {} | 14 QuicAlarm::~QuicAlarm() {} |
| 15 | 15 |
| 16 void QuicAlarm::Set(QuicTime deadline) { | 16 void QuicAlarm::Set(QuicTime deadline) { |
| 17 DCHECK(!IsSet()); | 17 DCHECK(!IsSet()); |
| 18 DCHECK(deadline.IsInitialized()); | 18 DCHECK(deadline.IsInitialized()); |
| 19 deadline_ = deadline; | 19 deadline_ = deadline; |
| 20 SetImpl(); | 20 SetImpl(); |
| 21 } | 21 } |
| 22 | 22 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 50 deadline_ = QuicTime::Zero(); | 50 deadline_ = QuicTime::Zero(); |
| 51 QuicTime deadline = delegate_->OnAlarm(); | 51 QuicTime deadline = delegate_->OnAlarm(); |
| 52 // delegate_->OnAlarm() might call Set(), in which case deadline_ will | 52 // delegate_->OnAlarm() might call Set(), in which case deadline_ will |
| 53 // already contain the new value, so don't overwrite it. | 53 // already contain the new value, so don't overwrite it. |
| 54 if (!deadline_.IsInitialized() && deadline.IsInitialized()) { | 54 if (!deadline_.IsInitialized() && deadline.IsInitialized()) { |
| 55 Set(deadline); | 55 Set(deadline); |
| 56 } | 56 } |
| 57 } | 57 } |
| 58 | 58 |
| 59 } // namespace net | 59 } // namespace net |
| OLD | NEW |