| 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 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 450 tracked_objects::TrackedTime start_time = | 450 tracked_objects::TrackedTime start_time = |
| 451 tracked_objects::ThreadData::NowForStartOfRun(pending_task.birth_tally); | 451 tracked_objects::ThreadData::NowForStartOfRun(pending_task.birth_tally); |
| 452 | 452 |
| 453 TRACE_EVENT_FLOW_END1("task", "MessageLoop::PostTask", | 453 TRACE_EVENT_FLOW_END1("task", "MessageLoop::PostTask", |
| 454 TRACE_ID_MANGLE(GetTaskTraceID(pending_task)), | 454 TRACE_ID_MANGLE(GetTaskTraceID(pending_task)), |
| 455 "queue_duration", | 455 "queue_duration", |
| 456 (start_time - pending_task.EffectiveTimePosted()).InMilliseconds()); | 456 (start_time - pending_task.EffectiveTimePosted()).InMilliseconds()); |
| 457 TRACE_EVENT2("task", "MessageLoop::RunTask", | 457 TRACE_EVENT2("task", "MessageLoop::RunTask", |
| 458 "src_file", pending_task.posted_from.file_name(), | 458 "src_file", pending_task.posted_from.file_name(), |
| 459 "src_func", pending_task.posted_from.function_name()); | 459 "src_func", pending_task.posted_from.function_name()); |
| 460 TRACE_EVENT2("task", "MessageLoop::PostTask", |
| 461 "queue_size", work_queue_.size() + 1, // +1 for this task. |
| 462 "queueing_delay", (start_time - |
| 463 pending_task.EffectiveTimePosted()).InMilliseconds()); |
| 460 | 464 |
| 461 DCHECK(nestable_tasks_allowed_); | 465 DCHECK(nestable_tasks_allowed_); |
| 462 // Execute the task and assume the worst: It is probably not reentrant. | 466 // Execute the task and assume the worst: It is probably not reentrant. |
| 463 nestable_tasks_allowed_ = false; | 467 nestable_tasks_allowed_ = false; |
| 464 | 468 |
| 465 // Before running the task, store the program counter where it was posted | 469 // Before running the task, store the program counter where it was posted |
| 466 // and deliberately alias it to ensure it is on the stack if the task | 470 // and deliberately alias it to ensure it is on the stack if the task |
| 467 // crashes. Be careful not to assume that the variable itself will have the | 471 // crashes. Be careful not to assume that the variable itself will have the |
| 468 // expected value when displayed by the optimizer in an optimized build. | 472 // expected value when displayed by the optimizer in an optimized build. |
| 469 // Look at a memory dump of the stack. | 473 // Look at a memory dump of the stack. |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 741 fd, | 745 fd, |
| 742 persistent, | 746 persistent, |
| 743 mode, | 747 mode, |
| 744 controller, | 748 controller, |
| 745 delegate); | 749 delegate); |
| 746 } | 750 } |
| 747 | 751 |
| 748 #endif | 752 #endif |
| 749 | 753 |
| 750 } // namespace base | 754 } // namespace base |
| OLD | NEW |