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

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

Issue 439923006: Prioritizing input and compositor tasks in the blink scheduler. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: made runPendingTasks private Created 6 years, 4 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/Scheduler.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 c492e580aa17268afe30b6c439a9c08acd08638f..21ba5a6797193b3c8f0d69ee5f37f1ee44315f07 100644
--- a/Source/platform/scheduler/Scheduler.h
+++ b/Source/platform/scheduler/Scheduler.h
@@ -6,8 +6,12 @@
#define Scheduler_h
#include "platform/PlatformExport.h"
+#include "platform/TraceLocation.h"
+#include "public/platform/WebThread.h"
+#include "wtf/Deque.h"
#include "wtf/Functional.h"
#include "wtf/Noncopyable.h"
+#include "wtf/ThreadingPrimitives.h"
namespace blink {
class WebThread;
@@ -53,16 +57,54 @@ private:
Scheduler();
~Scheduler();
- void scheduleTask(const TraceLocation&, const Task&);
void scheduleIdleTask(const IdleTask&);
static void sharedTimerAdapter();
void tickSharedTimer();
static Scheduler* s_sharedScheduler;
- blink::WebThread* m_mainThread;
+ class TracedTask {
+ public:
+ TracedTask(const Task& task, const TraceLocation& location)
+ : m_task(task)
+ , m_location(location) { }
+
+ void run();
+
+ private:
+ Task m_task;
+ TraceLocation m_location;
+ };
+
+ class LockingTracedTaskDeque {
+ public:
+ void append(const TracedTask& value);
+ bool isEmpty();
+
+ // Returns true if a task was executed, false otherwise.
+ bool runFirstTaskIfNotEmpty();
+
+ private:
+ WTF::Deque<TracedTask> m_queue;
+ Mutex m_mutex;
+ };
+
+ class MainThreadPendingTaskRunner;
Sami 2014/08/07 15:51:26 It doesn't look like this declaration is needed?
+
+ // These members can be accessed from any thread.
+ blink::WebThread* m_mainThread;
+ LockingTracedTaskDeque m_pendingInputTasks;
+ LockingTracedTaskDeque m_pendingCompositorTasks;
+ LockingTracedTaskDeque m_pendingLowPriorityTasks;
void (*m_sharedTimerFunction)();
Sami 2014/08/07 15:51:26 This should be separated from the cross-thread fie
+ volatile int m_mainThreadInFlight;
+
+ void maybePostTaskLoopOnMainThread();
Sami 2014/08/07 15:51:26 Looks like these got moved after the data members
+ void runHighPriorityTasks();
+ void runPendingTasks();
+
+ friend class MainThreadPendingTaskRunner;
Sami 2014/08/07 15:51:27 Could you move this right after the private: line?
};
} // namespace blink
« no previous file with comments | « no previous file | Source/platform/scheduler/Scheduler.cpp » ('j') | Source/platform/scheduler/Scheduler.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698