OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/timers/alarm_timer_chromeos.h" | 5 #include "components/timers/alarm_timer_chromeos.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 #include <sys/timerfd.h> | 8 #include <sys/timerfd.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 DCHECK(pending_task_.get()); | 124 DCHECK(pending_task_.get()); |
125 | 125 |
126 // Take ownership of the PendingTask to prevent it from being deleted if the | 126 // Take ownership of the PendingTask to prevent it from being deleted if the |
127 // AlarmTimer is deleted. | 127 // AlarmTimer is deleted. |
128 const auto pending_user_task = std::move(pending_task_); | 128 const auto pending_user_task = std::move(pending_task_); |
129 | 129 |
130 base::WeakPtr<AlarmTimer> weak_ptr = weak_factory_.GetWeakPtr(); | 130 base::WeakPtr<AlarmTimer> weak_ptr = weak_factory_.GetWeakPtr(); |
131 | 131 |
132 // Run the task. | 132 // Run the task. |
133 TRACE_TASK_EXECUTION("AlarmTimer::OnTimerFired", *pending_user_task); | 133 TRACE_TASK_EXECUTION("AlarmTimer::OnTimerFired", *pending_user_task); |
134 base::debug::TaskAnnotator().RunTask("AlarmTimer::Reset", *pending_user_task); | 134 base::debug::TaskAnnotator().RunTask("AlarmTimer::Reset", |
| 135 pending_user_task.get()); |
135 | 136 |
136 // If the timer wasn't deleted, stopped or reset by the callback, reset or | 137 // If the timer wasn't deleted, stopped or reset by the callback, reset or |
137 // stop it. | 138 // stop it. |
138 if (weak_ptr.get()) { | 139 if (weak_ptr.get()) { |
139 if (base::Timer::is_repeating()) | 140 if (base::Timer::is_repeating()) |
140 Reset(); | 141 Reset(); |
141 else | 142 else |
142 Stop(); | 143 Stop(); |
143 } | 144 } |
144 } | 145 } |
(...skipping 14 matching lines...) Expand all Loading... |
159 RepeatingAlarmTimer::~RepeatingAlarmTimer() { | 160 RepeatingAlarmTimer::~RepeatingAlarmTimer() { |
160 } | 161 } |
161 | 162 |
162 SimpleAlarmTimer::SimpleAlarmTimer() : AlarmTimer(true, false) { | 163 SimpleAlarmTimer::SimpleAlarmTimer() : AlarmTimer(true, false) { |
163 } | 164 } |
164 | 165 |
165 SimpleAlarmTimer::~SimpleAlarmTimer() { | 166 SimpleAlarmTimer::~SimpleAlarmTimer() { |
166 } | 167 } |
167 | 168 |
168 } // namespace timers | 169 } // namespace timers |
OLD | NEW |