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(); | |
jar (doing other things)
2013/08/22 23:03:39
Note that the "work_queue" is not really the full
Robert Sesek
2013/08/23 16:58:24
Yes, I know the incoming_queue_ is not included in
| |
662 *queue_size = size + delayed_work_queue_.size(); | |
jar (doing other things)
2013/08/22 23:03:39
Why is it interesting to add together pending (rea
Robert Sesek
2013/08/23 16:58:24
Fair point. I did not count this in my initial inv
| |
663 | |
664 if (size == 0) { | |
665 *queueing_delay = TimeDelta(); | |
666 return; | |
667 } | |
668 | |
669 const PendingTask& next_to_run = work_queue_.front(); | |
jar (doing other things)
2013/08/22 23:03:39
The work_queue_ could be empty... so you should te
Robert Sesek
2013/08/23 16:58:24
Already checking size above.
jar (doing other things)
2013/08/27 22:16:55
<doh>... I thought you checked the sum of the size
| |
670 tracked_objects::Duration duration = | |
671 tracked_objects::TrackedTime::Now() - next_to_run.EffectiveTimePosted(); | |
672 *queueing_delay = TimeDelta::FromMilliseconds(duration.InMilliseconds()); | |
673 } | |
674 | |
659 void MessageLoop::DeleteSoonInternal(const tracked_objects::Location& from_here, | 675 void MessageLoop::DeleteSoonInternal(const tracked_objects::Location& from_here, |
660 void(*deleter)(const void*), | 676 void(*deleter)(const void*), |
661 const void* object) { | 677 const void* object) { |
662 PostNonNestableTask(from_here, Bind(deleter, object)); | 678 PostNonNestableTask(from_here, Bind(deleter, object)); |
663 } | 679 } |
664 | 680 |
665 void MessageLoop::ReleaseSoonInternal( | 681 void MessageLoop::ReleaseSoonInternal( |
666 const tracked_objects::Location& from_here, | 682 const tracked_objects::Location& from_here, |
667 void(*releaser)(const void*), | 683 void(*releaser)(const void*), |
668 const void* object) { | 684 const void* object) { |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
745 fd, | 761 fd, |
746 persistent, | 762 persistent, |
747 mode, | 763 mode, |
748 controller, | 764 controller, |
749 delegate); | 765 delegate); |
750 } | 766 } |
751 | 767 |
752 #endif | 768 #endif |
753 | 769 |
754 } // namespace base | 770 } // namespace base |
OLD | NEW |