webgpu.h: Remove device argument from GetProcAddress

Also removes the previous version of the function that took a const
char* instead of a WGPUStringView.

Bug: 42241188
Change-Id: Iac574ec93c8a904f09fae8cd64eead7a07b6f810
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/209097
Reviewed-by: Loko Kung <lokokung@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
diff --git a/generator/templates/dawn/native/ProcTable.cpp b/generator/templates/dawn/native/ProcTable.cpp
index 55863c0..bb3cf22 100644
--- a/generator/templates/dawn/native/ProcTable.cpp
+++ b/generator/templates/dawn/native/ProcTable.cpp
@@ -157,14 +157,7 @@
 
     }  // anonymous namespace
 
-    //* TODO(crbug.com/42241188): Remove "2" suffix when WGPUStringView changes complete.
-    WGPUProc NativeGetProcAddress2(WGPUDevice, WGPUStringView procName);
-
-    WGPUProc NativeGetProcAddress(WGPUDevice device, const char* procName) {
-        return NativeGetProcAddress2(device, WGPUStringView{procName, WGPU_STRLEN});
-    }
-
-    WGPUProc NativeGetProcAddress2(WGPUDevice, WGPUStringView cProcName) {
+    WGPUProc NativeGetProcAddress(WGPUStringView cProcName) {
         if (cProcName.data == nullptr) {
             return nullptr;
         }
diff --git a/generator/templates/dawn/wire/client/ApiProcs.cpp b/generator/templates/dawn/wire/client/ApiProcs.cpp
index 7e891a5..65839e0 100644
--- a/generator/templates/dawn/wire/client/ApiProcs.cpp
+++ b/generator/templates/dawn/wire/client/ApiProcs.cpp
@@ -134,14 +134,7 @@
     static constexpr size_t sProcMapSize = sizeof(sProcMap) / sizeof(sProcMap[0]);
 }  // anonymous namespace
 
-//* TODO(crbug.com/42241188): Remove "2" suffix when WGPUStringView changes complete.
-WGPUProc {{as_cMethodNamespaced(None, Name('get proc address 2'), Name('dawn wire client'))}}(WGPUDevice, WGPUStringView procName);
-
-DAWN_WIRE_EXPORT WGPUProc {{as_cMethodNamespaced(None, Name('get proc address'), Name('dawn wire client'))}}(WGPUDevice device, const char* procName) {
-    return {{as_cMethodNamespaced(None, Name('get proc address 2'), Name('dawn wire client'))}}(device, {procName, WGPU_STRLEN});
-}
-
-DAWN_WIRE_EXPORT WGPUProc {{as_cMethodNamespaced(None, Name('get proc address 2'), Name('dawn wire client'))}}(WGPUDevice, WGPUStringView cProcName) {
+DAWN_WIRE_EXPORT WGPUProc {{as_cMethodNamespaced(None, Name('get proc address'), Name('dawn wire client'))}}(WGPUStringView cProcName) {
     if (cProcName.data == nullptr) {
         return nullptr;
     }
diff --git a/src/dawn/dawn.json b/src/dawn/dawn.json
index 4a9c945..f884cdc 100644
--- a/src/dawn/dawn.json
+++ b/src/dawn/dawn.json
@@ -65,15 +65,6 @@
         "category": "function",
         "returns": "proc",
         "args": [
-            {"name": "device", "type": "device", "optional": true},
-            {"name": "proc name", "type": "char", "annotation": "const*"}
-        ]
-    },
-    "get proc address 2": {
-        "category": "function",
-        "returns": "proc",
-        "args": [
-            {"name": "device", "type": "device", "optional": true},
             {"name": "proc name", "type": "string view"}
         ]
     },
diff --git a/src/dawn/tests/end2end/EventTests.cpp b/src/dawn/tests/end2end/EventTests.cpp
index 81eb05d..02d197f 100644
--- a/src/dawn/tests/end2end/EventTests.cpp
+++ b/src/dawn/tests/end2end/EventTests.cpp
@@ -46,9 +46,9 @@
     // IMPORTANT: DawnTest overrides RequestAdapter and RequestDevice and mixes
     // up the two instances. We use these to bypass the override.
     auto* requestAdapter = reinterpret_cast<WGPUProcInstanceRequestAdapter>(
-        wgpu::GetProcAddress(nullptr, "wgpuInstanceRequestAdapter"));
+        wgpu::GetProcAddress("wgpuInstanceRequestAdapter"));
     auto* requestDevice = reinterpret_cast<WGPUProcAdapterRequestDevice>(
-        wgpu::GetProcAddress(nullptr, "wgpuAdapterRequestDevice"));
+        wgpu::GetProcAddress("wgpuAdapterRequestDevice"));
 
     wgpu::Adapter adapter2;
     requestAdapter(
diff --git a/src/dawn/tests/unittests/GetProcAddressTests.cpp b/src/dawn/tests/unittests/GetProcAddressTests.cpp
index c74a53f..9a173cd 100644
--- a/src/dawn/tests/unittests/GetProcAddressTests.cpp
+++ b/src/dawn/tests/unittests/GetProcAddressTests.cpp
@@ -131,57 +131,41 @@
 
 // Test GetProcAddress with and without devices on some valid examples
 TEST_P(GetProcAddressTests, ValidExamples) {
-    ASSERT_EQ(mProcs.getProcAddress2(nullptr, {"wgpuDeviceCreateBuffer", WGPU_STRLEN}),
+    ASSERT_EQ(mProcs.getProcAddress({"wgpuDeviceCreateBuffer", WGPU_STRLEN}),
               reinterpret_cast<WGPUProc>(mProcs.deviceCreateBuffer));
-    ASSERT_EQ(mProcs.getProcAddress2(mDevice.Get(), {"wgpuDeviceCreateBuffer", WGPU_STRLEN}),
-              reinterpret_cast<WGPUProc>(mProcs.deviceCreateBuffer));
-    ASSERT_EQ(mProcs.getProcAddress2(nullptr, {"wgpuQueueSubmit", WGPU_STRLEN}),
-              reinterpret_cast<WGPUProc>(mProcs.queueSubmit));
-    ASSERT_EQ(mProcs.getProcAddress2(mDevice.Get(), {"wgpuQueueSubmit", WGPU_STRLEN}),
+    ASSERT_EQ(mProcs.getProcAddress({"wgpuQueueSubmit", WGPU_STRLEN}),
               reinterpret_cast<WGPUProc>(mProcs.queueSubmit));
     // Test a longer string, truncated correctly with the length field.
-    ASSERT_EQ(mProcs.getProcAddress2(mDevice.Get(), {"wgpuQueueSubmitExtraString", 15}),
+    ASSERT_EQ(mProcs.getProcAddress({"wgpuQueueSubmitExtraString", 15}),
               reinterpret_cast<WGPUProc>(mProcs.queueSubmit));
 }
 
 // Test GetProcAddress with and without devices on nullptr procName
 TEST_P(GetProcAddressTests, Nullptr) {
-    ASSERT_EQ(mProcs.getProcAddress2(nullptr, {nullptr, WGPU_STRLEN}), nullptr);
-    ASSERT_EQ(mProcs.getProcAddress2(mDevice.Get(), {nullptr, WGPU_STRLEN}), nullptr);
+    ASSERT_EQ(mProcs.getProcAddress({nullptr, WGPU_STRLEN}), nullptr);
 }
 
 // Test GetProcAddress with and without devices on some invalid
 TEST_P(GetProcAddressTests, InvalidExamples) {
-    ASSERT_EQ(mProcs.getProcAddress2(nullptr, {"wgpuDeviceDoSomething", WGPU_STRLEN}), nullptr);
-    ASSERT_EQ(mProcs.getProcAddress2(mDevice.Get(), {"wgpuDeviceDoSomething", WGPU_STRLEN}),
-              nullptr);
+    ASSERT_EQ(mProcs.getProcAddress({"wgpuDeviceDoSomething", WGPU_STRLEN}), nullptr);
 
     // Test a "valid" string, truncated to not match with the length field.
-    ASSERT_EQ(mProcs.getProcAddress2(mDevice.Get(), {"wgpuQueueSubmit", 14}), nullptr);
+    ASSERT_EQ(mProcs.getProcAddress({"wgpuQueueSubmit", 14}), nullptr);
 
     // Trigger the condition where lower_bound will return the end of the procMap.
-    ASSERT_EQ(mProcs.getProcAddress2(nullptr, {"zzzzzzz", WGPU_STRLEN}), nullptr);
-    ASSERT_EQ(mProcs.getProcAddress2(mDevice.Get(), {"zzzzzzz", WGPU_STRLEN}), nullptr);
-    ASSERT_EQ(mProcs.getProcAddress2(nullptr, {"ZZ", WGPU_STRLEN}), nullptr);
-    ASSERT_EQ(mProcs.getProcAddress2(mDevice.Get(), {"ZZ", WGPU_STRLEN}), nullptr);
+    ASSERT_EQ(mProcs.getProcAddress({"zzzzzzz", WGPU_STRLEN}), nullptr);
+    ASSERT_EQ(mProcs.getProcAddress({"ZZ", WGPU_STRLEN}), nullptr);
 
     // Some more potential corner cases.
-    ASSERT_EQ(mProcs.getProcAddress2(nullptr, {"", WGPU_STRLEN}), nullptr);
-    ASSERT_EQ(mProcs.getProcAddress2(mDevice.Get(), {"", WGPU_STRLEN}), nullptr);
-    ASSERT_EQ(mProcs.getProcAddress2(nullptr, {"0", WGPU_STRLEN}), nullptr);
-    ASSERT_EQ(mProcs.getProcAddress2(mDevice.Get(), {"0", WGPU_STRLEN}), nullptr);
+    ASSERT_EQ(mProcs.getProcAddress({"", WGPU_STRLEN}), nullptr);
+    ASSERT_EQ(mProcs.getProcAddress({"0", WGPU_STRLEN}), nullptr);
 }
 
 // Test that GetProcAddress supports freestanding function that are handled specially
 TEST_P(GetProcAddressTests, FreeStandingFunctions) {
-    ASSERT_EQ(mProcs.getProcAddress2(nullptr, {"wgpuGetProcAddress", WGPU_STRLEN}),
+    ASSERT_EQ(mProcs.getProcAddress({"wgpuGetProcAddress", WGPU_STRLEN}),
               reinterpret_cast<WGPUProc>(mProcs.getProcAddress));
-    ASSERT_EQ(mProcs.getProcAddress2(mDevice.Get(), {"wgpuGetProcAddress", WGPU_STRLEN}),
-              reinterpret_cast<WGPUProc>(mProcs.getProcAddress));
-
-    ASSERT_EQ(mProcs.getProcAddress2(nullptr, {"wgpuCreateInstance", WGPU_STRLEN}),
-              reinterpret_cast<WGPUProc>(mProcs.createInstance));
-    ASSERT_EQ(mProcs.getProcAddress2(mDevice.Get(), {"wgpuCreateInstance", WGPU_STRLEN}),
+    ASSERT_EQ(mProcs.getProcAddress({"wgpuCreateInstance", WGPU_STRLEN}),
               reinterpret_cast<WGPUProc>(mProcs.createInstance));
 }