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 #include <memory> | 8 #include <memory> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
617 PendingTask pending_task = std::move(work_queue_.front()); | 617 PendingTask pending_task = std::move(work_queue_.front()); |
618 work_queue_.pop(); | 618 work_queue_.pop(); |
619 if (!pending_task.delayed_run_time.is_null()) { | 619 if (!pending_task.delayed_run_time.is_null()) { |
620 int sequence_num = pending_task.sequence_num; | 620 int sequence_num = pending_task.sequence_num; |
621 TimeTicks delayed_run_time = pending_task.delayed_run_time; | 621 TimeTicks delayed_run_time = pending_task.delayed_run_time; |
622 AddToDelayedWorkQueue(std::move(pending_task)); | 622 AddToDelayedWorkQueue(std::move(pending_task)); |
623 // If we changed the topmost task, then it is time to reschedule. | 623 // If we changed the topmost task, then it is time to reschedule. |
624 if (delayed_work_queue_.top().sequence_num == sequence_num) | 624 if (delayed_work_queue_.top().sequence_num == sequence_num) |
625 pump_->ScheduleDelayedWork(delayed_run_time); | 625 pump_->ScheduleDelayedWork(delayed_run_time); |
626 } else { | 626 } else { |
627 if (DeferOrRunPendingTask(std::move(pending_task))) | 627 if (DeferOrRunPendingTask(std::move(pending_task))) { |
danakj
2016/07/20 21:37:08
?
gsennton
2016/07/26 14:42:39
Ooops, was changing this code when testing/logging
| |
628 return true; | 628 return true; |
629 } | |
629 } | 630 } |
630 } while (!work_queue_.empty()); | 631 } while (!work_queue_.empty()); |
631 } | 632 } |
632 | 633 |
633 // Nothing happened. | 634 // Nothing happened. |
634 return false; | 635 return false; |
635 } | 636 } |
636 | 637 |
637 bool MessageLoop::DoDelayedWork(TimeTicks* next_delayed_work_time) { | 638 bool MessageLoop::DoDelayedWork(TimeTicks* next_delayed_work_time) { |
638 if (!nestable_tasks_allowed_ || delayed_work_queue_.empty()) { | 639 if (!nestable_tasks_allowed_ || delayed_work_queue_.empty()) { |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
706 // MessageLoopForUI | 707 // MessageLoopForUI |
707 | 708 |
708 MessageLoopForUI::MessageLoopForUI(std::unique_ptr<MessagePump> pump) | 709 MessageLoopForUI::MessageLoopForUI(std::unique_ptr<MessagePump> pump) |
709 : MessageLoop(TYPE_UI, Bind(&ReturnPump, Passed(&pump))) {} | 710 : MessageLoop(TYPE_UI, Bind(&ReturnPump, Passed(&pump))) {} |
710 | 711 |
711 #if defined(OS_ANDROID) | 712 #if defined(OS_ANDROID) |
712 void MessageLoopForUI::Start() { | 713 void MessageLoopForUI::Start() { |
713 // No Histogram support for UI message loop as it is managed by Java side | 714 // No Histogram support for UI message loop as it is managed by Java side |
714 static_cast<MessagePumpForUI*>(pump_.get())->Start(this); | 715 static_cast<MessagePumpForUI*>(pump_.get())->Start(this); |
715 } | 716 } |
717 | |
718 void MessageLoopForUI::Abort() { | |
719 static_cast<MessagePumpForUI*>(pump_.get())->Abort(); | |
720 } | |
716 #endif | 721 #endif |
717 | 722 |
718 #if defined(OS_IOS) | 723 #if defined(OS_IOS) |
719 void MessageLoopForUI::Attach() { | 724 void MessageLoopForUI::Attach() { |
720 static_cast<MessagePumpUIApplication*>(pump_.get())->Attach(this); | 725 static_cast<MessagePumpUIApplication*>(pump_.get())->Attach(this); |
721 } | 726 } |
722 #endif | 727 #endif |
723 | 728 |
724 #if defined(USE_OZONE) || (defined(USE_X11) && !defined(USE_GLIB)) | 729 #if defined(USE_OZONE) || (defined(USE_X11) && !defined(USE_GLIB)) |
725 bool MessageLoopForUI::WatchFileDescriptor( | 730 bool MessageLoopForUI::WatchFileDescriptor( |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
767 persistent, | 772 persistent, |
768 mode, | 773 mode, |
769 controller, | 774 controller, |
770 delegate); | 775 delegate); |
771 } | 776 } |
772 #endif | 777 #endif |
773 | 778 |
774 #endif // !defined(OS_NACL_SFI) | 779 #endif // !defined(OS_NACL_SFI) |
775 | 780 |
776 } // namespace base | 781 } // namespace base |
OLD | NEW |