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

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: Un deleted something I didn't intend to delete 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..1fb0445baee87426a6545b0f254f4964af18c58a 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;
@@ -49,20 +53,66 @@ public:
void setSharedTimerFireInterval(double);
void stopSharedTimer();
+ void runPendingTasks();
Sami 2014/08/07 14:24:45 This one doesn't need to be public, does it?
+
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(Task task, TraceLocation location)
Sami 2014/08/07 14:24:45 const Task& and const TraceLocation&
alexclarke 2014/08/07 15:15:29 Done.
+ : m_task(task)
+ , m_location(location) { }
+
+ void run();
+
+ private:
+ Task m_task;
+ TraceLocation m_location;
+ };
+
+ class LockingTracedTaskDeque {
+ public:
+ void append(const TracedTask& value)
+ {
+ Locker<Mutex> lock(m_mutex);
+ m_queue.append(value);
+ }
+
+ bool isEmpty()
Sami 2014/08/07 14:24:45 Could we somehow combine isEmpty() and takeFirst()
alexclarke 2014/08/07 15:15:29 Done.
+ {
+ Locker<Mutex> lock(m_mutex);
+ return m_queue.isEmpty();
+ }
+
+ TracedTask takeFirst()
+ {
+ Locker<Mutex> lock(m_mutex);
+ return m_queue.takeFirst();
+ }
+
+ private:
+ WTF::Deque<TracedTask> m_queue;
+ Mutex m_mutex;
+ };
+
+ // 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 14:24:45 This member should only be used on the main thread
+
+ void maybePostTaskLoopOnMainThread();
Sami 2014/08/07 14:24:45 Could you move these two before the data member de
+ void runHighPriorityTasks();
};
} // 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