Reland "(3/N) Rename WGPUDeviceLostReason_Undefined to Unknown"

This reverts commit a1056518c9ada17c7fcd0eb9d42d8ed03680a0b3.

Reason for revert: All affected code has been modified, and we are now attempting to reland the patch.

Original change's description:
> Revert "(3/N) Rename WGPUDeviceLostReason_Undefined to Unknown"
>
> This reverts commit 98012bf2e9bdccf588624d3ba6bc045301de1658.
>
> Reason for revert: This breaks the Dawn->Chromium roll because not all usages have been updated yet. We need Emscripten to be updated with this change before we can update the remaining usages.
>
> Original change's description:
> > (3/N) Rename WGPUDeviceLostReason_Undefined to Unknown
> >
> > Spec change was:
> > https://github.com/gpuweb/gpuweb/pull/3976
> >
> > Stage 3: Remove `WGPUDeviceLostReason_Undefined`
> > from Dawn.
> >
> > Bug: chromium:42241081
> > Change-Id: I6865a9cff2494adadab4dbae898ab010401afb94
> > Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/187280
> > Commit-Queue: Kai Ninomiya <kainino@chromium.org>
> > Reviewed-by: Austin Eng <enga@chromium.org>
> > Reviewed-by: Kai Ninomiya <kainino@chromium.org>
>
> TBR=kainino@chromium.org,enga@chromium.org,dawn-scoped@luci-project-accounts.iam.gserviceaccount.com,hocheung@chromium.org
>
> Change-Id: Iaddff04864e965a7d473a737721d52e40be72b06
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: chromium:42241081
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/187480
> Reviewed-by: James Price <jrprice@google.com>
> Reviewed-by: Austin Eng <enga@chromium.org>
> Commit-Queue: James Price <jrprice@google.com>

# Not skipping CQ checks because this is a reland.

Bug: chromium:42241081
Change-Id: I878465702fc70266875001e947c973555bd0f839
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/187560
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
diff --git a/src/dawn/dawn.json b/src/dawn/dawn.json
index 5e35dec..761f46f 100644
--- a/src/dawn/dawn.json
+++ b/src/dawn/dawn.json
@@ -1544,7 +1544,6 @@
         "category": "enum",
         "emscripten_no_enum_table": true,
         "values": [
-            {"value": 0, "name": "undefined", "jsrepr": "undefined"},
             {"value": 1, "name": "unknown"},
             {"value": 2, "name": "destroyed"},
             {"value": 3, "name": "instance dropped"},
diff --git a/src/dawn/native/Device.h b/src/dawn/native/Device.h
index 5e2462c..d8b014d 100644
--- a/src/dawn/native/Device.h
+++ b/src/dawn/native/Device.h
@@ -126,7 +126,7 @@
     // users as the respective error rather than causing a device loss instead.
     void HandleError(std::unique_ptr<ErrorData> error,
                      InternalErrorType additionalAllowedErrors = InternalErrorType::None,
-                     WGPUDeviceLostReason lost_reason = WGPUDeviceLostReason_Undefined);
+                     WGPUDeviceLostReason lost_reason = WGPUDeviceLostReason_Unknown);
 
     MaybeError ValidateObject(const ApiObjectBase* object) const;
 
diff --git a/src/dawn/node/binding/GPUDevice.cpp b/src/dawn/node/binding/GPUDevice.cpp
index c0fcc0d..de9184c 100644
--- a/src/dawn/node/binding/GPUDevice.cpp
+++ b/src/dawn/node/binding/GPUDevice.cpp
@@ -187,7 +187,6 @@
                 case WGPUDeviceLostReason_InstanceDropped:
                     UNREACHABLE("WGPUDeviceLostReason_InstanceDropped");
                     break;
-                case WGPUDeviceLostReason_Undefined:
                 case WGPUDeviceLostReason_Unknown:
                     r = interop::GPUDeviceLostReason::kUnknown;
                     break;
