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 #include <utility> |
9 | 10 |
10 #include "base/bind.h" | 11 #include "base/bind.h" |
11 #include "base/bind_helpers.h" | 12 #include "base/bind_helpers.h" |
12 #include "base/files/file_util.h" | 13 #include "base/files/file_util.h" |
13 #include "base/lazy_instance.h" | 14 #include "base/lazy_instance.h" |
14 #include "base/logging.h" | 15 #include "base/logging.h" |
15 #include "base/macros.h" | 16 #include "base/macros.h" |
16 #include "base/message_loop/message_loop.h" | 17 #include "base/message_loop/message_loop.h" |
17 #include "base/pending_task.h" | 18 #include "base/pending_task.h" |
18 #include "base/thread_task_runner_handle.h" | 19 #include "base/thread_task_runner_handle.h" |
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
418 } | 419 } |
419 | 420 |
420 void AlarmTimer::OnTimerFired() { | 421 void AlarmTimer::OnTimerFired() { |
421 if (!base::Timer::IsRunning()) | 422 if (!base::Timer::IsRunning()) |
422 return; | 423 return; |
423 | 424 |
424 DCHECK(pending_task_.get()); | 425 DCHECK(pending_task_.get()); |
425 | 426 |
426 // Take ownership of the pending user task, which is going to be cleared by | 427 // Take ownership of the pending user task, which is going to be cleared by |
427 // the Stop() or Reset() functions below. | 428 // the Stop() or Reset() functions below. |
428 scoped_ptr<base::PendingTask> pending_user_task(pending_task_.Pass()); | 429 scoped_ptr<base::PendingTask> pending_user_task(std::move(pending_task_)); |
429 | 430 |
430 // Re-schedule or stop the timer as requested. | 431 // Re-schedule or stop the timer as requested. |
431 if (base::Timer::is_repeating()) | 432 if (base::Timer::is_repeating()) |
432 Reset(); | 433 Reset(); |
433 else | 434 else |
434 Stop(); | 435 Stop(); |
435 | 436 |
436 TRACE_TASK_EXECUTION("AlarmTimer::OnTimerFired", *pending_user_task); | 437 TRACE_TASK_EXECUTION("AlarmTimer::OnTimerFired", *pending_user_task); |
437 | 438 |
438 // Now run the user task. | 439 // Now run the user task. |
(...skipping 26 matching lines...) Expand all Loading... |
465 SimpleAlarmTimer::SimpleAlarmTimer(const tracked_objects::Location& posted_from, | 466 SimpleAlarmTimer::SimpleAlarmTimer(const tracked_objects::Location& posted_from, |
466 base::TimeDelta delay, | 467 base::TimeDelta delay, |
467 const base::Closure& user_task) | 468 const base::Closure& user_task) |
468 : AlarmTimer(posted_from, delay, user_task, false) { | 469 : AlarmTimer(posted_from, delay, user_task, false) { |
469 } | 470 } |
470 | 471 |
471 SimpleAlarmTimer::~SimpleAlarmTimer() { | 472 SimpleAlarmTimer::~SimpleAlarmTimer() { |
472 } | 473 } |
473 | 474 |
474 } // namespace timers | 475 } // namespace timers |
OLD | NEW |