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

Side by Side Diff: third_party/WebKit/Source/core/workers/WorkerTaskRunners.h

Issue 2806623004: Worker: Introduce per-global-scope task scheduler (Closed)
Patch Set: rebase 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
(Empty)
1 // Copyright 2017 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 #ifndef WorkerTaskRunners_h
6 #define WorkerTaskRunners_h
7
8 #include <memory>
9 #include "core/CoreExport.h"
10 #include "core/dom/TaskRunnerHelper.h"
11 #include "platform/wtf/HashMap.h"
12 #include "platform/wtf/Noncopyable.h"
13 #include "platform/wtf/PassRefPtr.h"
14 #include "platform/wtf/RefPtr.h"
15 #include "platform/wtf/ThreadSafeRefCounted.h"
16
17 namespace blink {
18
19 class WebTaskRunner;
20 class WorkerOrWorkletGlobalScope;
21
22 // Represents a set of task runners of the worker/worklet global context. This
23 // could be accessed from any threads and must be initialized on the thread
24 // where the context is running.
25 class CORE_EXPORT WorkerTaskRunners final
26 : public ThreadSafeRefCounted<WorkerTaskRunners> {
27 WTF_MAKE_NONCOPYABLE(WorkerTaskRunners);
28
29 public:
30 static RefPtr<WorkerTaskRunners> Create(WorkerOrWorkletGlobalScope*);
31
32 RefPtr<WebTaskRunner> Get(TaskType);
33
34 private:
35 using TaskRunnerHashMap = HashMap<TaskType,
36 RefPtr<WebTaskRunner>,
37 WTF::IntHash<TaskType>,
38 TaskTypeTraits>;
39
40 explicit WorkerTaskRunners(WorkerOrWorkletGlobalScope*);
41
42 TaskRunnerHashMap task_runners_;
43 };
44
45 } // namespace blink
46
47 #endif // WorkerTaskRunners_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698