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 642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
653 bool MessageLoop::DoIdleWork() { | 653 bool MessageLoop::DoIdleWork() { |
654 if (ProcessNextDelayedNonNestableTask()) | 654 if (ProcessNextDelayedNonNestableTask()) |
655 return true; | 655 return true; |
656 | 656 |
657 if (run_loop_->quit_when_idle_received_) | 657 if (run_loop_->quit_when_idle_received_) |
658 pump_->Quit(); | 658 pump_->Quit(); |
659 | 659 |
660 return false; | 660 return false; |
661 } | 661 } |
662 | 662 |
| 663 void MessageLoop::GetQueueingInformation(size_t* queue_size, |
| 664 TimeDelta* queueing_delay) { |
| 665 *queue_size = work_queue_.size(); |
| 666 if (*queue_size == 0) { |
| 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 |
663 void MessageLoop::DeleteSoonInternal(const tracked_objects::Location& from_here, | 677 void MessageLoop::DeleteSoonInternal(const tracked_objects::Location& from_here, |
664 void(*deleter)(const void*), | 678 void(*deleter)(const void*), |
665 const void* object) { | 679 const void* object) { |
666 PostNonNestableTask(from_here, Bind(deleter, object)); | 680 PostNonNestableTask(from_here, Bind(deleter, object)); |
667 } | 681 } |
668 | 682 |
669 void MessageLoop::ReleaseSoonInternal( | 683 void MessageLoop::ReleaseSoonInternal( |
670 const tracked_objects::Location& from_here, | 684 const tracked_objects::Location& from_here, |
671 void(*releaser)(const void*), | 685 void(*releaser)(const void*), |
672 const void* object) { | 686 const void* object) { |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
749 fd, | 763 fd, |
750 persistent, | 764 persistent, |
751 mode, | 765 mode, |
752 controller, | 766 controller, |
753 delegate); | 767 delegate); |
754 } | 768 } |
755 | 769 |
756 #endif | 770 #endif |
757 | 771 |
758 } // namespace base | 772 } // namespace base |
OLD | NEW |