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