Queuing tasks on the current thread is too restrictive #35517
Labels
A-content/script
Related to the script thread
B-interesting-project
Represents work that is expected to be interesting in some fashion
I-papercut
Small but painful.
There have been multiple instances recently of DOM code that has a callback object (
Rc<...>
) and needs to queue a task to invoke it. Our task queue is built on channels, since script thread events can come from many sources, which means that all queued tasks must fulfill theSend
bounds. When we are queueing a task from the same thread that it will run on, however, this is a poor developer experience—it would be much clearer for the task to take ownership of the non-Send data when it is guaranteed that the task will run on the originating thread.I can imagine three possible solutions:
The third solution appeals to me because it requires no extra work from the API user and requires no unsafe code or lying about types.
The text was updated successfully, but these errors were encountered: