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 #include "config.h" | 5 #include "config.h" |
6 #include "platform/scheduler/Scheduler.h" | 6 #include "platform/scheduler/Scheduler.h" |
7 | 7 |
8 #include "platform/TraceLocation.h" | 8 #include "platform/TraceLocation.h" |
9 #include "public/platform/Platform.h" | 9 #include "public/platform/Platform.h" |
10 #include "public/platform/WebScheduler.h" | 10 #include "public/platform/WebScheduler.h" |
11 #include "public/platform/WebTraceLocation.h" | 11 #include "public/platform/WebTraceLocation.h" |
12 | 12 |
13 namespace blink { | 13 namespace blink { |
14 | 14 |
15 class IdleTaskRunner : public WebScheduler::IdleTask { | 15 class IdleTaskRunner : public WebScheduler::IdleTask { |
| 16 WTF_MAKE_NONCOPYABLE(IdleTaskRunner); |
16 public: | 17 public: |
17 explicit IdleTaskRunner(PassOwnPtr<Scheduler::IdleTask> task) | 18 explicit IdleTaskRunner(PassOwnPtr<Scheduler::IdleTask> task) : m_task(task) |
18 : m_task(task) | |
19 { | 19 { |
20 } | 20 } |
21 | 21 |
22 virtual ~IdleTaskRunner() | 22 ~IdleTaskRunner() override |
23 { | 23 { |
24 } | 24 } |
25 | 25 |
26 // WebScheduler::IdleTask implementation. | 26 // WebScheduler::IdleTask implementation. |
27 void run(double deadlineSeconds) override | 27 void run(double deadlineSeconds) override |
28 { | 28 { |
29 (*m_task)(deadlineSeconds); | 29 (*m_task)(deadlineSeconds); |
30 } | 30 } |
31 private: | 31 private: |
32 OwnPtr<Scheduler::IdleTask> m_task; | 32 OwnPtr<Scheduler::IdleTask> m_task; |
(...skipping 24 matching lines...) Expand all Loading... |
57 if (m_webScheduler) | 57 if (m_webScheduler) |
58 m_webScheduler->shutdown(); | 58 m_webScheduler->shutdown(); |
59 } | 59 } |
60 | 60 |
61 void Scheduler::postIdleTask(const TraceLocation& location, PassOwnPtr<IdleTask>
idleTask) | 61 void Scheduler::postIdleTask(const TraceLocation& location, PassOwnPtr<IdleTask>
idleTask) |
62 { | 62 { |
63 if (m_webScheduler) | 63 if (m_webScheduler) |
64 m_webScheduler->postIdleTask(WebTraceLocation(location), new IdleTaskRun
ner(idleTask)); | 64 m_webScheduler->postIdleTask(WebTraceLocation(location), new IdleTaskRun
ner(idleTask)); |
65 } | 65 } |
66 | 66 |
| 67 void Scheduler::postLoadingTask(const TraceLocation& location, WebThread::Task*
task) |
| 68 { |
| 69 if (m_webScheduler) |
| 70 m_webScheduler->postLoadingTask(WebTraceLocation(location), task); |
| 71 } |
| 72 |
67 bool Scheduler::shouldYieldForHighPriorityWork() const | 73 bool Scheduler::shouldYieldForHighPriorityWork() const |
68 { | 74 { |
69 if (m_webScheduler) | 75 if (m_webScheduler) |
70 return m_webScheduler->shouldYieldForHighPriorityWork(); | 76 return m_webScheduler->shouldYieldForHighPriorityWork(); |
71 return false; | 77 return false; |
72 } | 78 } |
73 | 79 |
74 } // namespace blink | 80 } // namespace blink |
OLD | NEW |