w3c / requestidlecallback

Cooperative Scheduling of Background Tasks
https://w3c.github.io/requestidlecallback/
Other
50 stars 19 forks source link

Do we need to clarify that microtasks will execute within this period? #13

Closed toddreifsteck closed 8 years ago

toddreifsteck commented 9 years ago

This is a bit vague but is something I as thinkin on this morning. It seems that downstream microtasks from code within a requeestIdleCallback could cause the code to have effects past its deadline. Is any processing model update necessary to improve that OR is that just something we should expect web page developers to understand?

(My initial thinking is that web page developers will just need to keep that in mind. The purpose of this issue is to ensure others agreed.)

igrigorik commented 9 years ago

Hmm, I think this is a "developers will have to keep this in mind". There isn't anything we can do about this in rIC's processing model.. since the callback can do arbitrary work.

That said, perhaps it does make sense to add a note reminding developers to be careful about what and how they schedule within rIC's callback?

rmcilroy commented 9 years ago

I agree with @igrigorik, I don't think we can specify anything about this in the processing model, but happy to take suggestions on adding a note to remind developers about this in the spec.

igrigorik commented 9 years ago

@rmcilroy it may be good to add a brief note below Fig 1 indicating that some operations invoked within the rIC callback may schedule other (microtask) work that would run after the idle callback has finished.. If that's the case, the application should account for that by yielding before the deadline expires to avoid blowing the frame budget. (Except, worded more nicely.. :))

toddreifsteck commented 9 years ago

This sounds useful to me. Thanks!

rmcilroy commented 9 years ago

Attempted to clarify this in #15. PTAL, thanks.