diff --git a/src/dawn/tests/DawnTest.cpp b/src/dawn/tests/DawnTest.cpp
index ab646d7..0fbfa98 100644
--- a/src/dawn/tests/DawnTest.cpp
+++ b/src/dawn/tests/DawnTest.cpp
@@ -1234,8 +1234,8 @@
         resolvedDevice = device;
     }
 
-    EXPECT_CALL(mDeviceLostCallback, Call(_, WGPUDeviceLostReason_Undefined, _, _)).Times(1);
-    resolvedDevice.ForceLoss(wgpu::DeviceLostReason::Undefined, "Device lost for testing");
+    EXPECT_CALL(mDeviceLostCallback, Call(_, WGPUDeviceLostReason_Unknown, _, _)).Times(1);
+    resolvedDevice.ForceLoss(wgpu::DeviceLostReason::Unknown, "Device lost for testing");
     resolvedDevice.Tick();
 }
 
diff --git a/src/dawn/tests/benchmarks/NullDeviceSetup.cpp b/src/dawn/tests/benchmarks/NullDeviceSetup.cpp
index 203508c..2a894c1 100644
--- a/src/dawn/tests/benchmarks/NullDeviceSetup.cpp
+++ b/src/dawn/tests/benchmarks/NullDeviceSetup.cpp
@@ -80,7 +80,7 @@
 
             device.SetDeviceLostCallback(
                 [](WGPUDeviceLostReason reason, char const* message, void* userdata) {
-                    if (reason == WGPUDeviceLostReason_Undefined) {
+                    if (reason == WGPUDeviceLostReason_Unknown) {
                         dawn::ErrorLog() << message;
                         DAWN_UNREACHABLE();
                     }
diff --git a/src/dawn/tests/end2end/DeviceLostTests.cpp b/src/dawn/tests/end2end/DeviceLostTests.cpp
index 37dba76..26837bb 100644
--- a/src/dawn/tests/end2end/DeviceLostTests.cpp
+++ b/src/dawn/tests/end2end/DeviceLostTests.cpp
@@ -436,7 +436,7 @@
     // First LoseDeviceForTesting call should occur normally. The callback is already set in SetUp.
     LoseDeviceForTesting();
 
-    device.ForceLoss(wgpu::DeviceLostReason::Undefined, "Device lost for testing");
+    device.ForceLoss(wgpu::DeviceLostReason::Unknown, "Device lost for testing");
     FlushWire();
     testing::Mock::VerifyAndClearExpectations(&mDeviceLostCallback);
 }
diff --git a/src/dawn/tests/end2end/EventTests.cpp b/src/dawn/tests/end2end/EventTests.cpp
index f0b5abf..4f8e15a 100644
--- a/src/dawn/tests/end2end/EventTests.cpp
+++ b/src/dawn/tests/end2end/EventTests.cpp
@@ -152,9 +152,9 @@
 
     void LoseTestDevice() {
         EXPECT_CALL(mDeviceLostCallback,
-                    Call(testing::_, WGPUDeviceLostReason_Undefined, testing::_, testing::_))
+                    Call(testing::_, WGPUDeviceLostReason_Unknown, testing::_, testing::_))
             .Times(1);
-        testDevice.ForceLoss(wgpu::DeviceLostReason::Undefined, "Device lost for testing");
+        testDevice.ForceLoss(wgpu::DeviceLostReason::Unknown, "Device lost for testing");
         testInstance.ProcessEvents();
     }
 
diff --git a/src/dawn/tests/unittests/native/AllowedErrorTests.cpp b/src/dawn/tests/unittests/native/AllowedErrorTests.cpp
index 584f109..6a5b15da 100644
--- a/src/dawn/tests/unittests/native/AllowedErrorTests.cpp
+++ b/src/dawn/tests/unittests/native/AllowedErrorTests.cpp
@@ -94,7 +94,7 @@
 
     // Expect the device lost because of the error.
     EXPECT_CALL(mDeviceLostCb,
-                Call(WGPUDeviceLostReason_Undefined, HasSubstr(kOomErrorMessage), this))
+                Call(WGPUDeviceLostReason_Unknown, HasSubstr(kOomErrorMessage), this))
         .Times(1);
 
     device.GetQueue().Submit(0, nullptr);
