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

Unified Diff: third_party/WebKit/Source/core/dom/TaskRunnerHelper.cpp

Issue 2141873002: Add helper functions to get per-frame task runners (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: temp Created 4 years, 5 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.cpp
diff --git a/third_party/WebKit/Source/core/dom/TaskRunnerHelper.cpp b/third_party/WebKit/Source/core/dom/TaskRunnerHelper.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..48f58f8253868f510ed4bb7c7cf90e3a4ac62131
--- /dev/null
+++ b/third_party/WebKit/Source/core/dom/TaskRunnerHelper.cpp
@@ -0,0 +1,46 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "core/dom/TaskRunnerHelper.h"
+
+#include "core/dom/Document.h"
+#include "core/frame/LocalFrame.h"
+#include "public/platform/Platform.h"
+#include "public/platform/WebFrameScheduler.h"
+#include "public/platform/WebTaskRunner.h"
+#include "public/platform/WebThread.h"
+
+namespace blink {
+
+WebTaskRunner* TaskRunnerHelper::getUnthrottledTaskRunner(LocalFrame* frame)
+{
+ return frame ? frame->frameScheduler()->unthrottledTaskRunner() : Platform::current()->currentThread()->getWebTaskRunner();
+}
+
+WebTaskRunner* TaskRunnerHelper::getTimerTaskRunner(LocalFrame* frame)
+{
+ return frame ? frame->frameScheduler()->timerTaskRunner() : Platform::current()->currentThread()->getWebTaskRunner();
+}
+
+WebTaskRunner* TaskRunnerHelper::getLoadingTaskRunner(LocalFrame* frame)
+{
+ return frame ? frame->frameScheduler()->loadingTaskRunner() : Platform::current()->currentThread()->getWebTaskRunner();
+}
+
+WebTaskRunner* TaskRunnerHelper::getUnthrottledTaskRunner(Document* document)
+{
+ return getUnthrottledTaskRunner(document ? document->frame() : nullptr);
+}
+
+WebTaskRunner* TaskRunnerHelper::getTimerTaskRunner(Document* document)
+{
+ return getTimerTaskRunner(document ? document->frame() : nullptr);
+}
+
+WebTaskRunner* TaskRunnerHelper::getLoadingTaskRunner(Document* document)
+{
+ return getLoadingTaskRunner(document ? document->frame() : nullptr);
+}
+
+} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/core/dom/TaskRunnerHelper.h ('k') | third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698