Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / Source / platform / WebScheduler.cpp
blob6d865608be693632bf1b9e543686ea7ba56410bc
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "config.h"
6 #include "public/platform/WebScheduler.h"
8 #include "platform/Task.h"
9 #include "public/platform/WebTraceLocation.h"
10 #include "wtf/Assertions.h"
11 #include "wtf/OwnPtr.h"
13 namespace blink {
15 namespace {
17 class IdleTaskRunner : public WebThread::IdleTask {
18 WTF_MAKE_NONCOPYABLE(IdleTaskRunner);
20 public:
21 explicit IdleTaskRunner(PassOwnPtr<WebScheduler::IdleTask> task)
22 : m_task(task)
26 ~IdleTaskRunner() override
30 // WebThread::IdleTask implementation.
31 void run(double deadlineSeconds) override
33 (*m_task)(deadlineSeconds);
36 private:
37 OwnPtr<WebScheduler::IdleTask> m_task;
40 } // namespace
42 void WebScheduler::postIdleTask(const WebTraceLocation& location, PassOwnPtr<IdleTask> idleTask)
44 postIdleTask(location, new IdleTaskRunner(idleTask));
47 void WebScheduler::postNonNestableIdleTask(const WebTraceLocation& location, PassOwnPtr<IdleTask> idleTask)
49 postNonNestableIdleTask(location, new IdleTaskRunner(idleTask));
52 void WebScheduler::postIdleTaskAfterWakeup(const WebTraceLocation& location, PassOwnPtr<IdleTask> idleTask)
54 postIdleTaskAfterWakeup(location, new IdleTaskRunner(idleTask));
57 } // namespace blink