requestIdleCallback executes IdleDeadline.timeRemaining() as 0 during scroll
Reported by
j...@ionic.io,
May 12 2017
|
||||
Issue descriptionUserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36 Steps to reproduce the problem: 1. React a long html page that has a requestIdleCallback JS callback 2. Scroll down the page 3. Notice that requestIdleCallback is executing many times with timeRemaining as 0. What is the expected behavior? You will see requestIdleCallback execute many times with a zero for timeRemaining(). I would expect it to either not be called or to execute with timeRemaining() greater than zero. What went wrong? I would expect requestIldeCallback to not execute its cb if there is no idle time available. Did this work before? N/A Chrome version: 57.0.2987.133 Channel: n/a OS Version: OS X 10.12.4 Flash Version:
,
May 16 2017
Could you please attach any same test page to confirm if this has regressed on chrome or is 'Chrome specific or not'.
,
May 16 2017
This is probably because of this logic here which basically drops the deadline to zero if there's a pending input event: https://cs.chromium.org/chromium/src/third_party/WebKit/Source/core/dom/IdleDeadline.cpp?rcl=72ee324cfc8b665fead069db226dbf7ef6af7fec&l=21 We only do this for JS idle tasks since internal idle tasks are generally better behaved. Maybe we should just do the same check before we even start executing a JS idle task?
,
May 16 2017
I guess the idea would be we would add the ShouldYielddForHighPriorityWork check into IdleRequestCallbackWrapper::IdleTaskFired (or even further down into the guts of the scheduler) so that we don't actually run the JS idle task in that case? SGTM.
,
May 19 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/2e545f253b342d81a9c2c27a83a0d08a1a0ab3ed commit 2e545f253b342d81a9c2c27a83a0d08a1a0ab3ed Author: Sami Kyostila <skyostil@chromium.org> Date: Fri May 19 16:26:14 2017 scheduler: Don't run Javascript idle tasks when there is pending input If there is pending input, deadline.timeRemaining will return zero when queried from within a JavaScript idle task. Because of this it's not helpful to even start running these types of idle tasks if we already know that there is pending input. BUG= 721773 Change-Id: I5576b1081f1efe61ad3901f68692b950163ea9e9 Reviewed-on: https://chromium-review.googlesource.com/506157 Reviewed-by: Ross McIlroy <rmcilroy@chromium.org> Reviewed-by: Jochen Eisinger <jochen@chromium.org> Commit-Queue: Sami Kyöstilä <skyostil@chromium.org> Cr-Commit-Position: refs/heads/master@{#473209} [modify] https://crrev.com/2e545f253b342d81a9c2c27a83a0d08a1a0ab3ed/third_party/WebKit/Source/core/BUILD.gn [modify] https://crrev.com/2e545f253b342d81a9c2c27a83a0d08a1a0ab3ed/third_party/WebKit/Source/core/dom/ScriptedIdleTaskController.cpp [modify] https://crrev.com/2e545f253b342d81a9c2c27a83a0d08a1a0ab3ed/third_party/WebKit/Source/core/dom/ScriptedIdleTaskController.h [add] https://crrev.com/2e545f253b342d81a9c2c27a83a0d08a1a0ab3ed/third_party/WebKit/Source/core/dom/ScriptedIdleTaskControllerTest.cpp
,
May 19 2017
|
||||
►
Sign in to add a comment |
||||
Comment 1 by ranjitkan@chromium.org
, May 15 2017