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

Side by Side Diff: third_party/WebKit/Source/core/dom/TaskRunnerHelper.h

Issue 2806623004: Worker: Introduce per-global-scope task scheduler (Closed)
Patch Set: remove unused header Created 3 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 #ifndef TaskRunnerHelper_h 5 #ifndef TaskRunnerHelper_h
6 #define TaskRunnerHelper_h 6 #define TaskRunnerHelper_h
7 7
8 #include "core/CoreExport.h" 8 #include "core/CoreExport.h"
9 #include "platform/wtf/Allocator.h" 9 #include "platform/wtf/Allocator.h"
10 #include "platform/wtf/HashTraits.h" 10 #include "platform/wtf/HashTraits.h"
11 11
12 namespace blink { 12 namespace blink {
13 13
14 class Document; 14 class Document;
15 class ExecutionContext; 15 class ExecutionContext;
16 class LocalFrame; 16 class LocalFrame;
17 class ScriptState; 17 class ScriptState;
18 class WebTaskRunner; 18 class WebTaskRunner;
19 class WorkerOrWorkletGlobalScope;
20 class WorkerThread;
19 21
20 enum class TaskType : unsigned { 22 enum class TaskType : unsigned {
21 // Speced tasks and related internal tasks should be posted to one of 23 // Speced tasks and related internal tasks should be posted to one of
22 // the following task runners. These task runners may be throttled. 24 // the following task runners. These task runners may be throttled.
23 25
24 // https://html.spec.whatwg.org/multipage/webappapis.html#generic-task-sources 26 // https://html.spec.whatwg.org/multipage/webappapis.html#generic-task-sources
25 // 27 //
26 // This task source is used for features that react to DOM manipulations, such 28 // This task source is used for features that react to DOM manipulations, such
27 // as things that happen in a non-blocking fashion when an element is inserted 29 // as things that happen in a non-blocking fashion when an element is inserted
28 // into the document. 30 // into the document.
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 } 137 }
136 }; 138 };
137 139
138 // A set of helper functions to get a WebTaskRunner for TaskType and a context 140 // A set of helper functions to get a WebTaskRunner for TaskType and a context
139 // object. The posted tasks are guaranteed to run in a sequence if they have the 141 // object. The posted tasks are guaranteed to run in a sequence if they have the
140 // same TaskType and the context objects belong to the same frame. 142 // same TaskType and the context objects belong to the same frame.
141 class CORE_EXPORT TaskRunnerHelper final { 143 class CORE_EXPORT TaskRunnerHelper final {
142 STATIC_ONLY(TaskRunnerHelper); 144 STATIC_ONLY(TaskRunnerHelper);
143 145
144 public: 146 public:
145 static RefPtr<WebTaskRunner> Get(TaskType, LocalFrame*); 147 static RefPtr<WebTaskRunner> Get(TaskType, LocalFrame*);
altimin 2017/04/18 00:46:40 Not related to this CL, just to start discussion.
nhiroki 2017/04/18 05:34:38 I don't have a strong opinion, but I'd slightly pr
146 static RefPtr<WebTaskRunner> Get(TaskType, Document*); 148 static RefPtr<WebTaskRunner> Get(TaskType, Document*);
147 static RefPtr<WebTaskRunner> Get(TaskType, ExecutionContext*); 149 static RefPtr<WebTaskRunner> Get(TaskType, ExecutionContext*);
148 static RefPtr<WebTaskRunner> Get(TaskType, ScriptState*); 150 static RefPtr<WebTaskRunner> Get(TaskType, ScriptState*);
151 static RefPtr<WebTaskRunner> Get(TaskType, WorkerOrWorkletGlobalScope*);
152
153 // Returns a WebTaskRunner that is associated to the worker / worklet global
154 // scope that corresponds to the given WorkerThread. Note that WorkerThread is
155 // a per-global-scope object while the naming might sound differently.
156 // TODO(nhiroki): Rename WorkerThread to something that clarifies it's a
157 // per-global-scope object.
158 static RefPtr<WebTaskRunner> Get(TaskType, WorkerThread*);
149 }; 159 };
150 160
151 } // namespace blink 161 } // namespace blink
152 162
153 #endif 163 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698