| 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 |
| 635 void MessageLoop::DeleteSoonInternal(const tracked_objects::Location& from_here, | 649 void MessageLoop::DeleteSoonInternal(const tracked_objects::Location& from_here, |
| 636 void(*deleter)(const void*), | 650 void(*deleter)(const void*), |
| 637 const void* object) { | 651 const void* object) { |
| 638 PostNonNestableTask(from_here, Bind(deleter, object)); | 652 PostNonNestableTask(from_here, Bind(deleter, object)); |
| 639 } | 653 } |
| 640 | 654 |
| 641 void MessageLoop::ReleaseSoonInternal( | 655 void MessageLoop::ReleaseSoonInternal( |
| 642 const tracked_objects::Location& from_here, | 656 const tracked_objects::Location& from_here, |
| 643 void(*releaser)(const void*), | 657 void(*releaser)(const void*), |
| 644 const void* object) { | 658 const void* object) { |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 727 persistent, | 741 persistent, |
| 728 mode, | 742 mode, |
| 729 controller, | 743 controller, |
| 730 delegate); | 744 delegate); |
| 731 } | 745 } |
| 732 #endif | 746 #endif |
| 733 | 747 |
| 734 #endif // !defined(OS_NACL) | 748 #endif // !defined(OS_NACL) |
| 735 | 749 |
| 736 } // namespace base | 750 } // namespace base |
| OLD | NEW |