| 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" |
| (...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 405 return false; | 405 return false; |
| 406 | 406 |
| 407 PendingTask pending_task = deferred_non_nestable_work_queue_.front(); | 407 PendingTask pending_task = deferred_non_nestable_work_queue_.front(); |
| 408 deferred_non_nestable_work_queue_.pop(); | 408 deferred_non_nestable_work_queue_.pop(); |
| 409 | 409 |
| 410 RunTask(pending_task); | 410 RunTask(pending_task); |
| 411 return true; | 411 return true; |
| 412 } | 412 } |
| 413 | 413 |
| 414 void MessageLoop::RunTask(const PendingTask& pending_task) { | 414 void MessageLoop::RunTask(const PendingTask& pending_task) { |
| 415 // For absolutely minimal tracing, "poll_cpu" captures _everything_ |
| 416 // on a typical message loop thread, so long as the thread runs semi-regular |
| 417 // tasks (for sufficient measurement granularity). |
| 418 TRACE_EVENT_END0(TRACE_DISABLED_BY_DEFAULT("poll_cpu"), "Poll"); |
| 419 TRACE_EVENT_BEGIN0(TRACE_DISABLED_BY_DEFAULT("poll_cpu"), "Poll"); |
| 420 |
| 415 tracked_objects::TrackedTime start_time = | 421 tracked_objects::TrackedTime start_time = |
| 416 tracked_objects::ThreadData::NowForStartOfRun(pending_task.birth_tally); | 422 tracked_objects::ThreadData::NowForStartOfRun(pending_task.birth_tally); |
| 417 | 423 |
| 418 TRACE_EVENT_FLOW_END1(TRACE_DISABLED_BY_DEFAULT("toplevel.flow"), | 424 TRACE_EVENT_FLOW_END1(TRACE_DISABLED_BY_DEFAULT("toplevel.flow"), |
| 419 "MessageLoop::PostTask", TRACE_ID_MANGLE(GetTaskTraceID(pending_task)), | 425 "MessageLoop::PostTask", TRACE_ID_MANGLE(GetTaskTraceID(pending_task)), |
| 420 "queue_duration", | 426 "queue_duration", |
| 421 (start_time - pending_task.EffectiveTimePosted()).InMilliseconds()); | 427 (start_time - pending_task.EffectiveTimePosted()).InMilliseconds()); |
| 422 // When tracing memory for posted tasks it's more valuable to attribute the | 428 // When tracing memory for posted tasks it's more valuable to attribute the |
| 423 // memory allocations to the source function than generically to "RunTask". | 429 // memory allocations to the source function than generically to "RunTask". |
| 424 TRACE_EVENT_WITH_MEMORY_TAG2( | 430 TRACE_EVENT_WITH_MEMORY_TAG2( |
| (...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 718 fd, | 724 fd, |
| 719 persistent, | 725 persistent, |
| 720 mode, | 726 mode, |
| 721 controller, | 727 controller, |
| 722 delegate); | 728 delegate); |
| 723 } | 729 } |
| 724 | 730 |
| 725 #endif | 731 #endif |
| 726 | 732 |
| 727 } // namespace base | 733 } // namespace base |
| OLD | NEW |