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

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

Issue 2516493002: requestIdleCallback: Yield for high priority work (Closed)
Patch Set: Created 4 years, 1 month 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/dom/IdleDeadline.cpp
diff --git a/third_party/WebKit/Source/core/dom/IdleDeadline.cpp b/third_party/WebKit/Source/core/dom/IdleDeadline.cpp
index f35300d57e5c330cf16c747342813ead8df10a5f..8a6345b65d03589048595a4a7a9f14c04141afef 100644
--- a/third_party/WebKit/Source/core/dom/IdleDeadline.cpp
+++ b/third_party/WebKit/Source/core/dom/IdleDeadline.cpp
@@ -5,6 +5,8 @@
#include "core/dom/IdleDeadline.h"
#include "core/timing/PerformanceBase.h"
+#include "public/platform/Platform.h"
+#include "public/platform/WebScheduler.h"
#include "wtf/CurrentTime.h"
namespace blink {
@@ -13,6 +15,13 @@ IdleDeadline::IdleDeadline(double deadlineSeconds, CallbackType callbackType)
: m_deadlineSeconds(deadlineSeconds), m_callbackType(callbackType) {}
double IdleDeadline::timeRemaining() const {
+ if (Platform::current()
+ ->currentThread()
+ ->scheduler()
+ ->shouldYieldForHighPriorityWork()) {
+ return 0;
+ }
rmcilroy 2016/11/18 09:13:51 nit - how about just setting timeRemaining to zero
Sami 2016/11/21 11:28:02 Good idea, done.
+
double timeRemaining = m_deadlineSeconds - monotonicallyIncreasingTime();
if (timeRemaining < 0)
timeRemaining = 0;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698