mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-17 00:47:13 +00:00
Reland "Replace the wire serializer with a no-op impl on disconnect"
This is a reland of e757c012be
It changes a global noop serializer from a global static to a local
function static that's constructed on first use.
Original change's description:
> Replace the wire serializer with a no-op impl on disconnect
>
> Now that the command serialization knows to no-op if
> GetCmdSpace returns nullptr, when the wire is disconnected,
> we can replace it with a no-op serializer that always returns
> nullptr.
>
> Bug: chromium:951558
> Change-Id: I7363fd10f529119e515eda0e743e1a7839049b9b
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/30000
> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
> Reviewed-by: Stephen White <senorblanco@chromium.org>
> Commit-Queue: Austin Eng <enga@chromium.org>
Bug: chromium:951558
Change-Id: I827cdbd212fa585b542fd4ea1eb9654eec6002c7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/30420
Reviewed-by: Stephen White <senorblanco@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
This commit is contained in:
committed by
Commit Bot service account
parent
ae5f950444
commit
d676f44272
@@ -19,6 +19,30 @@
|
||||
|
||||
namespace dawn_wire { namespace client {
|
||||
|
||||
namespace {
|
||||
|
||||
class NoopCommandSerializer final : public CommandSerializer {
|
||||
public:
|
||||
static NoopCommandSerializer* GetInstance() {
|
||||
static NoopCommandSerializer gNoopCommandSerializer;
|
||||
return &gNoopCommandSerializer;
|
||||
}
|
||||
|
||||
~NoopCommandSerializer() = default;
|
||||
|
||||
size_t GetMaximumAllocationSize() const final {
|
||||
return 0;
|
||||
}
|
||||
void* GetCmdSpace(size_t size) final {
|
||||
return nullptr;
|
||||
}
|
||||
bool Flush() final {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
Client::Client(CommandSerializer* serializer, MemoryTransferService* memoryTransferService)
|
||||
: ClientBase(), mSerializer(serializer), mMemoryTransferService(memoryTransferService) {
|
||||
if (mMemoryTransferService == nullptr) {
|
||||
@@ -53,11 +77,7 @@ namespace dawn_wire { namespace client {
|
||||
}
|
||||
|
||||
void Client::Disconnect() {
|
||||
if (mDisconnected) {
|
||||
return;
|
||||
}
|
||||
|
||||
mDisconnected = true;
|
||||
mSerializer = ChunkedCommandSerializer(NoopCommandSerializer::GetInstance());
|
||||
if (mDevice != nullptr) {
|
||||
mDevice->HandleDeviceLost("GPU connection lost");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user