| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "platform/scheduler/base/task_queue_impl.h" | 5 #include "platform/scheduler/base/task_queue_impl.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include <iostream> // FIXME |
| 10 |
| 9 #include "base/format_macros.h" | 11 #include "base/format_macros.h" |
| 10 #include "base/memory/ptr_util.h" | 12 #include "base/memory/ptr_util.h" |
| 11 #include "base/strings/stringprintf.h" | 13 #include "base/strings/stringprintf.h" |
| 12 #include "base/time/time.h" | 14 #include "base/time/time.h" |
| 13 #include "base/trace_event/blame_context.h" | 15 #include "base/trace_event/blame_context.h" |
| 14 #include "platform/scheduler/base/task_queue_manager.h" | 16 #include "platform/scheduler/base/task_queue_manager.h" |
| 15 #include "platform/scheduler/base/task_queue_manager_delegate.h" | 17 #include "platform/scheduler/base/task_queue_manager_delegate.h" |
| 16 #include "platform/scheduler/base/time_domain.h" | 18 #include "platform/scheduler/base/time_domain.h" |
| 17 #include "platform/scheduler/base/work_queue.h" | 19 #include "platform/scheduler/base/work_queue.h" |
| 18 | 20 |
| (...skipping 670 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 689 } | 691 } |
| 690 | 692 |
| 691 base::AutoLock lock(immediate_incoming_queue_lock_); | 693 base::AutoLock lock(immediate_incoming_queue_lock_); |
| 692 if (immediate_incoming_queue().empty()) | 694 if (immediate_incoming_queue().empty()) |
| 693 return true; | 695 return true; |
| 694 | 696 |
| 695 return immediate_incoming_queue().front().enqueue_order() > | 697 return immediate_incoming_queue().front().enqueue_order() > |
| 696 main_thread_only().current_fence; | 698 main_thread_only().current_fence; |
| 697 } | 699 } |
| 698 | 700 |
| 701 bool TaskQueueImpl::HasFence() const { |
| 702 return !!main_thread_only().current_fence; |
| 703 } |
| 704 |
| 699 bool TaskQueueImpl::CouldTaskRun(EnqueueOrder enqueue_order) const { | 705 bool TaskQueueImpl::CouldTaskRun(EnqueueOrder enqueue_order) const { |
| 700 if (!IsQueueEnabled()) | 706 if (!IsQueueEnabled()) |
| 701 return false; | 707 return false; |
| 702 | 708 |
| 703 if (!main_thread_only().current_fence) | 709 if (!main_thread_only().current_fence) |
| 704 return true; | 710 return true; |
| 705 | 711 |
| 706 return enqueue_order < main_thread_only().current_fence; | 712 return enqueue_order < main_thread_only().current_fence; |
| 707 } | 713 } |
| 708 | 714 |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 903 } | 909 } |
| 904 | 910 |
| 905 void TaskQueueImpl::NotifyWakeUpChangedOnMainThread(base::TimeTicks wake_up) { | 911 void TaskQueueImpl::NotifyWakeUpChangedOnMainThread(base::TimeTicks wake_up) { |
| 906 if (main_thread_only().observer) | 912 if (main_thread_only().observer) |
| 907 main_thread_only().observer->OnQueueNextWakeUpChanged(this, wake_up); | 913 main_thread_only().observer->OnQueueNextWakeUpChanged(this, wake_up); |
| 908 } | 914 } |
| 909 | 915 |
| 910 } // namespace internal | 916 } // namespace internal |
| 911 } // namespace scheduler | 917 } // namespace scheduler |
| 912 } // namespace blink | 918 } // namespace blink |
| OLD | NEW |