Chromium Code Reviews| 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 |