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

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

Issue 540373002: Add support for Low Priorirty tasks. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Maybe fix linker issue 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 | « Source/platform/exported/WebSchedulerProxy.cpp ('k') | Source/platform/scheduler/Scheduler.cpp » ('j') | no next file with comments »
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..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
« no previous file with comments | « Source/platform/exported/WebSchedulerProxy.cpp ('k') | Source/platform/scheduler/Scheduler.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698