| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
| (...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 405 | 405 |
| 406 //------------------------------------------------------------------------------ | 406 //------------------------------------------------------------------------------ |
| 407 | 407 |
| 408 void MessageLoop::RunTask(Task* task) { | 408 void MessageLoop::RunTask(Task* task) { |
| 409 DCHECK(nestable_tasks_allowed_); | 409 DCHECK(nestable_tasks_allowed_); |
| 410 // Execute the task and assume the worst: It is probably not reentrant. | 410 // Execute the task and assume the worst: It is probably not reentrant. |
| 411 nestable_tasks_allowed_ = false; | 411 nestable_tasks_allowed_ = false; |
| 412 | 412 |
| 413 HistogramEvent(kTaskRunEvent); | 413 HistogramEvent(kTaskRunEvent); |
| 414 FOR_EACH_OBSERVER(TaskObserver, task_observers_, | 414 FOR_EACH_OBSERVER(TaskObserver, task_observers_, |
| 415 WillProcessTask(task->tracked_birth_time())); | 415 WillProcessTask(task)); |
| 416 task->Run(); | 416 task->Run(); |
| 417 FOR_EACH_OBSERVER(TaskObserver, task_observers_, DidProcessTask()); | 417 FOR_EACH_OBSERVER(TaskObserver, task_observers_, DidProcessTask(task)); |
| 418 delete task; | 418 delete task; |
| 419 | 419 |
| 420 nestable_tasks_allowed_ = true; | 420 nestable_tasks_allowed_ = true; |
| 421 } | 421 } |
| 422 | 422 |
| 423 bool MessageLoop::DeferOrRunPendingTask(const PendingTask& pending_task) { | 423 bool MessageLoop::DeferOrRunPendingTask(const PendingTask& pending_task) { |
| 424 if (pending_task.nestable || state_->run_depth == 1) { | 424 if (pending_task.nestable || state_->run_depth == 1) { |
| 425 RunTask(pending_task.task); | 425 RunTask(pending_task.task); |
| 426 // Show that we ran a task (Note: a new one might arrive as a | 426 // Show that we ran a task (Note: a new one might arrive as a |
| 427 // consequence!). | 427 // consequence!). |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 686 Watcher *delegate) { | 686 Watcher *delegate) { |
| 687 return pump_libevent()->WatchFileDescriptor( | 687 return pump_libevent()->WatchFileDescriptor( |
| 688 fd, | 688 fd, |
| 689 persistent, | 689 persistent, |
| 690 static_cast<base::MessagePumpLibevent::Mode>(mode), | 690 static_cast<base::MessagePumpLibevent::Mode>(mode), |
| 691 controller, | 691 controller, |
| 692 delegate); | 692 delegate); |
| 693 } | 693 } |
| 694 | 694 |
| 695 #endif | 695 #endif |
| OLD | NEW |