| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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.h" | 5 #include "base/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 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 484 // and deliberately alias it to ensure it is on the stack if the task | 484 // and deliberately alias it to ensure it is on the stack if the task |
| 485 // crashes. Be careful not to assume that the variable itself will have the | 485 // crashes. Be careful not to assume that the variable itself will have the |
| 486 // expected value when displayed by the optimizer in an optimized build. | 486 // expected value when displayed by the optimizer in an optimized build. |
| 487 // Look at a memory dump of the stack. | 487 // Look at a memory dump of the stack. |
| 488 const void* program_counter = | 488 const void* program_counter = |
| 489 pending_task.posted_from.program_counter(); | 489 pending_task.posted_from.program_counter(); |
| 490 base::debug::Alias(&program_counter); | 490 base::debug::Alias(&program_counter); |
| 491 | 491 |
| 492 HistogramEvent(kTaskRunEvent); | 492 HistogramEvent(kTaskRunEvent); |
| 493 | 493 |
| 494 tracked_objects::TrackedTime start_time = tracked_objects::ThreadData::Now(); | 494 tracked_objects::TrackedTime start_time = |
| 495 tracked_objects::ThreadData::NowForStartOfRun(); |
| 495 | 496 |
| 496 FOR_EACH_OBSERVER(TaskObserver, task_observers_, | 497 FOR_EACH_OBSERVER(TaskObserver, task_observers_, |
| 497 WillProcessTask(pending_task.time_posted)); | 498 WillProcessTask(pending_task.time_posted)); |
| 498 pending_task.task.Run(); | 499 pending_task.task.Run(); |
| 499 FOR_EACH_OBSERVER(TaskObserver, task_observers_, | 500 FOR_EACH_OBSERVER(TaskObserver, task_observers_, |
| 500 DidProcessTask(pending_task.time_posted)); | 501 DidProcessTask(pending_task.time_posted)); |
| 501 | 502 |
| 502 tracked_objects::ThreadData::TallyRunOnNamedThreadIfTracking(pending_task, | 503 tracked_objects::ThreadData::TallyRunOnNamedThreadIfTracking(pending_task, |
| 503 start_time, tracked_objects::ThreadData::Now()); | 504 start_time, tracked_objects::ThreadData::NowForEndOfRun()); |
| 504 | 505 |
| 505 nestable_tasks_allowed_ = true; | 506 nestable_tasks_allowed_ = true; |
| 506 } | 507 } |
| 507 | 508 |
| 508 bool MessageLoop::DeferOrRunPendingTask(const PendingTask& pending_task) { | 509 bool MessageLoop::DeferOrRunPendingTask(const PendingTask& pending_task) { |
| 509 if (pending_task.nestable || state_->run_depth == 1) { | 510 if (pending_task.nestable || state_->run_depth == 1) { |
| 510 RunTask(pending_task); | 511 RunTask(pending_task); |
| 511 // Show that we ran a task (Note: a new one might arrive as a | 512 // Show that we ran a task (Note: a new one might arrive as a |
| 512 // consequence!). | 513 // consequence!). |
| 513 return true; | 514 return true; |
| (...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 868 Watcher *delegate) { | 869 Watcher *delegate) { |
| 869 return pump_libevent()->WatchFileDescriptor( | 870 return pump_libevent()->WatchFileDescriptor( |
| 870 fd, | 871 fd, |
| 871 persistent, | 872 persistent, |
| 872 static_cast<base::MessagePumpLibevent::Mode>(mode), | 873 static_cast<base::MessagePumpLibevent::Mode>(mode), |
| 873 controller, | 874 controller, |
| 874 delegate); | 875 delegate); |
| 875 } | 876 } |
| 876 | 877 |
| 877 #endif | 878 #endif |
| OLD | NEW |