Index: Source/platform/scheduler/Scheduler.h |
diff --git a/Source/platform/scheduler/Scheduler.h b/Source/platform/scheduler/Scheduler.h |
index 9524ec37a34d76596985ea4f2c438e84bb52dbef..ead89bf3286a1c662b6b980ad84f09991cf30bad 100644 |
--- a/Source/platform/scheduler/Scheduler.h |
+++ b/Source/platform/scheduler/Scheduler.h |
@@ -43,8 +43,8 @@ public: |
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. |
- // 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. |
+ // Returns true if we're in low latency mode and there is high priority work pending on the |
Sami
2014/09/10 16:00:38
It feels like we don't need to mention the fact th
alexclarke
2014/09/10 17:35:37
Done.
|
+ // main thread and the caller should yield to let the scheduler service that work. |
// Can be called on any thread. |
bool shouldYieldForHighPriorityWork() const; |
@@ -60,6 +60,11 @@ private: |
friend class MainThreadPendingTaskRunner; |
friend class MainThreadPendingHighPriorityTaskRunner; |
+ enum LatencyMode { |
Sami
2014/09/10 16:00:38
Unfortunately the word latency is used for various
|
+ Normal, |
+ LowLatency, |
+ }; |
+ |
class TracedTask { |
public: |
TracedTask(const Task& task, const TraceLocation& location) |
@@ -82,6 +87,11 @@ private: |
void tickSharedTimer(); |
bool hasPendingHighPriorityWork() const; |
+ |
+ // Only does work in low latency mode. Returns true if any work was done. |
+ bool runPendingHighPrioirtyTasksIfInLowLatencyMode(); |
Sami
2014/09/10 16:00:38
s/Prioirty/Priority/
alexclarke
2014/09/10 17:35:37
Done.
|
+ |
+ // Returns true if any work was done. |
bool swapQueuesAndRunPendingTasks(); |
void swapQueuesRunPendingTasksAndAllowHighPriorityTaskRunnerPosting(); |
@@ -96,6 +106,12 @@ private: |
// Should only be accessed from the main thread. |
void (*m_sharedTimerFunction)(); |
+ // Should only be accessed from the main thread. |
Sami
2014/09/10 16:00:38
Could you group the thread-specific members next t
alexclarke
2014/09/10 17:35:37
Done.
|
+ LatencyMode latencyMode() const; |
+ |
+ // Can be called from any thread. |
+ void setLatencyMode(LatencyMode); |
Sami
2014/09/10 16:00:38
Maybe call this |enter| instead of |set| to distin
alexclarke
2014/09/10 17:35:37
Done.
|
+ |
// These members can be accessed from any thread. |
WebThread* m_mainThread; |
@@ -105,6 +121,12 @@ private: |
volatile int m_highPriorityTaskCount; |
bool m_highPriorityTaskRunnerPosted; |
+ |
+ volatile int m_latencyMode; |
Sami
2014/09/10 16:00:38
Can we make this type safe?
I wonder if we should
alexclarke
2014/09/10 17:35:37
Well it's not supposed to be accessed directly. I
|
+ double m_lowLatencyModeEndTimeSeconds; |
+ |
+ // The time we should stay in low latency mode for after a touch event. |
+ static double s_lowLatencyModeAfterTouchTimeSeconds; |
Sami
2014/09/10 16:00:38
This is constant right? I'd just move it to the an
alexclarke
2014/09/10 17:35:37
Done.
|
}; |
} // namespace blink |