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>
This commit is contained in:
Jiawei Shao 2020-01-10 00:02:38 +00:00 committed by Commit Bot service account
parent 1dbb528629
commit e6441b604f
6 changed files with 11 additions and 9 deletions

View File

@ -151,7 +151,7 @@ wgpu::Device CreateCppDawnDevice() {
wireClient = new dawn_wire::WireClient(clientDesc); wireClient = new dawn_wire::WireClient(clientDesc);
WGPUDevice clientDevice = wireClient->GetDevice(); WGPUDevice clientDevice = wireClient->GetDevice();
DawnProcTable clientProcs = wireClient->GetProcs(); DawnProcTable clientProcs = dawn_wire::WireClient::GetProcs();
s2cBuf->SetHandler(wireClient); s2cBuf->SetHandler(wireClient);
procs = clientProcs; procs = clientProcs;

View File

@ -25,12 +25,13 @@ namespace dawn_wire {
mImpl.reset(); mImpl.reset();
} }
WGPUDevice WireClient::GetDevice() const { // static
return mImpl->GetDevice(); DawnProcTable WireClient::GetProcs() {
return client::GetProcs();
} }
DawnProcTable WireClient::GetProcs() const { WGPUDevice WireClient::GetDevice() const {
return client::GetProcs(); return mImpl->GetDevice();
} }
const volatile char* WireClient::HandleCommands(const volatile char* commands, size_t size) { const volatile char* WireClient::HandleCommands(const volatile char* commands, size_t size) {

View File

@ -44,8 +44,9 @@ namespace dawn_wire {
WireClient(const WireClientDescriptor& descriptor); WireClient(const WireClientDescriptor& descriptor);
~WireClient(); ~WireClient();
static DawnProcTable GetProcs();
WGPUDevice GetDevice() const; WGPUDevice GetDevice() const;
DawnProcTable GetProcs() const;
const volatile char* HandleCommands(const volatile char* commands, const volatile char* HandleCommands(const volatile char* commands,
size_t size) override final; size_t size) override final;

View File

@ -557,7 +557,7 @@ void DawnTestBase::SetUp() {
mWireClient.reset(new dawn_wire::WireClient(clientDesc)); mWireClient.reset(new dawn_wire::WireClient(clientDesc));
WGPUDevice clientDevice = mWireClient->GetDevice(); WGPUDevice clientDevice = mWireClient->GetDevice();
DawnProcTable clientProcs = mWireClient->GetProcs(); DawnProcTable clientProcs = dawn_wire::WireClient::GetProcs();
mS2cBuf->SetHandler(mWireClient.get()); mS2cBuf->SetHandler(mWireClient.get());
procs = clientProcs; procs = clientProcs;

View File

@ -72,7 +72,7 @@ namespace {
mWireClient = std::make_unique<dawn_wire::WireClient>(clientDesc); mWireClient = std::make_unique<dawn_wire::WireClient>(clientDesc);
mDevice = wgpu::Device::Acquire(mWireClient->GetDevice()); mDevice = wgpu::Device::Acquire(mWireClient->GetDevice());
mProcs = mWireClient->GetProcs(); mProcs = dawn_wire::WireClient::GetProcs();
break; break;
} }

View File

@ -66,7 +66,7 @@ void WireTest::SetUp() {
mS2cBuf->SetHandler(mWireClient.get()); mS2cBuf->SetHandler(mWireClient.get());
device = mWireClient->GetDevice(); device = mWireClient->GetDevice();
DawnProcTable clientProcs = mWireClient->GetProcs(); DawnProcTable clientProcs = dawn_wire::WireClient::GetProcs();
dawnProcSetProcs(&clientProcs); dawnProcSetProcs(&clientProcs);
apiDevice = mockDevice; apiDevice = mockDevice;