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

Side by Side Diff: base/message_loop/message_loop.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 | « base/debug/task_annotator_unittest.cc ('k') | components/scheduler/child/task_queue_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "base/message_loop/message_loop.h" 5 #include "base/message_loop/message_loop.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
11 #include "base/lazy_instance.h" 11 #include "base/lazy_instance.h"
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "base/message_loop/message_pump_default.h" 14 #include "base/message_loop/message_pump_default.h"
15 #include "base/metrics/histogram.h" 15 #include "base/metrics/histogram.h"
16 #include "base/metrics/statistics_recorder.h" 16 #include "base/metrics/statistics_recorder.h"
17 #include "base/run_loop.h" 17 #include "base/run_loop.h"
18 #include "base/third_party/dynamic_annotations/dynamic_annotations.h" 18 #include "base/third_party/dynamic_annotations/dynamic_annotations.h"
19 #include "base/thread_task_runner_handle.h" 19 #include "base/thread_task_runner_handle.h"
20 #include "base/threading/thread_local.h" 20 #include "base/threading/thread_local.h"
21 #include "base/time/time.h" 21 #include "base/time/time.h"
22 #include "base/trace_event/trace_event.h"
22 #include "base/tracked_objects.h" 23 #include "base/tracked_objects.h"
23 24
24 #if defined(OS_MACOSX) 25 #if defined(OS_MACOSX)
25 #include "base/message_loop/message_pump_mac.h" 26 #include "base/message_loop/message_pump_mac.h"
26 #endif 27 #endif
27 #if defined(OS_POSIX) && !defined(OS_IOS) 28 #if defined(OS_POSIX) && !defined(OS_IOS)
28 #include "base/message_loop/message_pump_libevent.h" 29 #include "base/message_loop/message_pump_libevent.h"
29 #endif 30 #endif
30 #if defined(OS_ANDROID) 31 #if defined(OS_ANDROID)
31 #include "base/message_loop/message_pump_android.h" 32 #include "base/message_loop/message_pump_android.h"
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 pending_high_res_tasks_--; 467 pending_high_res_tasks_--;
467 CHECK_GE(pending_high_res_tasks_, 0); 468 CHECK_GE(pending_high_res_tasks_, 0);
468 } 469 }
469 #endif 470 #endif
470 471
471 // Execute the task and assume the worst: It is probably not reentrant. 472 // Execute the task and assume the worst: It is probably not reentrant.
472 nestable_tasks_allowed_ = false; 473 nestable_tasks_allowed_ = false;
473 474
474 HistogramEvent(kTaskRunEvent); 475 HistogramEvent(kTaskRunEvent);
475 476
477 TRACE_TASK_EXECUTION("toplevel", pending_task);
478
476 FOR_EACH_OBSERVER(TaskObserver, task_observers_, 479 FOR_EACH_OBSERVER(TaskObserver, task_observers_,
477 WillProcessTask(pending_task)); 480 WillProcessTask(pending_task));
478 task_annotator_.RunTask( 481 task_annotator_.RunTask("MessageLoop::PostTask", pending_task);
479 "MessageLoop::PostTask", "MessageLoop::RunTask", pending_task);
480 FOR_EACH_OBSERVER(TaskObserver, task_observers_, 482 FOR_EACH_OBSERVER(TaskObserver, task_observers_,
481 DidProcessTask(pending_task)); 483 DidProcessTask(pending_task));
482 484
483 nestable_tasks_allowed_ = true; 485 nestable_tasks_allowed_ = true;
484 } 486 }
485 487
486 bool MessageLoop::DeferOrRunPendingTask(const PendingTask& pending_task) { 488 bool MessageLoop::DeferOrRunPendingTask(const PendingTask& pending_task) {
487 if (pending_task.nestable || run_loop_->run_depth_ == 1) { 489 if (pending_task.nestable || run_loop_->run_depth_ == 1) {
488 RunTask(pending_task); 490 RunTask(pending_task);
489 // Show that we ran a task (Note: a new one might arrive as a 491 // Show that we ran a task (Note: a new one might arrive as a
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
745 persistent, 747 persistent,
746 mode, 748 mode,
747 controller, 749 controller,
748 delegate); 750 delegate);
749 } 751 }
750 #endif 752 #endif
751 753
752 #endif // !defined(OS_NACL_SFI) 754 #endif // !defined(OS_NACL_SFI)
753 755
754 } // namespace base 756 } // namespace base
OLDNEW
« no previous file with comments | « base/debug/task_annotator_unittest.cc ('k') | components/scheduler/child/task_queue_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698