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" | |
23 #include "base/tracked_objects.h" | 22 #include "base/tracked_objects.h" |
24 | 23 |
25 #if defined(OS_MACOSX) | 24 #if defined(OS_MACOSX) |
26 #include "base/message_loop/message_pump_mac.h" | 25 #include "base/message_loop/message_pump_mac.h" |
27 #endif | 26 #endif |
28 #if defined(OS_POSIX) && !defined(OS_IOS) | 27 #if defined(OS_POSIX) && !defined(OS_IOS) |
29 #include "base/message_loop/message_pump_libevent.h" | 28 #include "base/message_loop/message_pump_libevent.h" |
30 #endif | 29 #endif |
31 #if defined(OS_ANDROID) | 30 #if defined(OS_ANDROID) |
32 #include "base/message_loop/message_pump_android.h" | 31 #include "base/message_loop/message_pump_android.h" |
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
448 | 447 |
449 PendingTask pending_task = deferred_non_nestable_work_queue_.front(); | 448 PendingTask pending_task = deferred_non_nestable_work_queue_.front(); |
450 deferred_non_nestable_work_queue_.pop(); | 449 deferred_non_nestable_work_queue_.pop(); |
451 | 450 |
452 RunTask(pending_task); | 451 RunTask(pending_task); |
453 return true; | 452 return true; |
454 } | 453 } |
455 | 454 |
456 void MessageLoop::RunTask(const PendingTask& pending_task) { | 455 void MessageLoop::RunTask(const PendingTask& pending_task) { |
457 DCHECK(nestable_tasks_allowed_); | 456 DCHECK(nestable_tasks_allowed_); |
458 TRACE_EVENT0("toplevel", "MessageLoop::RunTask.WithObservers"); | |
459 | 457 |
460 #if defined(OS_WIN) | 458 #if defined(OS_WIN) |
461 if (pending_task.is_high_res) { | 459 if (pending_task.is_high_res) { |
462 pending_high_res_tasks_--; | 460 pending_high_res_tasks_--; |
463 CHECK_GE(pending_high_res_tasks_, 0); | 461 CHECK_GE(pending_high_res_tasks_, 0); |
464 } | 462 } |
465 #endif | 463 #endif |
466 | 464 |
467 // Execute the task and assume the worst: It is probably not reentrant. | 465 // Execute the task and assume the worst: It is probably not reentrant. |
468 nestable_tasks_allowed_ = false; | 466 nestable_tasks_allowed_ = false; |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
741 persistent, | 739 persistent, |
742 mode, | 740 mode, |
743 controller, | 741 controller, |
744 delegate); | 742 delegate); |
745 } | 743 } |
746 #endif | 744 #endif |
747 | 745 |
748 #endif // !defined(OS_NACL_SFI) | 746 #endif // !defined(OS_NACL_SFI) |
749 | 747 |
750 } // namespace base | 748 } // namespace base |
OLD | NEW |