Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: Source/platform/WebScheduler.cpp

Issue 1087203002: Patch 2/3 to get WebScheduler via WebThread (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Sami's tidy up Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/platform/ThreadTimers.cpp ('k') | Source/platform/blink_platform.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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.
4
5 #include "config.h"
6 #include "public/platform/WebScheduler.h"
7
8 #include "public/platform/WebTraceLocation.h"
9 #include "wtf/Assertions.h"
10 #include "wtf/OwnPtr.h"
11
12 namespace blink {
13
14 namespace {
15 class TaskRunner : public WebThread::Task {
16 WTF_MAKE_NONCOPYABLE(TaskRunner);
17
jochen (gone - plz use gerrit) 2015/04/16 14:41:28 no empty line here
alex clarke (OOO till 29th) 2015/04/16 15:47:51 Done.
18 public:
19 explicit TaskRunner(PassOwnPtr<WebScheduler::Task> task)
20 : m_task(task)
21 {
22 }
23
24 ~TaskRunner() override
25 {
26 }
27
28 // WebThread::Task implementation.
29 void run() override
30 {
31 (*m_task)();
32 }
33 private:
jochen (gone - plz use gerrit) 2015/04/16 14:41:28 add empty line before this one
alex clarke (OOO till 29th) 2015/04/16 15:47:51 Done.
34 OwnPtr<WebScheduler::Task> m_task;
35 };
36
37 class IdleTaskRunner : public WebThread::IdleTask {
38 WTF_MAKE_NONCOPYABLE(IdleTaskRunner);
39
jochen (gone - plz use gerrit) 2015/04/16 14:41:28 same here and below
alex clarke (OOO till 29th) 2015/04/16 15:47:51 Done.
40 public:
41 explicit IdleTaskRunner(PassOwnPtr<WebScheduler::IdleTask> task)
42 : m_task(task)
43 {
44 }
45
46 ~IdleTaskRunner() override
47 {
48 }
49
50 // WebThread::IdleTask implementation.
51 void run(double deadlineSeconds) override
52 {
53 (*m_task)(deadlineSeconds);
54 }
55 private:
56 OwnPtr<WebScheduler::IdleTask> m_task;
57 };
58
59 } // namespace
60
61 void WebScheduler::postIdleTask(const WebTraceLocation& location, PassOwnPtr<Idl eTask> idleTask)
62 {
63 postIdleTask(location, new IdleTaskRunner(idleTask));
64 }
65
66 void WebScheduler::postNonNestableIdleTask(const WebTraceLocation& location, Pas sOwnPtr<IdleTask> idleTask)
67 {
68 postNonNestableIdleTask(location, new IdleTaskRunner(idleTask));
69 }
70
71 void WebScheduler::postIdleTaskAfterWakeup(const WebTraceLocation& location, Pas sOwnPtr<IdleTask> idleTask)
72 {
73 postIdleTaskAfterWakeup(location, new IdleTaskRunner(idleTask));
74 }
75
76 void WebScheduler::postLoadingTask(const WebTraceLocation& location, PassOwnPtr< Task> task)
77 {
78 postLoadingTask(location, new TaskRunner(task));
79 }
80
81 } // namespace blink
OLDNEW
« no previous file with comments | « Source/platform/ThreadTimers.cpp ('k') | Source/platform/blink_platform.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698