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 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
463 work_queue_.pop(); | 463 work_queue_.pop(); |
464 if (!pending_task.delayed_run_time.is_null()) { | 464 if (!pending_task.delayed_run_time.is_null()) { |
465 // We want to delete delayed tasks in the same order in which they would | 465 // We want to delete delayed tasks in the same order in which they would |
466 // normally be deleted in case of any funny dependencies between delayed | 466 // normally be deleted in case of any funny dependencies between delayed |
467 // tasks. | 467 // tasks. |
468 AddToDelayedWorkQueue(pending_task); | 468 AddToDelayedWorkQueue(pending_task); |
469 } else { | 469 } else { |
470 // TODO(darin): Delete all tasks once it is safe to do so. | 470 // TODO(darin): Delete all tasks once it is safe to do so. |
471 // Until it is totally safe, just do it when running Purify or | 471 // Until it is totally safe, just do it when running Purify or |
472 // Valgrind. | 472 // Valgrind. |
473 #if defined(PURIFY) || defined(USE_HEAPCHECKER) | 473 #if defined(PURIFY) |
474 delete pending_task.task; | 474 delete pending_task.task; |
475 #elif defined(OS_POSIX) | 475 #elif defined(OS_POSIX) |
476 if (RUNNING_ON_VALGRIND) | 476 if (RUNNING_ON_VALGRIND) |
477 delete pending_task.task; | 477 delete pending_task.task; |
478 #endif // defined(OS_POSIX) | 478 #endif // defined(OS_POSIX) |
479 } | 479 } |
480 } | 480 } |
481 did_work |= !deferred_non_nestable_work_queue_.empty(); | 481 did_work |= !deferred_non_nestable_work_queue_.empty(); |
482 while (!deferred_non_nestable_work_queue_.empty()) { | 482 while (!deferred_non_nestable_work_queue_.empty()) { |
483 // TODO(darin): Delete all tasks once it is safe to do so. | 483 // TODO(darin): Delete all tasks once it is safe to do so. |
484 // Until it is totaly safe, only delete them under Purify and Valgrind. | 484 // Until it is totaly safe, only delete them under Purify and Valgrind. |
485 Task* task = NULL; | 485 Task* task = NULL; |
486 #if defined(PURIFY) || defined(USE_HEAPCHECKER) | 486 #if defined(PURIFY) |
487 task = deferred_non_nestable_work_queue_.front().task; | 487 task = deferred_non_nestable_work_queue_.front().task; |
488 #elif defined(OS_POSIX) | 488 #elif defined(OS_POSIX) |
489 if (RUNNING_ON_VALGRIND) | 489 if (RUNNING_ON_VALGRIND) |
490 task = deferred_non_nestable_work_queue_.front().task; | 490 task = deferred_non_nestable_work_queue_.front().task; |
491 #endif | 491 #endif |
492 deferred_non_nestable_work_queue_.pop(); | 492 deferred_non_nestable_work_queue_.pop(); |
493 if (task) | 493 if (task) |
494 delete task; | 494 delete task; |
495 } | 495 } |
496 did_work |= !delayed_work_queue_.empty(); | 496 did_work |= !delayed_work_queue_.empty(); |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
680 Watcher *delegate) { | 680 Watcher *delegate) { |
681 return pump_libevent()->WatchFileDescriptor( | 681 return pump_libevent()->WatchFileDescriptor( |
682 fd, | 682 fd, |
683 persistent, | 683 persistent, |
684 static_cast<base::MessagePumpLibevent::Mode>(mode), | 684 static_cast<base::MessagePumpLibevent::Mode>(mode), |
685 controller, | 685 controller, |
686 delegate); | 686 delegate); |
687 } | 687 } |
688 | 688 |
689 #endif | 689 #endif |
OLD | NEW |