| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef Scheduler_h | 5 #ifndef Scheduler_h |
| 6 #define Scheduler_h | 6 #define Scheduler_h |
| 7 | 7 |
| 8 #include "platform/PlatformExport.h" | 8 #include "platform/PlatformExport.h" |
| 9 #include "platform/scheduler/TracedTask.h" | 9 #include "platform/scheduler/TracedTask.h" |
| 10 #include "wtf/DoubleBufferedDeque.h" | 10 #include "wtf/DoubleBufferedDeque.h" |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 | 90 |
| 91 // Only does work in CompositorPriority mode. Returns true if any work was d
one. | 91 // Only does work in CompositorPriority mode. Returns true if any work was d
one. |
| 92 bool runPendingHighPriorityTasksIfInCompositorPriority(); | 92 bool runPendingHighPriorityTasksIfInCompositorPriority(); |
| 93 | 93 |
| 94 // Returns true if an idle task was posted to the main thread for execution. | 94 // Returns true if an idle task was posted to the main thread for execution. |
| 95 bool maybePostMainThreadPendingIdleTask(); | 95 bool maybePostMainThreadPendingIdleTask(); |
| 96 | 96 |
| 97 // Only does work if canRunIdleTask. Returns true if any work was done. | 97 // Only does work if canRunIdleTask. Returns true if any work was done. |
| 98 bool maybeRunPendingIdleTask(); | 98 bool maybeRunPendingIdleTask(); |
| 99 | 99 |
| 100 PassOwnPtr<internal::TracedIdleTask> takeFirstPendingIdleTask(); | |
| 101 | |
| 102 // Returns true if the scheduler can run idle tasks at this time. | 100 // Returns true if the scheduler can run idle tasks at this time. |
| 103 bool canRunIdleTask() const; | 101 bool canRunIdleTask() const; |
| 104 | 102 |
| 103 // Flush the incoming idle tasks to the end of the pending idle task queue. |
| 104 void flushIncomingIdleTasks(); |
| 105 |
| 105 // Return the current SchedulerPolicy. | 106 // Return the current SchedulerPolicy. |
| 106 SchedulerPolicy schedulerPolicy() const; | 107 SchedulerPolicy schedulerPolicy() const; |
| 107 | 108 |
| 108 void updatePolicy(); | 109 void updatePolicy(); |
| 109 | 110 |
| 110 void tickSharedTimer(); | 111 void tickSharedTimer(); |
| 111 | 112 |
| 112 void (*m_sharedTimerFunction)(); | 113 void (*m_sharedTimerFunction)(); |
| 113 | 114 |
| 114 // End of main thread only members ------------------------------------- | 115 // End of main thread only members ------------------------------------- |
| 115 | 116 |
| 116 void enterSchedulerPolicyLocked(SchedulerPolicy); | 117 void enterSchedulerPolicyLocked(SchedulerPolicy); |
| 117 void enterSchedulerPolicy(SchedulerPolicy); | 118 void enterSchedulerPolicy(SchedulerPolicy); |
| 118 | 119 |
| 119 static Scheduler* s_sharedScheduler; | 120 static Scheduler* s_sharedScheduler; |
| 120 | 121 |
| 121 WebThread* m_mainThread; | 122 WebThread* m_mainThread; |
| 122 | 123 |
| 123 // This mutex protects calls to the pending idle task queue. | 124 // This mutex protects calls to the incoming idle task queue. |
| 124 Mutex m_pendingIdleTasksMutex; | 125 Mutex m_incomingIdleTasksMutex; |
| 125 Deque<OwnPtr<internal::TracedIdleTask>> m_pendingIdleTasks; | 126 Deque<OwnPtr<internal::TracedIdleTask>> m_incomingIdleTasks; |
| 126 | 127 |
| 127 bool m_currentFrameCommitted; | 128 bool m_currentFrameCommitted; |
| 128 double m_estimatedNextBeginFrameSeconds; | 129 double m_estimatedNextBeginFrameSeconds; |
| 130 Deque<OwnPtr<internal::TracedIdleTask>> m_pendingIdleTasks; |
| 131 |
| 129 // Declared volatile as it is atomically incremented. | 132 // Declared volatile as it is atomically incremented. |
| 130 volatile int m_highPriorityTaskCount; | 133 volatile int m_highPriorityTaskCount; |
| 131 | 134 |
| 132 bool m_highPriorityTaskRunnerPosted; | 135 bool m_highPriorityTaskRunnerPosted; |
| 133 | 136 |
| 134 Mutex m_policyStateMutex; | 137 Mutex m_policyStateMutex; |
| 135 double m_compositorPriorityPolicyEndTimeSeconds; | 138 double m_compositorPriorityPolicyEndTimeSeconds; |
| 136 | 139 |
| 137 // Don't access m_schedulerPolicy directly, use enterSchedulerPolicyLocked a
nd schedulerPolicy instead. | 140 // Don't access m_schedulerPolicy directly, use enterSchedulerPolicyLocked a
nd schedulerPolicy instead. |
| 138 volatile int m_schedulerPolicy; | 141 volatile int m_schedulerPolicy; |
| 139 }; | 142 }; |
| 140 | 143 |
| 141 } // namespace blink | 144 } // namespace blink |
| 142 | 145 |
| 143 #endif // Scheduler_h | 146 #endif // Scheduler_h |
| OLD | NEW |