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 638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
649 bool MessageLoop::DoIdleWork() { | 649 bool MessageLoop::DoIdleWork() { |
650 if (ProcessNextDelayedNonNestableTask()) | 650 if (ProcessNextDelayedNonNestableTask()) |
651 return true; | 651 return true; |
652 | 652 |
653 if (run_loop_->quit_when_idle_received_) | 653 if (run_loop_->quit_when_idle_received_) |
654 pump_->Quit(); | 654 pump_->Quit(); |
655 | 655 |
656 return false; | 656 return false; |
657 } | 657 } |
658 | 658 |
659 void MessageLoop::GetQueueingInformation(size_t* queue_size, | |
660 TimeDelta* queueing_delay) { | |
661 size_t size = work_queue_.size(); | |
662 if (queue_size) | |
Mark Mentovai
2013/08/22 18:00:12
Since nobody needs to call this with NULL argument
Robert Sesek
2013/08/22 19:12:21
Done.
| |
663 *queue_size = size + delayed_work_queue_.size(); | |
664 | |
665 if (size == 0 || !queueing_delay) { | |
666 if (queueing_delay) | |
667 *queueing_delay = TimeDelta(); | |
668 return; | |
669 } | |
670 | |
671 const PendingTask& next_to_run = work_queue_.front(); | |
672 tracked_objects::Duration duration = | |
673 tracked_objects::TrackedTime::Now() - next_to_run.EffectiveTimePosted(); | |
674 *queueing_delay = TimeDelta::FromMilliseconds(duration.InMilliseconds()); | |
675 } | |
676 | |
659 void MessageLoop::DeleteSoonInternal(const tracked_objects::Location& from_here, | 677 void MessageLoop::DeleteSoonInternal(const tracked_objects::Location& from_here, |
660 void(*deleter)(const void*), | 678 void(*deleter)(const void*), |
661 const void* object) { | 679 const void* object) { |
662 PostNonNestableTask(from_here, Bind(deleter, object)); | 680 PostNonNestableTask(from_here, Bind(deleter, object)); |
663 } | 681 } |
664 | 682 |
665 void MessageLoop::ReleaseSoonInternal( | 683 void MessageLoop::ReleaseSoonInternal( |
666 const tracked_objects::Location& from_here, | 684 const tracked_objects::Location& from_here, |
667 void(*releaser)(const void*), | 685 void(*releaser)(const void*), |
668 const void* object) { | 686 const void* object) { |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
745 fd, | 763 fd, |
746 persistent, | 764 persistent, |
747 mode, | 765 mode, |
748 controller, | 766 controller, |
749 delegate); | 767 delegate); |
750 } | 768 } |
751 | 769 |
752 #endif | 770 #endif |
753 | 771 |
754 } // namespace base | 772 } // namespace base |
OLD | NEW |