Chromium Code Reviews| 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); |
| } |