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..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; |