0

[Blink] Fix CanvasResourceDispatcher test resource lifetime handling

It should return the placeholder's ref on the CanvasResource back to the
CanvasResourceDispatcher rather than letting it drop on the floor as it
does now, which breaks the invariant that the placeholder canvas returns
its ref to the CanvasResourceDispatcher when it's done with it.
Upholding this invariant in these tests will be necessary for followup
work I'm doing (which is what uncovered this issue).

Bug: 352263194
Change-Id: I137e696935297c4bf7d1a1bd582f4ccf691a3ac9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6445254
Reviewed-by: Vasiliy Telezhnikov <vasilyt@chromium.org>
Commit-Queue: Colin Blundell <blundell@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1445708}
This commit is contained in:
Colin Blundell
2025-04-11 00:53:10 -07:00
committed by Chromium LUCI CQ
parent ba1946bd7f
commit 1352482a61

@@ -443,6 +443,9 @@ TEST_P(CanvasResourceDispatcherTest, DispatchFrame) {
Dispatcher()->DispatchFrame(canvas_resource, base::TimeTicks::Now(),
damage_rect, !context_alpha /* is_opaque */);
platform->RunUntilIdle();
viz::ResourceId reclaim_resource_id(1u);
Dispatcher()->OnPlaceholderReleasedResource(reclaim_resource_id,
std::move(canvas_resource));
}
const TestParams kTestCases[] = {