dawn_wire: Reject new callbacks if the client is disconnected

If the wire client is disconnected, it will not receive any
messages from the server. Reject all callbacks that are created.

Bug: dawn:556
Change-Id: I2eb2c449b1ca6c8ea3e74040ef095abfc46a9061
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/31161
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
This commit is contained in:
Austin Eng
2020-11-12 18:03:42 +00:00
committed by Commit Bot service account
parent 01e969da33
commit 7ceffe8511
9 changed files with 116 additions and 0 deletions

View File

@@ -83,6 +83,7 @@ namespace dawn_wire { namespace client {
}
void Client::Disconnect() {
mDisconnected = true;
mSerializer = ChunkedCommandSerializer(NoopCommandSerializer::GetInstance());
if (mDevice != nullptr) {
mDevice->HandleDeviceLost("GPU connection lost");
@@ -94,4 +95,8 @@ namespace dawn_wire { namespace client {
mDevices.Append(device);
}
bool Client::IsDisconnected() const {
return mDisconnected;
}
}} // namespace dawn_wire::client