| 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 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 409 deferred_non_nestable_work_queue_.pop(); | 409 deferred_non_nestable_work_queue_.pop(); |
| 410 | 410 |
| 411 RunTask(pending_task); | 411 RunTask(pending_task); |
| 412 return true; | 412 return true; |
| 413 } | 413 } |
| 414 | 414 |
| 415 void MessageLoop::RunTask(const PendingTask& pending_task) { | 415 void MessageLoop::RunTask(const PendingTask& pending_task) { |
| 416 tracked_objects::TrackedTime start_time = | 416 tracked_objects::TrackedTime start_time = |
| 417 tracked_objects::ThreadData::NowForStartOfRun(pending_task.birth_tally); | 417 tracked_objects::ThreadData::NowForStartOfRun(pending_task.birth_tally); |
| 418 | 418 |
| 419 TRACE_EVENT_FLOW_END1(TRACE_DISABLED_BY_DEFAULT("toplevel.flow"), | 419 TRACE_EVENT_FLOW_END1("task", "MessageLoop::PostTask", |
| 420 "MessageLoop::PostTask", TRACE_ID_MANGLE(GetTaskTraceID(pending_task)), | 420 TRACE_ID_MANGLE(GetTaskTraceID(pending_task)), |
| 421 "queue_duration", | 421 "queue_duration", |
| 422 (start_time - pending_task.EffectiveTimePosted()).InMilliseconds()); | 422 (start_time - pending_task.EffectiveTimePosted()).InMilliseconds()); |
| 423 // When tracing memory for posted tasks it's more valuable to attribute the | 423 // When tracing memory for posted tasks it's more valuable to attribute the |
| 424 // memory allocations to the source function than generically to "RunTask". | 424 // memory allocations to the source function than generically to "RunTask". |
| 425 TRACE_EVENT_WITH_MEMORY_TAG2( | 425 TRACE_EVENT_WITH_MEMORY_TAG2( |
| 426 "toplevel", "MessageLoop::RunTask", | 426 "task", "MessageLoop::RunTask", |
| 427 pending_task.posted_from.function_name(), // Name for memory tracking. | 427 pending_task.posted_from.function_name(), // Name for memory tracking. |
| 428 "src_file", pending_task.posted_from.file_name(), | 428 "src_file", pending_task.posted_from.file_name(), |
| 429 "src_func", pending_task.posted_from.function_name()); | 429 "src_func", pending_task.posted_from.function_name()); |
| 430 | 430 |
| 431 DCHECK(nestable_tasks_allowed_); | 431 DCHECK(nestable_tasks_allowed_); |
| 432 // Execute the task and assume the worst: It is probably not reentrant. | 432 // Execute the task and assume the worst: It is probably not reentrant. |
| 433 nestable_tasks_allowed_ = false; | 433 nestable_tasks_allowed_ = false; |
| 434 | 434 |
| 435 // Before running the task, store the program counter where it was posted | 435 // Before running the task, store the program counter where it was posted |
| 436 // and deliberately alias it to ensure it is on the stack if the task | 436 // and deliberately alias it to ensure it is on the stack if the task |
| (...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 719 fd, | 719 fd, |
| 720 persistent, | 720 persistent, |
| 721 mode, | 721 mode, |
| 722 controller, | 722 controller, |
| 723 delegate); | 723 delegate); |
| 724 } | 724 } |
| 725 | 725 |
| 726 #endif | 726 #endif |
| 727 | 727 |
| 728 } // namespace base | 728 } // namespace base |
| OLD | NEW |