| OLD | NEW |
| 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 #include "wtf/HashTraits.h" | 10 #include "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 | 19 |
| 20 enum class TaskType : unsigned { | 20 enum class TaskType : unsigned { |
| 21 // Speced tasks and related internal tasks should be posted to one of | 21 // Speced tasks and related internal tasks should be posted to one of |
| 22 // the following task runners. These task runners may be throttled. | 22 // the following task runners. These task runners may be throttled. |
| 23 |
| 24 // https://html.spec.whatwg.org/multipage/webappapis.html#generic-task-sources |
| 25 // |
| 26 // 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 |
| 28 // into the document. |
| 23 DOMManipulation, | 29 DOMManipulation, |
| 30 // This task source is used for features that react to user interaction, for |
| 31 // example keyboard or mouse input. Events sent in response to user input |
| 32 // (e.g. click events) must be fired using tasks queued with the user |
| 33 // interaction task source. |
| 24 UserInteraction, | 34 UserInteraction, |
| 35 // This task source is used for features that trigger in response to network |
| 36 // activity. |
| 25 Networking, | 37 Networking, |
| 38 // This task source is used to queue calls to history.back() and similar APIs. |
| 26 HistoryTraversal, | 39 HistoryTraversal, |
| 40 |
| 41 // https://html.spec.whatwg.org/multipage/embedded-content.html#the-embed-elem
ent |
| 42 // This task source is used for the embed element setup steps. |
| 27 Embed, | 43 Embed, |
| 44 |
| 45 // https://html.spec.whatwg.org/multipage/embedded-content.html#media-elements |
| 46 // This task source is used for all tasks queued in the [Media elements] |
| 47 // section and subsections of the spec unless explicitly specified otherwise. |
| 28 MediaElementEvent, | 48 MediaElementEvent, |
| 49 |
| 50 // https://html.spec.whatwg.org/multipage/scripting.html#the-canvas-element |
| 51 // This task source is used to invoke the result callback of |
| 52 // HTMLCanvasElement.toBlob(). |
| 29 CanvasBlobSerialization, | 53 CanvasBlobSerialization, |
| 54 |
| 55 // https://html.spec.whatwg.org/multipage/webappapis.html#event-loop-processin
g-model |
| 56 // This task source is used when an algorithm requires a microtask to be |
| 57 // queued. |
| 30 Microtask, | 58 Microtask, |
| 59 |
| 60 // https://html.spec.whatwg.org/multipage/webappapis.html#timers |
| 61 // This task source is used to queue tasks queued by setInterval() and similar |
| 62 // APIs. |
| 31 Timer, | 63 Timer, |
| 64 |
| 65 // https://html.spec.whatwg.org/multipage/comms.html#sse-processing-model |
| 66 // This task source is used for any tasks that are queued by EventSource |
| 67 // objects. |
| 32 RemoteEvent, | 68 RemoteEvent, |
| 69 |
| 70 // https://html.spec.whatwg.org/multipage/comms.html#feedback-from-the-protoco
l |
| 71 // The task source for all tasks queued in the [WebSocket] section of the |
| 72 // spec. |
| 33 WebSocket, | 73 WebSocket, |
| 74 |
| 75 // https://html.spec.whatwg.org/multipage/comms.html#web-messaging |
| 76 // This task source is used for the tasks in cross-document messaging. |
| 34 PostedMessage, | 77 PostedMessage, |
| 78 |
| 79 // https://html.spec.whatwg.org/multipage/comms.html#message-ports |
| 35 UnshippedPortMessage, | 80 UnshippedPortMessage, |
| 81 |
| 82 // https://www.w3.org/TR/FileAPI/#blobreader-task-source |
| 83 // This task source is used for all tasks queued in the FileAPI spec to read |
| 84 // byte sequences associated with Blob and File objects. |
| 36 FileReading, | 85 FileReading, |
| 86 |
| 87 // https://www.w3.org/TR/IndexedDB/#request-api |
| 37 DatabaseAccess, | 88 DatabaseAccess, |
| 89 |
| 90 // https://w3c.github.io/presentation-api/#common-idioms |
| 91 // This task source is used for all tasks in the Presentation API spec. |
| 38 Presentation, | 92 Presentation, |
| 93 |
| 94 // https://www.w3.org/TR/2016/WD-generic-sensor-20160830/#sensor-task-source |
| 95 // This task source is used for all tasks in the Sensor API spec. |
| 39 Sensor, | 96 Sensor, |
| 40 | 97 |
| 41 // Use MiscPlatformAPI for a task that is defined in the spec but is not yet | 98 // Use MiscPlatformAPI for a task that is defined in the spec but is not yet |
| 42 // associated with any specific task runner in the spec. MiscPlatformAPI is | 99 // associated with any specific task runner in the spec. MiscPlatformAPI is |
| 43 // not encouraged for stable and matured APIs. The spec should define the task | 100 // not encouraged for stable and matured APIs. The spec should define the task |
| 44 // runner explicitly. | 101 // runner explicitly. |
| 45 // The task runner may be throttled. | 102 // The task runner may be throttled. |
| 46 MiscPlatformAPI, | 103 MiscPlatformAPI, |
| 47 | 104 |
| 48 // Other internal tasks that cannot fit any of the above task runners | 105 // Other internal tasks that cannot fit any of the above task runners |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 public: | 137 public: |
| 81 static RefPtr<WebTaskRunner> get(TaskType, LocalFrame*); | 138 static RefPtr<WebTaskRunner> get(TaskType, LocalFrame*); |
| 82 static RefPtr<WebTaskRunner> get(TaskType, Document*); | 139 static RefPtr<WebTaskRunner> get(TaskType, Document*); |
| 83 static RefPtr<WebTaskRunner> get(TaskType, ExecutionContext*); | 140 static RefPtr<WebTaskRunner> get(TaskType, ExecutionContext*); |
| 84 static RefPtr<WebTaskRunner> get(TaskType, ScriptState*); | 141 static RefPtr<WebTaskRunner> get(TaskType, ScriptState*); |
| 85 }; | 142 }; |
| 86 | 143 |
| 87 } // namespace blink | 144 } // namespace blink |
| 88 | 145 |
| 89 #endif | 146 #endif |
| OLD | NEW |