| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CONTENT_RENDERER_SCHEDULER_WEB_SCHEDULER_IMPL_H_ | 5 #ifndef CONTENT_RENDERER_SCHEDULER_WEB_SCHEDULER_IMPL_H_ |
| 6 #define CONTENT_RENDERER_SCHEDULER_WEB_SCHEDULER_IMPL_H_ | 6 #define CONTENT_RENDERER_SCHEDULER_WEB_SCHEDULER_IMPL_H_ |
| 7 | 7 |
| 8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
| 11 #include "third_party/WebKit/public/platform/WebScheduler.h" | 11 #include "third_party/WebKit/public/platform/WebScheduler.h" |
| 12 #include "third_party/WebKit/public/platform/WebThread.h" |
| 12 | 13 |
| 13 namespace content { | 14 namespace content { |
| 14 | 15 |
| 15 class RendererScheduler; | 16 class RendererScheduler; |
| 16 class SingleThreadIdleTaskRunner; | 17 class SingleThreadIdleTaskRunner; |
| 17 | 18 |
| 18 class WebSchedulerImpl : public blink::WebScheduler { | 19 class WebSchedulerImpl : public blink::WebScheduler { |
| 19 public: | 20 public: |
| 20 WebSchedulerImpl(RendererScheduler* renderer_scheduler); | 21 WebSchedulerImpl(RendererScheduler* renderer_scheduler); |
| 21 ~WebSchedulerImpl() override; | 22 ~WebSchedulerImpl() override; |
| 22 | 23 |
| 23 virtual bool shouldYieldForHighPriorityWork(); | 24 virtual bool shouldYieldForHighPriorityWork(); |
| 24 virtual void postIdleTask(const blink::WebTraceLocation& location, | 25 virtual void postIdleTask(const blink::WebTraceLocation& location, |
| 25 blink::WebScheduler::IdleTask* task); | 26 blink::WebScheduler::IdleTask* task); |
| 27 virtual void postLoadingTask(const blink::WebTraceLocation& location, |
| 28 blink::WebThread::Task* task); |
| 26 virtual void shutdown(); | 29 virtual void shutdown(); |
| 27 | 30 |
| 28 private: | 31 private: |
| 29 static void runIdleTask(scoped_ptr<blink::WebScheduler::IdleTask> task, | 32 static void runIdleTask(scoped_ptr<blink::WebScheduler::IdleTask> task, |
| 30 base::TimeTicks deadline); | 33 base::TimeTicks deadline); |
| 34 static void runTask(scoped_ptr<blink::WebThread::Task> task); |
| 31 | 35 |
| 32 RendererScheduler* renderer_scheduler_; | 36 RendererScheduler* renderer_scheduler_; |
| 33 scoped_refptr<SingleThreadIdleTaskRunner> idle_task_runner_; | 37 scoped_refptr<SingleThreadIdleTaskRunner> idle_task_runner_; |
| 34 }; | 38 }; |
| 35 | 39 |
| 36 } // namespace content | 40 } // namespace content |
| 37 | 41 |
| 38 #endif // CONTENT_RENDERER_SCHEDULER_WEB_SCHEDULER_IMPL_H_ | 42 #endif // CONTENT_RENDERER_SCHEDULER_WEB_SCHEDULER_IMPL_H_ |
| OLD | NEW |