Remove special-casing of device reference/release in the wire

The wire's device is externally owned so reference/release were no-ops.
To unify the code paths, remove the special casing and instead
take an extra ref on the device the wire server is created with. This
is functionally equivalent and will allow both the current wire code,
and the incoming change to allow multiple device/adapter creation to
both work.

This CL also makes it possible for the client to destroy the device
before child objects.
A follow-up CL will mitigate this on the server side.

Bug: dawn:384
Change-Id: Ic5427074469012dccf8689ec95a848e6ba2c1fc2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/37001
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
Austin Eng
2021-01-13 19:23:48 +00:00
committed by Commit Bot service account
parent f0d7cc4f5a
commit 5ad5557667
9 changed files with 41 additions and 51 deletions

View File

@@ -55,6 +55,7 @@ void WireTest::SetUp() {
serverDesc.serializer = mS2cBuf.get();
serverDesc.memoryTransferService = GetServerMemoryTransferService();
EXPECT_CALL(api, DeviceReference(mockDevice));
mWireServer.reset(new WireServer(serverDesc));
mC2sBuf->SetHandler(mWireServer.get());
@@ -117,6 +118,7 @@ dawn_wire::WireClient* WireTest::GetWireClient() {
void WireTest::DeleteServer() {
EXPECT_CALL(api, QueueRelease(apiQueue)).Times(1);
EXPECT_CALL(api, DeviceRelease(apiDevice)).Times(1);
if (mWireServer) {
// These are called on server destruction to clear the callbacks. They must not be