@@ -112,7 +112,7 @@
 
     // Expect the device lost because of the error.
     EXPECT_CALL(mDeviceLostCb,
-                Call(WGPUDeviceLostReason_Undefined, HasSubstr(kOomErrorMessage), this))
+                Call(WGPUDeviceLostReason_Unknown, HasSubstr(kOomErrorMessage), this))
         .Times(1);
 
     constexpr uint8_t data = 8;
@@ -133,7 +133,7 @@
 
     // Expect the device lost because of the error.
     EXPECT_CALL(mDeviceLostCb,
-                Call(WGPUDeviceLostReason_Undefined, HasSubstr(kOomErrorMessage), this))
+                Call(WGPUDeviceLostReason_Unknown, HasSubstr(kOomErrorMessage), this))
         .Times(1);
 
     constexpr uint8_t data[] = {1, 2, 4, 8};
@@ -166,7 +166,7 @@
 
     // Expect the device lost because of the error.
     EXPECT_CALL(mDeviceLostCb,
-                Call(WGPUDeviceLostReason_Undefined, HasSubstr(kOomErrorMessage), this))
+                Call(WGPUDeviceLostReason_Unknown, HasSubstr(kOomErrorMessage), this))
         .Times(1);
     device.GetQueue().CopyTextureForBrowser(&src, &dst, &size, &options);
 }
@@ -207,7 +207,7 @@
 
     // Expect the device lost because of the error.
     EXPECT_CALL(mDeviceLostCb,
-                Call(WGPUDeviceLostReason_Undefined, HasSubstr(kOomErrorMessage), this))
+                Call(WGPUDeviceLostReason_Unknown, HasSubstr(kOomErrorMessage), this))
         .Times(1);
     device.GetQueue().CopyExternalTextureForBrowser(&src, &dst, &size, &options);
 }
@@ -227,7 +227,7 @@
 
     // Expect the device lost because of the error.
     EXPECT_CALL(mDeviceLostCb,
-                Call(WGPUDeviceLostReason_Undefined, HasSubstr(kOomErrorMessage), this))
+                Call(WGPUDeviceLostReason_Unknown, HasSubstr(kOomErrorMessage), this))
         .Times(1);
     device.CreateComputePipeline(ToCppAPI(&desc));
 }
@@ -247,7 +247,7 @@
 
     // Expect the device lost because of the error.
     EXPECT_CALL(mDeviceLostCb,
-                Call(WGPUDeviceLostReason_Undefined, HasSubstr(kOomErrorMessage), this))
+                Call(WGPUDeviceLostReason_Unknown, HasSubstr(kOomErrorMessage), this))
         .Times(1);
     device.CreateRenderPipeline(ToCppAPI(&desc));
 }
