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 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
517 if (incoming_queue_.empty()) | 517 if (incoming_queue_.empty()) |
518 return; | 518 return; |
519 incoming_queue_.Swap(&work_queue_); // Constant time | 519 incoming_queue_.Swap(&work_queue_); // Constant time |
520 DCHECK(incoming_queue_.empty()); | 520 DCHECK(incoming_queue_.empty()); |
521 } | 521 } |
522 } | 522 } |
523 | 523 |
524 bool MessageLoop::DeletePendingTasks() { | 524 bool MessageLoop::DeletePendingTasks() { |
525 bool did_work = !work_queue_.empty(); | 525 bool did_work = !work_queue_.empty(); |
526 // TODO(darin): Delete all tasks once it is safe to do so. | 526 // TODO(darin): Delete all tasks once it is safe to do so. |
527 // Until it is totally safe, just do it when running Purify or | 527 // Until it is totally safe, just do it when running Valgrind. |
528 // Valgrind. | |
529 // | 528 // |
530 // See http://crbug.com/61131 | 529 // See http://crbug.com/61131 |
531 // | 530 // |
532 #if defined(PURIFY) || defined(USE_HEAPCHECKER) | 531 #if defined(USE_HEAPCHECKER) |
533 should_leak_tasks_ = false; | 532 should_leak_tasks_ = false; |
534 #else | 533 #else |
535 if (RunningOnValgrind()) | 534 if (RunningOnValgrind()) |
536 should_leak_tasks_ = false; | 535 should_leak_tasks_ = false; |
537 #endif // defined(OS_POSIX) | 536 #endif // defined(OS_POSIX) |
538 while (!work_queue_.empty()) { | 537 while (!work_queue_.empty()) { |
539 PendingTask pending_task = work_queue_.front(); | 538 PendingTask pending_task = work_queue_.front(); |
540 work_queue_.pop(); | 539 work_queue_.pop(); |
541 if (!pending_task.delayed_run_time.is_null()) { | 540 if (!pending_task.delayed_run_time.is_null()) { |
542 // We want to delete delayed tasks in the same order in which they would | 541 // We want to delete delayed tasks in the same order in which they would |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
839 Watcher *delegate) { | 838 Watcher *delegate) { |
840 return pump_libevent()->WatchFileDescriptor( | 839 return pump_libevent()->WatchFileDescriptor( |
841 fd, | 840 fd, |
842 persistent, | 841 persistent, |
843 static_cast<base::MessagePumpLibevent::Mode>(mode), | 842 static_cast<base::MessagePumpLibevent::Mode>(mode), |
844 controller, | 843 controller, |
845 delegate); | 844 delegate); |
846 } | 845 } |
847 | 846 |
848 #endif | 847 #endif |
OLD | NEW |