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

Side by Side Diff: components/timers/alarm_timer_chromeos.cc

Issue 2386653002: Replace base::Callback with base::OnceCallback in base::PendingTask (Closed)
Patch Set: move UnsafeConvertOnceClosureToRepeating Created 4 years, 2 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 unified diff | Download patch
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « base/threading/worker_pool_win.cc ('k') | third_party/WebKit/Source/platform/scheduler/base/task_queue_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698