Bug
1865921 Part 1: Make WebGPUParent supply a device lost callback. r=ErichDonGubler,webgpu-reviewers,nical
This patch makes several changes:
1) It modifies WebGPUParent::RecvAdapterRequestDevice to additionally
send a device lost callback to wgpu. The user data for this callback is
stored within WebGPUParent as a hash of unique_ptr memory, which allows
for the possibility that wgpu will not call the callback (though it
should). When the callback is received, this memory is cleared. When the
WebGPUParent is destroyed, it asserts that there is no remaining held
memory for pending callbacks. These callbacks also check a WeakPtr to
the parent as additional safety.
2) It corrects some behavior in Device::ResolveLost where checking the
existence of the underlying JS object is moved earlier, since later
operations on the promise require the JS object to exist.
Differential Revision: https://phabricator.services.mozilla.com/
D194310