dawn_wire: Make GetProcs() a static member function of WireClient
This patch makes GetProcs() a static member function of WireClient so
that we can call it without creating a WireClient object.
BUG=chromium:996713
Change-Id: I499be0cd2c5a5f29c796d3be88ce33c1b70711d6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14942
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
diff --git a/examples/SampleUtils.cpp b/examples/SampleUtils.cpp
index 3dcf0e5..b2bf1e58 100644
--- a/examples/SampleUtils.cpp
+++ b/examples/SampleUtils.cpp
@@ -151,7 +151,7 @@
wireClient = new dawn_wire::WireClient(clientDesc);
WGPUDevice clientDevice = wireClient->GetDevice();
- DawnProcTable clientProcs = wireClient->GetProcs();
+ DawnProcTable clientProcs = dawn_wire::WireClient::GetProcs();
s2cBuf->SetHandler(wireClient);
procs = clientProcs;
diff --git a/src/dawn_wire/WireClient.cpp b/src/dawn_wire/WireClient.cpp
index ac0a25a..972d6de 100644
--- a/src/dawn_wire/WireClient.cpp
+++ b/src/dawn_wire/WireClient.cpp
@@ -25,12 +25,13 @@
mImpl.reset();
}
- WGPUDevice WireClient::GetDevice() const {
- return mImpl->GetDevice();
+ // static
+ DawnProcTable WireClient::GetProcs() {
+ return client::GetProcs();
}
- DawnProcTable WireClient::GetProcs() const {
- return client::GetProcs();
+ WGPUDevice WireClient::GetDevice() const {
+ return mImpl->GetDevice();
}
const volatile char* WireClient::HandleCommands(const volatile char* commands, size_t size) {
diff --git a/src/include/dawn_wire/WireClient.h b/src/include/dawn_wire/WireClient.h
index 376151e..3b9d872 100644
--- a/src/include/dawn_wire/WireClient.h
+++ b/src/include/dawn_wire/WireClient.h
@@ -44,8 +44,9 @@
WireClient(const WireClientDescriptor& descriptor);
~WireClient();
+ static DawnProcTable GetProcs();
+
WGPUDevice GetDevice() const;
- DawnProcTable GetProcs() const;
const volatile char* HandleCommands(const volatile char* commands,
size_t size) override final;
diff --git a/src/tests/DawnTest.cpp b/src/tests/DawnTest.cpp
index 0f419e4..ba7285d 100644
--- a/src/tests/DawnTest.cpp
+++ b/src/tests/DawnTest.cpp
@@ -557,7 +557,7 @@
mWireClient.reset(new dawn_wire::WireClient(clientDesc));
WGPUDevice clientDevice = mWireClient->GetDevice();
- DawnProcTable clientProcs = mWireClient->GetProcs();
+ DawnProcTable clientProcs = dawn_wire::WireClient::GetProcs();
mS2cBuf->SetHandler(mWireClient.get());
procs = clientProcs;
diff --git a/src/tests/unittests/GetProcAddressTests.cpp b/src/tests/unittests/GetProcAddressTests.cpp
index ac9c67d..0d6c209 100644
--- a/src/tests/unittests/GetProcAddressTests.cpp
+++ b/src/tests/unittests/GetProcAddressTests.cpp
@@ -72,7 +72,7 @@
mWireClient = std::make_unique<dawn_wire::WireClient>(clientDesc);
mDevice = wgpu::Device::Acquire(mWireClient->GetDevice());
- mProcs = mWireClient->GetProcs();
+ mProcs = dawn_wire::WireClient::GetProcs();
break;
}
diff --git a/src/tests/unittests/wire/WireTest.cpp b/src/tests/unittests/wire/WireTest.cpp
index 9dce5e7..ee4a62b 100644
--- a/src/tests/unittests/wire/WireTest.cpp
+++ b/src/tests/unittests/wire/WireTest.cpp
@@ -66,7 +66,7 @@
mS2cBuf->SetHandler(mWireClient.get());
device = mWireClient->GetDevice();
- DawnProcTable clientProcs = mWireClient->GetProcs();
+ DawnProcTable clientProcs = dawn_wire::WireClient::GetProcs();
dawnProcSetProcs(&clientProcs);
apiDevice = mockDevice;