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 "public/platform/Platform.h" | 8 #include "public/platform/Platform.h" |
9 #include "public/platform/WebScheduler.h" | 9 #include "public/platform/WebScheduler.h" |
10 #include "public/platform/WebTraceLocation.h" | 10 #include "public/platform/WebTraceLocation.h" |
| 11 #include "wtf/MainThread.h" |
11 | 12 |
12 namespace blink { | 13 namespace blink { |
13 | 14 |
14 class IdleTaskRunner : public WebThread::IdleTask { | 15 class IdleTaskRunner : public WebThread::IdleTask { |
15 WTF_MAKE_NONCOPYABLE(IdleTaskRunner); | 16 WTF_MAKE_NONCOPYABLE(IdleTaskRunner); |
16 | 17 |
17 public: | 18 public: |
18 explicit IdleTaskRunner(PassOwnPtr<Scheduler::IdleTask> task) | 19 explicit IdleTaskRunner(PassOwnPtr<Scheduler::IdleTask> task) |
19 : m_task(task) | 20 : m_task(task) |
20 { | 21 { |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 if (m_webScheduler) | 80 if (m_webScheduler) |
80 m_webScheduler->postIdleTaskAfterWakeup(location, new IdleTaskRunner(idl
eTask)); | 81 m_webScheduler->postIdleTaskAfterWakeup(location, new IdleTaskRunner(idl
eTask)); |
81 } | 82 } |
82 | 83 |
83 void Scheduler::postLoadingTask(const WebTraceLocation& location, WebThread::Tas
k* task) | 84 void Scheduler::postLoadingTask(const WebTraceLocation& location, WebThread::Tas
k* task) |
84 { | 85 { |
85 if (m_webScheduler) | 86 if (m_webScheduler) |
86 m_webScheduler->postLoadingTask(location, task); | 87 m_webScheduler->postLoadingTask(location, task); |
87 } | 88 } |
88 | 89 |
| 90 void Scheduler::postTimerTask(const WebTraceLocation& location, WebThread::Task*
task, long long delayMs) |
| 91 { |
| 92 ASSERT(WTF::isMainThread()); |
| 93 |
| 94 if (m_webScheduler) |
| 95 m_webScheduler->postTimerTask(location, task, delayMs); |
| 96 } |
| 97 |
89 bool Scheduler::shouldYieldForHighPriorityWork() const | 98 bool Scheduler::shouldYieldForHighPriorityWork() const |
90 { | 99 { |
91 if (m_webScheduler) | 100 if (m_webScheduler) |
92 return m_webScheduler->shouldYieldForHighPriorityWork(); | 101 return m_webScheduler->shouldYieldForHighPriorityWork(); |
93 return false; | 102 return false; |
94 } | 103 } |
95 | 104 |
96 bool Scheduler::canExceedIdleDeadlineIfRequired() const | 105 bool Scheduler::canExceedIdleDeadlineIfRequired() const |
97 { | 106 { |
98 if (m_webScheduler) | 107 if (m_webScheduler) |
99 return m_webScheduler->canExceedIdleDeadlineIfRequired(); | 108 return m_webScheduler->canExceedIdleDeadlineIfRequired(); |
100 return false; | 109 return false; |
101 } | 110 } |
102 | 111 |
103 } // namespace blink | 112 } // namespace blink |
OLD | NEW |