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 "content/common/content_export.h" | 11 #include "content/common/content_export.h" |
12 #include "third_party/WebKit/public/platform/WebScheduler.h" | 12 #include "third_party/WebKit/public/platform/WebScheduler.h" |
13 #include "third_party/WebKit/public/platform/WebThread.h" | 13 #include "third_party/WebKit/public/platform/WebThread.h" |
14 | 14 |
| 15 namespace base { |
| 16 class SingleThreadTaskRunner; |
| 17 } |
| 18 |
15 namespace content { | 19 namespace content { |
16 | 20 |
17 class RendererScheduler; | 21 class RendererScheduler; |
18 class SingleThreadIdleTaskRunner; | 22 class SingleThreadIdleTaskRunner; |
19 | 23 |
20 class CONTENT_EXPORT WebSchedulerImpl : public blink::WebScheduler { | 24 class CONTENT_EXPORT WebSchedulerImpl : public blink::WebScheduler { |
21 public: | 25 public: |
22 WebSchedulerImpl(RendererScheduler* renderer_scheduler); | 26 WebSchedulerImpl(RendererScheduler* renderer_scheduler); |
23 ~WebSchedulerImpl() override; | 27 ~WebSchedulerImpl() override; |
24 | 28 |
25 virtual bool shouldYieldForHighPriorityWork(); | 29 virtual bool shouldYieldForHighPriorityWork(); |
26 virtual void postIdleTask(const blink::WebTraceLocation& location, | 30 virtual void postIdleTask(const blink::WebTraceLocation& location, |
27 blink::WebScheduler::IdleTask* task); | 31 blink::WebScheduler::IdleTask* task); |
28 virtual void postLoadingTask(const blink::WebTraceLocation& location, | 32 virtual void postLoadingTask(const blink::WebTraceLocation& location, |
29 blink::WebThread::Task* task); | 33 blink::WebThread::Task* task); |
30 virtual void shutdown(); | 34 virtual void shutdown(); |
31 | 35 |
32 private: | 36 private: |
33 static void runIdleTask(scoped_ptr<blink::WebScheduler::IdleTask> task, | 37 static void runIdleTask(scoped_ptr<blink::WebScheduler::IdleTask> task, |
34 base::TimeTicks deadline); | 38 base::TimeTicks deadline); |
35 static void runTask(scoped_ptr<blink::WebThread::Task> task); | 39 static void runTask(scoped_ptr<blink::WebThread::Task> task); |
36 | 40 |
37 RendererScheduler* renderer_scheduler_; | 41 RendererScheduler* renderer_scheduler_; |
38 scoped_refptr<SingleThreadIdleTaskRunner> idle_task_runner_; | 42 scoped_refptr<SingleThreadIdleTaskRunner> idle_task_runner_; |
| 43 scoped_refptr<base::SingleThreadTaskRunner> loading_task_runner_; |
39 }; | 44 }; |
40 | 45 |
41 } // namespace content | 46 } // namespace content |
42 | 47 |
43 #endif // CONTENT_RENDERER_SCHEDULER_WEB_SCHEDULER_IMPL_H_ | 48 #endif // CONTENT_RENDERER_SCHEDULER_WEB_SCHEDULER_IMPL_H_ |
OLD | NEW |