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