| 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 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 381 AutoLock lock(incoming_queue_lock_); | 381 AutoLock lock(incoming_queue_lock_); |
| 382 if (incoming_queue_.empty()) | 382 if (incoming_queue_.empty()) |
| 383 return; | 383 return; |
| 384 incoming_queue_.Swap(&work_queue_); // Constant time | 384 incoming_queue_.Swap(&work_queue_); // Constant time |
| 385 DCHECK(incoming_queue_.empty()); | 385 DCHECK(incoming_queue_.empty()); |
| 386 } | 386 } |
| 387 } | 387 } |
| 388 | 388 |
| 389 bool MessageLoop::DeletePendingTasks() { | 389 bool MessageLoop::DeletePendingTasks() { |
| 390 bool did_work = !work_queue_.empty(); | 390 bool did_work = !work_queue_.empty(); |
| 391 #if defined(OS_POSIX) |
| 392 LOG(INFO) << "MessageLoop::DeletePendingTasks(): RUNNING_ON_VALGRIND=" |
| 393 << RUNNING_ON_VALGRIND; |
| 394 #endif |
| 391 while (!work_queue_.empty()) { | 395 while (!work_queue_.empty()) { |
| 392 PendingTask pending_task = work_queue_.front(); | 396 PendingTask pending_task = work_queue_.front(); |
| 393 work_queue_.pop(); | 397 work_queue_.pop(); |
| 394 if (!pending_task.delayed_run_time.is_null()) { | 398 if (!pending_task.delayed_run_time.is_null()) { |
| 395 // We want to delete delayed tasks in the same order in which they would | 399 // We want to delete delayed tasks in the same order in which they would |
| 396 // normally be deleted in case of any funny dependencies between delayed | 400 // normally be deleted in case of any funny dependencies between delayed |
| 397 // tasks. | 401 // tasks. |
| 398 AddToDelayedWorkQueue(pending_task); | 402 AddToDelayedWorkQueue(pending_task); |
| 399 } else { | 403 } else { |
| 400 // TODO(darin): Delete all tasks once it is safe to do so. | 404 // TODO(darin): Delete all tasks once it is safe to do so. |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 640 Watcher *delegate) { | 644 Watcher *delegate) { |
| 641 return pump_libevent()->WatchFileDescriptor( | 645 return pump_libevent()->WatchFileDescriptor( |
| 642 fd, | 646 fd, |
| 643 persistent, | 647 persistent, |
| 644 static_cast<base::MessagePumpLibevent::Mode>(mode), | 648 static_cast<base::MessagePumpLibevent::Mode>(mode), |
| 645 controller, | 649 controller, |
| 646 delegate); | 650 delegate); |
| 647 } | 651 } |
| 648 | 652 |
| 649 #endif | 653 #endif |
| OLD | NEW |