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..55556005d83d519a0968c6a18458caa140637172 100644 |
| --- a/Source/platform/scheduler/Scheduler.h |
| +++ b/Source/platform/scheduler/Scheduler.h |
| @@ -6,8 +6,11 @@ |
| #define Scheduler_h |
| #include "platform/PlatformExport.h" |
| +#include "platform/TraceLocation.h" |
| +#include "platform/scheduler/DoubleBufferedDeque.h" |
| #include "wtf/Functional.h" |
| #include "wtf/Noncopyable.h" |
| +#include "wtf/ThreadingPrimitives.h" |
| namespace blink { |
| class WebThread; |
| @@ -40,7 +43,7 @@ public: |
| // 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. |
| - // Can be called on the main thread. |
| + // Can be called on any thread. |
| bool shouldYieldForHighPriorityWork(); |
| // The shared timer can be used to schedule a periodic callback which may |
| @@ -53,16 +56,40 @@ 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; |
| + }; |
| + |
| + // These members can be accessed from any thread. |
| + blink::WebThread* m_mainThread; |
| + DoubleBufferedDeque<TracedTask> m_pendingInputTasks; |
| + DoubleBufferedDeque<TracedTask> m_pendingCompositorTasks; |
| void (*m_sharedTimerFunction)(); |
| + volatile int m_mainThreadTaskRunnerCount; |
| + |
| + void maybePostMainThreadPendingHighPriorityTaskRunner(); |
|
Sami
2014/08/08 15:31:13
Can you move these up before the data members?
alexclarke
2014/08/08 15:47:46
Done.
|
| + void runHighPriorityTasks(); |
| + |
| + class MainThreadPendingTaskRunner; |
|
Sami
2014/08/08 15:31:13
These should also go right after the private: labe
alexclarke
2014/08/08 15:47:46
Done.
|
| + class MainThreadPendingHighPriorityTaskRunner; |
| + friend class MainThreadPendingTaskRunner; |
| + friend class MainThreadPendingHighPriorityTaskRunner; |
| }; |
| } // namespace blink |