On 5/18/17 12:03 PM, Boris Zbarsky wrote:
On 5/17/17 9:22 PM, Mark Hammond wrote:
I'm wondering if there are any ideas about how to solve this optimally?

I assume https://w3c.github.io/requestidlecallback/#the-requestidlecallback-method doesn't have quite the right semantics here? That would let you run when the browser is idle, and give you some idea of how long you can run for before you should yield.

The only way I could see that work would be if the code was explicitly written as a consumer of a queue of promises (along the lines of that "Cooperative Scheduling of Background Tasks API" example). However, I can't see how code written "naturally" (eg, that loop in PlacesUtils.jsm I linked to) could leverage that.

IdleDeadline.timeRemaining() does appear to have the semantics I want, but just seems "inverted" in terms of how it is used. A function that, basically, returns this value synchronously sounds like what I am after though.

Thanks,

Mark
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to