Index: Source/platform/scheduler/Scheduler.h |
diff --git a/Source/platform/scheduler/Scheduler.h b/Source/platform/scheduler/Scheduler.h |
index 9524ec37a34d76596985ea4f2c438e84bb52dbef..4c20d84359748e59c28e785446034ad7acd44d57 100644 |
--- a/Source/platform/scheduler/Scheduler.h |
+++ b/Source/platform/scheduler/Scheduler.h |
@@ -42,6 +42,7 @@ public: |
void postCompositorTask(const TraceLocation&, const Task&); |
void postTask(const TraceLocation&, const Task&); // For generic (low priority) tasks. |
void postIdleTask(const TraceLocation&, const IdleTask&); // For non-critical tasks which may be reordered relative to other task types. |
+ void postIpcTask(const TraceLocation&, const Task&); // For (low priority) tasks posted in response to IPCs |
eseidel
2014/09/10 16:28:09
Are IPCs normally low? I would expect them to be
|
// Returns true if there is high priority work pending on the main thread |
// and the caller should yield to let the scheduler service that work. |
@@ -54,11 +55,19 @@ public: |
void setSharedTimerFireInterval(double); |
void stopSharedTimer(); |
+ // Returns the predicted next compositor start time based on data provided by willBeginFrame. |
+ double nextPredictedCompositorStart(); |
eseidel
2014/09/10 16:28:09
Should this be on the Scheduler directly? Or some
|
+ |
+ // Returns the predicted next compositor deadline time based on data provided by willBeginFrame. |
+ double nextPredictedCompositorDeadline(); |
+ |
private: |
class MainThreadPendingTaskRunner; |
class MainThreadPendingHighPriorityTaskRunner; |
+ class MainThreadPendingLowPriorityTaskRunner; |
friend class MainThreadPendingTaskRunner; |
friend class MainThreadPendingHighPriorityTaskRunner; |
+ friend class MainThreadPendingLowPriorityTaskRunner; |
class TracedTask { |
public: |
@@ -82,8 +91,12 @@ private: |
void tickSharedTimer(); |
bool hasPendingHighPriorityWork() const; |
- bool swapQueuesAndRunPendingTasks(); |
- void swapQueuesRunPendingTasksAndAllowHighPriorityTaskRunnerPosting(); |
+ bool runPendingHighPrioirtyTasks(); |
+ void runPendingHighPriorityTasksAndAllowTaskRunnerPosting(); |
+ void runPendingLowPriorityTasks(); |
+ |
+ // If m_activeLowPrioirtyQueue is null or empty, then reloaded it from m_pendingLowPriorityTasks. |
+ void reloadEmptyLowPrioirtyQueue(); |
// Returns true if any work was done. |
bool executeHighPriorityTasks(Deque<TracedTask>&); |
@@ -91,6 +104,15 @@ private: |
// Must be called while m_pendingTasksMutex is locked. |
void maybePostMainThreadPendingHighPriorityTaskRunner(); |
+ // Must be called while m_pendingTasksMutex is locked. |
eseidel
2014/09/10 16:28:09
Why not just ASSERT that the thread is locked in t
|
+ void maybePostMainThreadPendingLowPriorityTaskRunner(double currentTime); |
+ |
+ // Must be called while m_pendingTasksMutex is locked. |
+ double nextPredictedCompositorStartInternal(double currentTime); |
+ |
+ // Must be called while m_pendingTasksMutex is locked. |
+ double nextPredictedCompositorDeadlineInternal(double currentTime); |
+ |
static Scheduler* s_sharedScheduler; |
// Should only be accessed from the main thread. |
@@ -99,12 +121,23 @@ private: |
// These members can be accessed from any thread. |
WebThread* m_mainThread; |
- // This mutex protects calls to the pending task queue and m_highPriorityTaskRunnerPosted. |
+ // This mutex protects all members of m_mutexProtected. |
Mutex m_pendingTasksMutex; |
- DoubleBufferedDeque<TracedTask> m_pendingHighPriorityTasks; |
+ struct { |
+ DoubleBufferedDeque<TracedTask> m_pendingHighPriorityTasks; |
+ DoubleBufferedDeque<TracedTask> m_pendingLowPriorityTasks; |
+ bool m_highPriorityTaskRunnerPosted; |
+ bool m_lowPriorityTaskRunnerPosted; |
+ } m_mutexProtected; |
eseidel
2014/09/10 16:28:09
I'm not sure this gets you much. We certainly cou
|
+ |
+ double m_compositorStart; |
+ double m_compositorDeadline; |
+ double m_compositorInterval; |
volatile int m_highPriorityTaskCount; |
- bool m_highPriorityTaskRunnerPosted; |
+ Deque<TracedTask>* m_activeLowPrioirtyQueue; |
+ |
+ static const double s_maximumLowPrioirtyTaskExecutionTimeSeconds; |
}; |
} // namespace blink |