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

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

Issue 2516493002: requestIdleCallback: Yield for high priority work (Closed)
Patch Set: Added a test 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
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..d17f46c68f830a299ddaec13be3d663e8fd02bad 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 {
@@ -14,8 +16,14 @@ IdleDeadline::IdleDeadline(double deadlineSeconds, CallbackType callbackType)
double IdleDeadline::timeRemaining() const {
double timeRemaining = m_deadlineSeconds - monotonicallyIncreasingTime();
- if (timeRemaining < 0)
+ if (timeRemaining < 0) {
timeRemaining = 0;
esprehn 2016/11/21 20:32:27 Early return in blink. if (timeRemaining < 0) r
+ } else if (Platform::current()
+ ->currentThread()
+ ->scheduler()
+ ->shouldYieldForHighPriorityWork()) {
+ timeRemaining = 0;
+ }
return 1000.0 * PerformanceBase::clampTimeResolution(timeRemaining);
}
« no previous file with comments | « third_party/WebKit/Source/core/dom/IdleDeadline.h ('k') | third_party/WebKit/Source/core/dom/IdleDeadlineTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698