OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/message_loop.h" | 5 #include "base/message_loop/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 614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
625 bool MessageLoop::DoIdleWork() { | 625 bool MessageLoop::DoIdleWork() { |
626 if (ProcessNextDelayedNonNestableTask()) | 626 if (ProcessNextDelayedNonNestableTask()) |
627 return true; | 627 return true; |
628 | 628 |
629 if (run_loop_->quit_when_idle_received_) | 629 if (run_loop_->quit_when_idle_received_) |
630 pump_->Quit(); | 630 pump_->Quit(); |
631 | 631 |
632 return false; | 632 return false; |
633 } | 633 } |
634 | 634 |
635 void MessageLoop::GetQueueingInformation(size_t* queue_size, | |
636 TimeDelta* queueing_delay) { | |
637 *queue_size = work_queue_.size(); | |
638 if (*queue_size == 0) { | |
639 *queueing_delay = TimeDelta(); | |
640 return; | |
641 } | |
642 | |
643 const PendingTask& next_to_run = work_queue_.front(); | |
644 tracked_objects::Duration duration = | |
645 tracked_objects::TrackedTime::Now() - next_to_run.EffectiveTimePosted(); | |
646 *queueing_delay = TimeDelta::FromMilliseconds(duration.InMilliseconds()); | |
647 } | |
648 | |
649 void MessageLoop::DeleteSoonInternal(const tracked_objects::Location& from_here, | 635 void MessageLoop::DeleteSoonInternal(const tracked_objects::Location& from_here, |
650 void(*deleter)(const void*), | 636 void(*deleter)(const void*), |
651 const void* object) { | 637 const void* object) { |
652 PostNonNestableTask(from_here, Bind(deleter, object)); | 638 PostNonNestableTask(from_here, Bind(deleter, object)); |
653 } | 639 } |
654 | 640 |
655 void MessageLoop::ReleaseSoonInternal( | 641 void MessageLoop::ReleaseSoonInternal( |
656 const tracked_objects::Location& from_here, | 642 const tracked_objects::Location& from_here, |
657 void(*releaser)(const void*), | 643 void(*releaser)(const void*), |
658 const void* object) { | 644 const void* object) { |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
741 persistent, | 727 persistent, |
742 mode, | 728 mode, |
743 controller, | 729 controller, |
744 delegate); | 730 delegate); |
745 } | 731 } |
746 #endif | 732 #endif |
747 | 733 |
748 #endif // !defined(OS_NACL) | 734 #endif // !defined(OS_NACL) |
749 | 735 |
750 } // namespace base | 736 } // namespace base |
OLD | NEW |