0

[media] Remove FlushPendingWork from VRU::ClearFrameResources

Now that the ClientSharedImage destructor calls DestroySharedImage
which in turn can ensure that the deferred destroy request is flushed,
clients don't need to call Flush explicitly. In this case, the
Flush is called through context provider's FlushPendingWork.

This change removes Flush call from VideoResourceUpdater's
ClearFrameResources.

Bug: 399387909
Change-Id: I0fa7b4dcb08d440d330e576d06154322e45902e0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6343313
Reviewed-by: Vasiliy Telezhnikov <vasilyt@chromium.org>
Reviewed-by: Dale Curtis <dalecurtis@chromium.org>
Commit-Queue: Saifuddin Hitawala <hitawala@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1430977}
This commit is contained in:
Saifuddin Hitawala
2025-03-11 10:23:35 -07:00
committed by Chromium LUCI CQ
parent d935146c7f
commit 14f7ae2968

@ -703,22 +703,16 @@ void VideoResourceUpdater::AppendQuad(
void VideoResourceUpdater::ClearFrameResources() {
// Delete recycled resources that are not in use anymore.
bool cleared_resources = std::erase_if(
all_resources_, [](const std::unique_ptr<FrameResource>& resource) {
// Resources that are still being used can't be deleted.
return !resource->has_refs();
});
std::erase_if(all_resources_,
[](const std::unique_ptr<FrameResource>& resource) {
// Resources that are still being used can't be deleted.
return !resource->has_refs();
});
// May have destroyed resources above, make sure that it gets to the other
// side. SharedImage destruction (which may be triggered by the removal of
// canvas resources above) is a deferred message, we need to flush pending
// work to ensure that it is not merely queued, but is executed on the service
// side.
if (cleared_resources && context_provider_) {
if (auto* context_support = context_provider_->ContextSupport()) {
context_support->FlushPendingWork();
}
}
// May have destroyed resources above that contains shared images.
// ClientSharedImage destructor calls DestroySharedImage which in turn ensures
// that the deferred destroy request from above is flushed. Thus,
// SharedImageInterface::Flush in not needed here explicitly.
}
VideoFrameExternalResource