OLD | NEW |
---|---|
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 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
447 | 448 |
448 PendingTask pending_task = deferred_non_nestable_work_queue_.front(); | 449 PendingTask pending_task = deferred_non_nestable_work_queue_.front(); |
449 deferred_non_nestable_work_queue_.pop(); | 450 deferred_non_nestable_work_queue_.pop(); |
450 | 451 |
451 RunTask(pending_task); | 452 RunTask(pending_task); |
452 return true; | 453 return true; |
453 } | 454 } |
454 | 455 |
455 void MessageLoop::RunTask(const PendingTask& pending_task) { | 456 void MessageLoop::RunTask(const PendingTask& pending_task) { |
456 DCHECK(nestable_tasks_allowed_); | 457 DCHECK(nestable_tasks_allowed_); |
458 TRACE_EVENT0("toplevel", "RunTaskWithObservers"); | |
danakj
2015/07/10 18:25:07
Can you put MessageLoop::RunTask in this name so i
| |
457 | 459 |
458 #if defined(OS_WIN) | 460 #if defined(OS_WIN) |
459 if (pending_task.is_high_res) { | 461 if (pending_task.is_high_res) { |
460 pending_high_res_tasks_--; | 462 pending_high_res_tasks_--; |
461 CHECK_GE(pending_high_res_tasks_, 0); | 463 CHECK_GE(pending_high_res_tasks_, 0); |
462 } | 464 } |
463 #endif | 465 #endif |
464 | 466 |
465 // Execute the task and assume the worst: It is probably not reentrant. | 467 // Execute the task and assume the worst: It is probably not reentrant. |
466 nestable_tasks_allowed_ = false; | 468 nestable_tasks_allowed_ = false; |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
739 persistent, | 741 persistent, |
740 mode, | 742 mode, |
741 controller, | 743 controller, |
742 delegate); | 744 delegate); |
743 } | 745 } |
744 #endif | 746 #endif |
745 | 747 |
746 #endif // !defined(OS_NACL_SFI) | 748 #endif // !defined(OS_NACL_SFI) |
747 | 749 |
748 } // namespace base | 750 } // namespace base |
OLD | NEW |