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

Unified 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 side-by-side diff with in-line comments
Download patch
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..fb72520ea51694929384e84048ceeb3aaa307f7c 100644
--- a/third_party/WebKit/Source/core/dom/TaskRunnerHelper.h
+++ b/third_party/WebKit/Source/core/dom/TaskRunnerHelper.h
@@ -16,9 +16,42 @@ class LocalFrame;
class ScriptState;
class WebTaskRunner;
+enum class TaskType {
+ // Speced tasks and related internal tasks should be posted to one of
+ // the following task runners. These task runners may be throttled.
+ DOMManipulation,
+ UserInteraction,
+ Networking,
+ HistoryTraversal,
+ Embed,
+ MediaElementEvent,
+ CanvasBlobSerialization,
+ Microtask,
+ Timer,
+ RemoteEvent,
+ WebSocket,
+ PostedMessage,
+ UnshippedPortMessage,
+
+ // 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.
+ Internal,
+
+ // Tasks that must not be throttled should be posted here, but the usage
+ // should be very limited.
+ Unthrottled,
+};
+
class CORE_EXPORT TaskRunnerHelper final {
STATIC_ONLY(TaskRunnerHelper);
public:
+ static WebTaskRunner* get(TaskType, LocalFrame*);
+ static WebTaskRunner* get(TaskType, Document*);
+ static WebTaskRunner* get(TaskType, ExecutionContext*);
+ static WebTaskRunner* get(TaskType, ScriptState*);
+
+ // TODO(haraken): Remove the following APIs.
static WebTaskRunner* getUnthrottledTaskRunner(LocalFrame*);
static WebTaskRunner* getTimerTaskRunner(LocalFrame*);
static WebTaskRunner* getLoadingTaskRunner(LocalFrame*);

Powered by Google App Engine
This is Rietveld 408576698