Chromium Code Reviews| 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 <sys/timerfd.h> | 7 #include <sys/timerfd.h> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 421 // Take ownership of the pending user task, which is going to be cleared by | 421 // Take ownership of the pending user task, which is going to be cleared by |
| 422 // the Stop() or Reset() functions below. | 422 // the Stop() or Reset() functions below. |
| 423 scoped_ptr<base::PendingTask> pending_user_task(pending_task_.Pass()); | 423 scoped_ptr<base::PendingTask> pending_user_task(pending_task_.Pass()); |
| 424 | 424 |
| 425 // Re-schedule or stop the timer as requested. | 425 // Re-schedule or stop the timer as requested. |
| 426 if (base::Timer::is_repeating()) | 426 if (base::Timer::is_repeating()) |
| 427 Reset(); | 427 Reset(); |
| 428 else | 428 else |
| 429 Stop(); | 429 Stop(); |
| 430 | 430 |
| 431 TRACE_EVENT_WITH_MEMORY_TAG2( | |
|
danakj
2015/07/15 18:03:23
You want to cover the time in this function right?
| |
| 432 "toplevel", | |
| 433 "AlarmTimer::OnTimerFired", | |
| 434 pending_task.posted_from.function_name(), // Name for memory tracking. | |
| 435 "src_file", | |
| 436 pending_task.posted_from.file_name(), | |
| 437 "src_func", | |
| 438 pending_task.posted_from.function_name()); | |
| 439 | |
| 431 // Now run the user task. | 440 // Now run the user task. |
| 432 base::MessageLoop::current()->task_annotator()->RunTask( | 441 base::MessageLoop::current()->task_annotator()->RunTask( |
| 433 "AlarmTimer::Reset", "AlarmTimer::OnTimerFired", *pending_user_task); | 442 "AlarmTimer::Reset", *pending_user_task); |
| 434 } | 443 } |
| 435 | 444 |
| 436 OneShotAlarmTimer::OneShotAlarmTimer() : AlarmTimer(false, false) { | 445 OneShotAlarmTimer::OneShotAlarmTimer() : AlarmTimer(false, false) { |
| 437 } | 446 } |
| 438 | 447 |
| 439 OneShotAlarmTimer::~OneShotAlarmTimer() { | 448 OneShotAlarmTimer::~OneShotAlarmTimer() { |
| 440 } | 449 } |
| 441 | 450 |
| 442 RepeatingAlarmTimer::RepeatingAlarmTimer() : AlarmTimer(true, true) { | 451 RepeatingAlarmTimer::RepeatingAlarmTimer() : AlarmTimer(true, true) { |
| 443 } | 452 } |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 458 SimpleAlarmTimer::SimpleAlarmTimer(const tracked_objects::Location& posted_from, | 467 SimpleAlarmTimer::SimpleAlarmTimer(const tracked_objects::Location& posted_from, |
| 459 base::TimeDelta delay, | 468 base::TimeDelta delay, |
| 460 const base::Closure& user_task) | 469 const base::Closure& user_task) |
| 461 : AlarmTimer(posted_from, delay, user_task, false) { | 470 : AlarmTimer(posted_from, delay, user_task, false) { |
| 462 } | 471 } |
| 463 | 472 |
| 464 SimpleAlarmTimer::~SimpleAlarmTimer() { | 473 SimpleAlarmTimer::~SimpleAlarmTimer() { |
| 465 } | 474 } |
| 466 | 475 |
| 467 } // namespace timers | 476 } // namespace timers |
| OLD | NEW |