dawn_wire: Implement device-related callbacks for multiple devices

Bug: dawn:565
Change-Id: Ic80a3bc1bbfd479af04e77afa0eb3f4ca3387ecd
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/38282
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
Austin Eng
2021-01-25 08:38:47 +00:00
committed by Commit Bot service account
parent f1f8394de0
commit 4d66fb2d61
9 changed files with 146 additions and 74 deletions

View File

@@ -129,14 +129,18 @@ namespace dawn_wire { namespace client {
void Client::Disconnect() {
mDisconnected = true;
mSerializer = ChunkedCommandSerializer(NoopCommandSerializer::GetInstance());
if (mDevice != nullptr) {
mDevice->HandleDeviceLost("GPU connection lost");
auto& deviceList = mObjects[ObjectType::Device];
{
for (LinkNode<ObjectBase>* device = deviceList.head(); device != deviceList.end();
device = device->next()) {
static_cast<Device*>(device->value())->HandleDeviceLost("GPU connection lost");
}
}
for (auto& objectList : mObjects) {
LinkNode<ObjectBase>* object = objectList.head();
while (object != objectList.end()) {
for (LinkNode<ObjectBase>* object = objectList.head(); object != objectList.end();
object = object->next()) {
object->value()->CancelCallbacksForDisconnect();
object = object->next();
}
}
}