Fix leaking FenceCompletionUserdata in the wire

This was being leaked if the completion status was not a success.

Bug: chromium:939396
Change-Id: Ia09bcef935697b354e6e3da3c4a3d308545fec53
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/5840
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
Austin Eng 2019-03-25 06:36:28 +00:00 committed by Commit Bot service account
parent 24930b382a
commit 041aca1620
2 changed files with 9 additions and 5 deletions

View File

@ -68,7 +68,8 @@ namespace dawn_wire { namespace server {
void* ptr, void* ptr,
uint32_t dataLength, uint32_t dataLength,
MapUserdata* userdata); MapUserdata* userdata);
void OnFenceCompletedValueUpdated(FenceCompletionUserdata* userdata); void OnFenceCompletedValueUpdated(DawnFenceCompletionStatus status,
FenceCompletionUserdata* userdata);
#include "dawn_wire/server/ServerPrototypes_autogen.inl" #include "dawn_wire/server/ServerPrototypes_autogen.inl"

View File

@ -21,14 +21,17 @@ namespace dawn_wire { namespace server {
void Server::ForwardFenceCompletedValue(DawnFenceCompletionStatus status, void Server::ForwardFenceCompletedValue(DawnFenceCompletionStatus status,
DawnCallbackUserdata userdata) { DawnCallbackUserdata userdata) {
auto data = reinterpret_cast<FenceCompletionUserdata*>(static_cast<uintptr_t>(userdata)); auto data = reinterpret_cast<FenceCompletionUserdata*>(static_cast<uintptr_t>(userdata));
if (status == DAWN_FENCE_COMPLETION_STATUS_SUCCESS) { data->server->OnFenceCompletedValueUpdated(status, data);
data->server->OnFenceCompletedValueUpdated(data);
}
} }
void Server::OnFenceCompletedValueUpdated(FenceCompletionUserdata* userdata) { void Server::OnFenceCompletedValueUpdated(DawnFenceCompletionStatus status,
FenceCompletionUserdata* userdata) {
std::unique_ptr<FenceCompletionUserdata> data(userdata); std::unique_ptr<FenceCompletionUserdata> data(userdata);
if (status != DAWN_FENCE_COMPLETION_STATUS_SUCCESS) {
return;
}
ReturnFenceUpdateCompletedValueCmd cmd; ReturnFenceUpdateCompletedValueCmd cmd;
cmd.fence = data->fence; cmd.fence = data->fence;
cmd.value = data->value; cmd.value = data->value;