[Impeller] fix cmd buffer recycling bug in test. (flutter/engine#50615)

Speculative fix for a flake seen by @matanlurey . In the past we've seen race conditions when a single DeathRattle is used, because it actually gets destructed before the cmd pool state. By adding two and waiting we guaranteee that everything has completed in the resource manager.
This commit is contained in:
Jonah Williams 2024-02-13 14:33:16 -08:00 committed by GitHub
parent 9b11e555f4
commit a656286e39

View File

@ -128,13 +128,15 @@ TEST(CommandPoolRecyclerVKTest, CommandBuffersAreRecycled) {
}
// Wait for the pool to be reclaimed.
auto waiter = fml::AutoResetWaitableEvent();
auto rattle = DeathRattle([&waiter]() { waiter.Signal(); });
{
UniqueResourceVKT<DeathRattle> resource(context->GetResourceManager(),
std::move(rattle));
for (auto i = 0u; i < 2u; i++) {
auto waiter = fml::AutoResetWaitableEvent();
auto rattle = DeathRattle([&waiter]() { waiter.Signal(); });
{
UniqueResourceVKT<DeathRattle> resource(context->GetResourceManager(),
std::move(rattle));
}
waiter.Wait();
}
waiter.Wait();
{
// Create a second pool and command buffer, which should reused the existing