Chromium Code Reviews| Index: Source/platform/scheduler/Scheduler.h |
| diff --git a/Source/platform/scheduler/Scheduler.h b/Source/platform/scheduler/Scheduler.h |
| index 9524ec37a34d76596985ea4f2c438e84bb52dbef..11676e904fbc6fde6c6f7423c522bf7bb8fefbc1 100644 |
| --- a/Source/platform/scheduler/Scheduler.h |
| +++ b/Source/platform/scheduler/Scheduler.h |
| @@ -54,12 +54,17 @@ public: |
| void setSharedTimerFireInterval(double); |
| void stopSharedTimer(); |
| -private: |
| +protected: |
| class MainThreadPendingTaskRunner; |
| class MainThreadPendingHighPriorityTaskRunner; |
| friend class MainThreadPendingTaskRunner; |
| friend class MainThreadPendingHighPriorityTaskRunner; |
| + enum SchedulerPolicy { |
| + Normal, |
| + CompositorPriority, |
| + }; |
| + |
| class TracedTask { |
| public: |
| TracedTask(const Task& task, const TraceLocation& location) |
| @@ -74,29 +79,47 @@ private: |
| }; |
| Scheduler(); |
| - ~Scheduler(); |
| - |
| - void scheduleIdleTask(const TraceLocation&, const IdleTask&); |
| + virtual ~Scheduler(); |
| static void sharedTimerAdapter(); |
| - void tickSharedTimer(); |
| - bool hasPendingHighPriorityWork() const; |
| + |
| + // Start of main thread only members ----------------------------------- |
| + |
| + // Only does work in CompositorPriority mode. Returns true if any work was done. |
| + bool runPendingHighPriorityTasksIfInCompositorPriority(); |
| + |
| + // Returns true if any work was done. |
| bool swapQueuesAndRunPendingTasks(); |
| + |
| void swapQueuesRunPendingTasksAndAllowHighPriorityTaskRunnerPosting(); |
| // Returns true if any work was done. |
| bool executeHighPriorityTasks(Deque<TracedTask>&); |
| + // Return the current SchedulerPolicy. |
| + SchedulerPolicy schedulerPolicy() const; |
| + |
| + void maybeEnterNormalschedulerPolicy(); |
|
Sami
2014/09/11 11:32:18
Please capitalize "scheduler" here.
|
| + |
| // Must be called while m_pendingTasksMutex is locked. |
| void maybePostMainThreadPendingHighPriorityTaskRunner(); |
| - static Scheduler* s_sharedScheduler; |
| + void tickSharedTimer(); |
| - // Should only be accessed from the main thread. |
| void (*m_sharedTimerFunction)(); |
| - // These members can be accessed from any thread. |
| + // End of main thread only members ------------------------------------- |
| + |
| + |
| + void scheduleIdleTask(const TraceLocation&, const IdleTask&); |
| + |
| + bool hasPendingHighPriorityWork() const; |
| + |
| + void enterSchedulerPolicy(SchedulerPolicy); |
| + |
| + static Scheduler* s_sharedScheduler; |
| + |
| WebThread* m_mainThread; |
| // This mutex protects calls to the pending task queue and m_highPriorityTaskRunnerPosted. |
| @@ -105,6 +128,10 @@ private: |
| volatile int m_highPriorityTaskCount; |
| bool m_highPriorityTaskRunnerPosted; |
| + |
| + // Don't access m_schedulerPolicy directly, use enterSchedulerPolicy and SchedulerPolicy instead. |
| + volatile int m_schedulerPolicy; |
| + double m_compositorPriorityPolicyEndTimeSeconds; |
|
Sami
2014/09/11 11:32:18
This is protected by m_pendingTasksMutex, right? C
|
| }; |
| } // namespace blink |