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

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

Issue 1237283006: Extract trace from TaskAnnotator::RunTask to its call sites (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed cros build (now for real) Created 5 years, 5 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
« no previous file with comments | « components/scheduler/child/task_queue_manager.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <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"
11 #include "base/files/file_util.h" 11 #include "base/files/file_util.h"
12 #include "base/lazy_instance.h" 12 #include "base/lazy_instance.h"
13 #include "base/logging.h" 13 #include "base/logging.h"
14 #include "base/macros.h" 14 #include "base/macros.h"
15 #include "base/message_loop/message_loop.h" 15 #include "base/message_loop/message_loop.h"
16 #include "base/pending_task.h" 16 #include "base/pending_task.h"
17 #include "base/thread_task_runner_handle.h" 17 #include "base/thread_task_runner_handle.h"
18 #include "base/threading/thread.h" 18 #include "base/threading/thread.h"
19 #include "base/trace_event/trace_event.h"
19 20
20 namespace timers { 21 namespace timers {
21 namespace { 22 namespace {
22 // This class represents the IO thread that the AlarmTimer::Delegate may use for 23 // This class represents the IO thread that the AlarmTimer::Delegate may use for
23 // watching file descriptors if it gets called from a thread that does not have 24 // watching file descriptors if it gets called from a thread that does not have
24 // a MessageLoopForIO. It is a lazy global instance because it may not always 25 // a MessageLoopForIO. It is a lazy global instance because it may not always
25 // be necessary. 26 // be necessary.
26 class RtcAlarmIOThread : public base::Thread { 27 class RtcAlarmIOThread : public base::Thread {
27 public: 28 public:
28 RtcAlarmIOThread() : Thread("RTC Alarm IO Thread") { 29 RtcAlarmIOThread() : Thread("RTC Alarm IO Thread") {
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 // Take ownership of the pending user task, which is going to be cleared by 422 // Take ownership of the pending user task, which is going to be cleared by
422 // the Stop() or Reset() functions below. 423 // the Stop() or Reset() functions below.
423 scoped_ptr<base::PendingTask> pending_user_task(pending_task_.Pass()); 424 scoped_ptr<base::PendingTask> pending_user_task(pending_task_.Pass());
424 425
425 // Re-schedule or stop the timer as requested. 426 // Re-schedule or stop the timer as requested.
426 if (base::Timer::is_repeating()) 427 if (base::Timer::is_repeating())
427 Reset(); 428 Reset();
428 else 429 else
429 Stop(); 430 Stop();
430 431
432 TRACE_TASK_EXECUTION("AlarmTimer::OnTimerFired", *pending_user_task);
433
431 // Now run the user task. 434 // Now run the user task.
432 base::MessageLoop::current()->task_annotator()->RunTask( 435 base::MessageLoop::current()->task_annotator()->RunTask("AlarmTimer::Reset",
433 "AlarmTimer::Reset", "AlarmTimer::OnTimerFired", *pending_user_task); 436 *pending_user_task);
434 } 437 }
435 438
436 OneShotAlarmTimer::OneShotAlarmTimer() : AlarmTimer(false, false) { 439 OneShotAlarmTimer::OneShotAlarmTimer() : AlarmTimer(false, false) {
437 } 440 }
438 441
439 OneShotAlarmTimer::~OneShotAlarmTimer() { 442 OneShotAlarmTimer::~OneShotAlarmTimer() {
440 } 443 }
441 444
442 RepeatingAlarmTimer::RepeatingAlarmTimer() : AlarmTimer(true, true) { 445 RepeatingAlarmTimer::RepeatingAlarmTimer() : AlarmTimer(true, true) {
443 } 446 }
(...skipping 14 matching lines...) Expand all
458 SimpleAlarmTimer::SimpleAlarmTimer(const tracked_objects::Location& posted_from, 461 SimpleAlarmTimer::SimpleAlarmTimer(const tracked_objects::Location& posted_from,
459 base::TimeDelta delay, 462 base::TimeDelta delay,
460 const base::Closure& user_task) 463 const base::Closure& user_task)
461 : AlarmTimer(posted_from, delay, user_task, false) { 464 : AlarmTimer(posted_from, delay, user_task, false) {
462 } 465 }
463 466
464 SimpleAlarmTimer::~SimpleAlarmTimer() { 467 SimpleAlarmTimer::~SimpleAlarmTimer() {
465 } 468 }
466 469
467 } // namespace timers 470 } // namespace timers
OLDNEW
« no previous file with comments | « components/scheduler/child/task_queue_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698