On 5/19/17 8:00 PM, Andreas Farre wrote:
So if you have a look at how the idle callback algorithm is defined[1]
and what timeRemaining is supposed to return[2] you see that
timeRemaining doesn't update its sense of idleness, it only concerns
itself with the deadline. So if you save the IdleDeadline object and
resolve early, then timeRemaining won't know that the idle period
entered upon calling the idle callback might have ended.
Right - I was guessing something like that to be the case.
I do think that you need to invert this somehow, actually doing the
work inside a rIC callback. Something like[3]:
let idleTask = {
total: 100000,
progress: 0,
doWork: async function(deadline) {
The problem is that this is typically an unnatural way to express what
is being done - particularly when attempting to address jank after the
fact - and even more-so now that we have async functions, which making
writing async code extremely natural and expressive.
As I mentioned at the start of the thread, in one concrete example we
had code already written that we identified being janky -
http://searchfox.org/mozilla-central/rev/f55349994fdac101d121b11dac769f3f17fbec4b/toolkit/components/places/PlacesUtils.jsm#2022
Re-writing this code to work as you describe is certainly possible, but
unlikely. So I'm still hoping there is something we can do to avoid jank
without losing expressiveness and rewriting code identified as janky
after the fact.
Thanks,
Mark
_______________________________________________
dev-platform mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-platform