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