diff --git a/src/dawn/tests/unittests/wire/WireDisconnectTests.cpp b/src/dawn/tests/unittests/wire/WireDisconnectTests.cpp
index dc9a06d..7b6ebe0 100644
--- a/src/dawn/tests/unittests/wire/WireDisconnectTests.cpp
+++ b/src/dawn/tests/unittests/wire/WireDisconnectTests.cpp
@@ -91,12 +91,12 @@
 // Check that disconnecting the wire client after a device loss does not trigger the callback
 // again.
 TEST_F(WireDisconnectTests, ServerLostThenDisconnect) {
-    api.CallDeviceSetDeviceLostCallbackCallback(apiDevice, WGPUDeviceLostReason_Undefined,
+    api.CallDeviceSetDeviceLostCallbackCallback(apiDevice, WGPUDeviceLostReason_Unknown,
                                                 "some reason");
 
     // Flush the device lost return command.
     EXPECT_CALL(deviceLostCallback,
-                Call(_, WGPUDeviceLostReason_Undefined, StrEq("some reason"), this))
+                Call(_, WGPUDeviceLostReason_Unknown, StrEq("some reason"), this))
         .Times(Exactly(1));
     FlushServer();
 
@@ -112,13 +112,13 @@
     wgpuDeviceSetDeviceLostCallback(device, mockDeviceLostCallback.Callback(),
                                     mockDeviceLostCallback.MakeUserdata(this));
 
-    api.CallDeviceSetDeviceLostCallbackCallback(apiDevice, WGPUDeviceLostReason_Undefined,
+    api.CallDeviceSetDeviceLostCallbackCallback(apiDevice, WGPUDeviceLostReason_Unknown,
                                                 "lost reason");
 
     // Disconnect the client inside the lost callback. We should see the callback
     // only once.
     EXPECT_CALL(mockDeviceLostCallback,
-                Call(WGPUDeviceLostReason_Undefined, StrEq("lost reason"), this))
+                Call(WGPUDeviceLostReason_Unknown, StrEq("lost reason"), this))
         .WillOnce(InvokeWithoutArgs([&] {
             EXPECT_CALL(mockDeviceLostCallback, Call(_, _, _)).Times(Exactly(0));
             GetWireClient()->Disconnect();
@@ -139,7 +139,7 @@
 
     // Lose the device on the server. The client callback shouldn't be
     // called again.
-    api.CallDeviceSetDeviceLostCallbackCallback(apiDevice, WGPUDeviceLostReason_Undefined,
+    api.CallDeviceSetDeviceLostCallbackCallback(apiDevice, WGPUDeviceLostReason_Unknown,
                                                 "lost reason");
     EXPECT_CALL(mockDeviceLostCallback, Call(_, _, _)).Times(Exactly(0));
     FlushServer();
diff --git a/src/dawn/tests/unittests/wire/WireErrorCallbackTests.cpp b/src/dawn/tests/unittests/wire/WireErrorCallbackTests.cpp
index a1f52c2..2a91393 100644
--- a/src/dawn/tests/unittests/wire/WireErrorCallbackTests.cpp
+++ b/src/dawn/tests/unittests/wire/WireErrorCallbackTests.cpp
@@ -187,11 +187,11 @@
 
     // Calling the callback on the server side will result in the callback being called on the
     // client side
-    api.CallDeviceSetDeviceLostCallbackCallback(apiDevice, WGPUDeviceLostReason_Undefined,
+    api.CallDeviceSetDeviceLostCallbackCallback(apiDevice, WGPUDeviceLostReason_Unknown,
                                                 "Some error message");
 
     EXPECT_CALL(*mockDeviceLostCallback,
-                Call(WGPUDeviceLostReason_Undefined, StrEq("Some error message"), this))
+                Call(WGPUDeviceLostReason_Unknown, StrEq("Some error message"), this))
         .Times(1);
 
     FlushServer();
diff --git a/src/dawn/wire/client/Client.cpp b/src/dawn/wire/client/Client.cpp
index 3cc08d6..bacb0f1 100644
--- a/src/dawn/wire/client/Client.cpp
+++ b/src/dawn/wire/client/Client.cpp
@@ -187,7 +187,7 @@
         for (LinkNode<ObjectBase>* device = deviceList.head(); device != deviceList.end();
              device = device->next()) {
             static_cast<Device*>(device->value())
-                ->HandleDeviceLost(WGPUDeviceLostReason_Undefined, "GPU connection lost");
+                ->HandleDeviceLost(WGPUDeviceLostReason_Unknown, "GPU connection lost");
         }
     }
     for (auto& objectList : mObjects) {