[dawn][emscripten] Remove duplicate device lost event.

- This was a bug where we were creating a device lost event in
  WGPUDeviceImpl's ctor, and also in requestDevice.

Change-Id: I41f5ea3b36c7d78565e860297c49ad5102f7fff0
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/211894
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Auto-Submit: Loko Kung <lokokung@google.com>
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
diff --git a/third_party/emdawnwebgpu/webgpu.cpp b/third_party/emdawnwebgpu/webgpu.cpp
index ddbdac4..e30dc54 100644
--- a/third_party/emdawnwebgpu/webgpu.cpp
+++ b/third_party/emdawnwebgpu/webgpu.cpp
@@ -676,6 +676,7 @@
 
   void Destroy();
   WGPUQueue GetQueue() const;
+  WGPUFuture GetDeviceLostFuture() const;
 
   void OnDeviceLost(WGPUDeviceLostReason reason, const char* message);
   void OnUncapturedError(WGPUErrorType type, char const* message);
@@ -1377,6 +1378,10 @@
   return ReturnToAPI(std::move(queue));
 }
 
+WGPUFuture WGPUDeviceImpl::GetDeviceLostFuture() const {
+  return WGPUFuture{mDeviceLostFutureId};
+}
+
 void WGPUDeviceImpl::OnDeviceLost(WGPUDeviceLostReason reason,
                                   const char* message) {
   if (mDeviceLostFutureId != kNullFutureId) {
@@ -1558,10 +1563,7 @@
   // Device is also immediately associated with the DeviceLostEvent.
   WGPUQueue queue = new WGPUQueueImpl(adapter);
   WGPUDevice device = new WGPUDeviceImpl(adapter, descriptor, queue);
-
-  auto [deviceLostFutureId, _] = GetEventManager().TrackEvent(
-      std::make_unique<DeviceLostEvent>(adapter->GetInstanceId(), device,
-                                        descriptor->deviceLostCallbackInfo2));
+  auto deviceLostFutureId = device->GetDeviceLostFuture().id;
 
   emwgpuAdapterRequestDevice(adapter, futureId, deviceLostFutureId, device,
                              queue, descriptor);