Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1728)

Unified Diff: Source/platform/scheduler/Scheduler.h

Issue 559973003: Adds the concept of Policies to the Blink Scheduler (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: AAdded a comment Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | Source/platform/scheduler/Scheduler.cpp » ('j') | Source/platform/scheduler/SchedulerTest.cpp » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
+ // 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 {
+ Normal,
+ LowLatency,
eseidel 2014/09/10 16:09:01 What does LowLatency mode mean? Maybe just a comm
+ };
+
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();
+
+ // 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.
+ LatencyMode latencyMode() const;
+
+ // Can be called from any thread.
+ void setLatencyMode(LatencyMode);
+
// 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;
+ double m_lowLatencyModeEndTimeSeconds;
+
+ // The time we should stay in low latency mode for after a touch event.
+ static double s_lowLatencyModeAfterTouchTimeSeconds;
};
} // namespace blink
« no previous file with comments | « no previous file | Source/platform/scheduler/Scheduler.cpp » ('j') | Source/platform/scheduler/SchedulerTest.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698