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

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

Issue 2209023002: Introduce TaskRunnerHelper::get() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: temp Created 4 years, 4 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 | « no previous file | third_party/WebKit/Source/core/dom/TaskRunnerHelper.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "wtf/Allocator.h" 9 #include "wtf/Allocator.h"
10 10
11 namespace blink { 11 namespace blink {
12 12
13 class Document; 13 class Document;
14 class ExecutionContext; 14 class ExecutionContext;
15 class LocalFrame; 15 class LocalFrame;
16 class ScriptState; 16 class ScriptState;
17 class WebTaskRunner; 17 class WebTaskRunner;
18 18
19 enum TaskRunnerType {
Sami 2016/08/04 10:32:29 FWIW we could use an enum class for this, e.g., Ta
haraken 2016/08/04 13:45:31 Used an enum class.
20 // Speced tasks and related internal tasks should be posted to one of
21 // the following task runners. These task runners may be throttled.
22 DOMManipulationTask,
23 UserInteractionTask,
24 NetworkingTask,
25 HistoryTraversalTask,
26 EmbedTask,
27 MediaElementEventTask,
28 CanvasBlobSerializationTask,
29 MicrotaskTask,
30 TimerTask,
31 RemoteEventTask,
32 WebSocketTask,
33 PostedMessageTask,
34 UnshippedPortMessageTask,
35
36 // Other internal tasks that cannot fit any of the above task runners
37 // can be posted here, but the usage is not encouraged. The task runner
38 // may be throttled.
39 InternalTask,
40
41 // Idle tasks should be posted here.
42 IdleTask,
Sami 2016/08/04 10:32:29 Idle tasks need a different kind of task runner (o
haraken 2016/08/04 13:45:31 Agreed. Removed IdleTask.
43
44 // Tasks that must not be throttled should be posted here, but the usage
45 // should be very limited.
46 UnthrottledTask,
47 };
48
19 class CORE_EXPORT TaskRunnerHelper final { 49 class CORE_EXPORT TaskRunnerHelper final {
20 STATIC_ONLY(TaskRunnerHelper); 50 STATIC_ONLY(TaskRunnerHelper);
21 public: 51 public:
52 static WebTaskRunner* get(TaskRunnerType, LocalFrame*);
53 static WebTaskRunner* get(TaskRunnerType, Document*);
54 static WebTaskRunner* get(TaskRunnerType, ExecutionContext*);
55 static WebTaskRunner* get(TaskRunnerType, ScriptState*);
56
57 // TODO(haraken): Remove the following APIs.
22 static WebTaskRunner* getUnthrottledTaskRunner(LocalFrame*); 58 static WebTaskRunner* getUnthrottledTaskRunner(LocalFrame*);
23 static WebTaskRunner* getTimerTaskRunner(LocalFrame*); 59 static WebTaskRunner* getTimerTaskRunner(LocalFrame*);
24 static WebTaskRunner* getLoadingTaskRunner(LocalFrame*); 60 static WebTaskRunner* getLoadingTaskRunner(LocalFrame*);
25 static WebTaskRunner* getUnthrottledTaskRunner(Document*); 61 static WebTaskRunner* getUnthrottledTaskRunner(Document*);
26 static WebTaskRunner* getTimerTaskRunner(Document*); 62 static WebTaskRunner* getTimerTaskRunner(Document*);
27 static WebTaskRunner* getLoadingTaskRunner(Document*); 63 static WebTaskRunner* getLoadingTaskRunner(Document*);
28 static WebTaskRunner* getUnthrottledTaskRunner(ExecutionContext*); 64 static WebTaskRunner* getUnthrottledTaskRunner(ExecutionContext*);
29 static WebTaskRunner* getUnthrottledTaskRunner(ScriptState*); 65 static WebTaskRunner* getUnthrottledTaskRunner(ScriptState*);
30 }; 66 };
31 67
32 } // namespace blink 68 } // namespace blink
33 69
34 #endif 70 #endif
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/dom/TaskRunnerHelper.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698