Chromium Code Reviews| Index: third_party/WebKit/Source/core/dom/TaskRunnerHelper.h |
| diff --git a/third_party/WebKit/Source/core/dom/TaskRunnerHelper.h b/third_party/WebKit/Source/core/dom/TaskRunnerHelper.h |
| index 19a0983c82539672a0586d69189df381806c98a5..94e37e6d2f515799793e4913d3c9aaa14a090e6a 100644 |
| --- a/third_party/WebKit/Source/core/dom/TaskRunnerHelper.h |
| +++ b/third_party/WebKit/Source/core/dom/TaskRunnerHelper.h |
| @@ -16,9 +16,45 @@ class LocalFrame; |
| class ScriptState; |
| class WebTaskRunner; |
| +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.
|
| + // Speced tasks and related internal tasks should be posted to one of |
| + // the following task runners. These task runners may be throttled. |
| + DOMManipulationTask, |
| + UserInteractionTask, |
| + NetworkingTask, |
| + HistoryTraversalTask, |
| + EmbedTask, |
| + MediaElementEventTask, |
| + CanvasBlobSerializationTask, |
| + MicrotaskTask, |
| + TimerTask, |
| + RemoteEventTask, |
| + WebSocketTask, |
| + PostedMessageTask, |
| + UnshippedPortMessageTask, |
| + |
| + // Other internal tasks that cannot fit any of the above task runners |
| + // can be posted here, but the usage is not encouraged. The task runner |
| + // may be throttled. |
| + InternalTask, |
| + |
| + // Idle tasks should be posted here. |
| + 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.
|
| + |
| + // Tasks that must not be throttled should be posted here, but the usage |
| + // should be very limited. |
| + UnthrottledTask, |
| +}; |
| + |
| class CORE_EXPORT TaskRunnerHelper final { |
| STATIC_ONLY(TaskRunnerHelper); |
| public: |
| + static WebTaskRunner* get(TaskRunnerType, LocalFrame*); |
| + static WebTaskRunner* get(TaskRunnerType, Document*); |
| + static WebTaskRunner* get(TaskRunnerType, ExecutionContext*); |
| + static WebTaskRunner* get(TaskRunnerType, ScriptState*); |
| + |
| + // TODO(haraken): Remove the following APIs. |
| static WebTaskRunner* getUnthrottledTaskRunner(LocalFrame*); |
| static WebTaskRunner* getTimerTaskRunner(LocalFrame*); |
| static WebTaskRunner* getLoadingTaskRunner(LocalFrame*); |