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 *queue_size = work_queue_.size(); |
| 662 if (*queue_size == 0) { |
| 663 *queueing_delay = TimeDelta(); |
| 664 return; |
| 665 } |
| 666 |
| 667 const PendingTask& next_to_run = work_queue_.front(); |
| 668 tracked_objects::Duration duration = |
| 669 tracked_objects::TrackedTime::Now() - next_to_run.EffectiveTimePosted(); |
| 670 *queueing_delay = TimeDelta::FromMilliseconds(duration.InMilliseconds()); |
| 671 } |
| 672 |
659 void MessageLoop::DeleteSoonInternal(const tracked_objects::Location& from_here, | 673 void MessageLoop::DeleteSoonInternal(const tracked_objects::Location& from_here, |
660 void(*deleter)(const void*), | 674 void(*deleter)(const void*), |
661 const void* object) { | 675 const void* object) { |
662 PostNonNestableTask(from_here, Bind(deleter, object)); | 676 PostNonNestableTask(from_here, Bind(deleter, object)); |
663 } | 677 } |
664 | 678 |
665 void MessageLoop::ReleaseSoonInternal( | 679 void MessageLoop::ReleaseSoonInternal( |
666 const tracked_objects::Location& from_here, | 680 const tracked_objects::Location& from_here, |
667 void(*releaser)(const void*), | 681 void(*releaser)(const void*), |
668 const void* object) { | 682 const void* object) { |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
745 fd, | 759 fd, |
746 persistent, | 760 persistent, |
747 mode, | 761 mode, |
748 controller, | 762 controller, |
749 delegate); | 763 delegate); |
750 } | 764 } |
751 | 765 |
752 #endif | 766 #endif |
753 | 767 |
754 } // namespace base | 768 } // namespace base |
OLD | NEW |