Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions lib/ui/painting/image_decoder_impeller.cc
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,9 @@ ImageDecoderImpeller::UploadTextureToStorage(
}

texture->SetLabel(impeller::SPrintF("ui.Image(%p)", texture.get()).c_str());

context->DisposeThreadLocalCachedResources();

return std::make_pair(impeller::DlImageImpeller::Make(std::move(texture)),
std::string());
}
Expand Down
7 changes: 7 additions & 0 deletions lib/ui/painting/image_decoder_unittests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,12 @@ class TestImpellerContext : public impeller::Context {
tasks_.clear();
}

void DisposeThreadLocalCachedResources() override { did_dispose_ = true; }

void Shutdown() override {}

bool DidDisposeResources() const { return did_dispose_; }

mutable size_t command_buffer_count_ = 0;

private:
Expand All @@ -103,6 +107,7 @@ class TestImpellerContext : public impeller::Context {
};
std::vector<PendingTask> tasks_;
std::shared_ptr<const Capabilities> capabilities_;
bool did_dispose_ = false;
};

} // namespace impeller
Expand Down Expand Up @@ -367,12 +372,14 @@ TEST_F(ImageDecoderFixtureTest, ImpellerUploadToSharedNoGpu) {

EXPECT_EQ(no_gpu_access_context->command_buffer_count_, 0ul);
EXPECT_FALSE(invoked);
EXPECT_EQ(no_gpu_access_context->DidDisposeResources(), false);

auto result = ImageDecoderImpeller::UploadTextureToStorage(
no_gpu_access_context, bitmap);

ASSERT_EQ(no_gpu_access_context->command_buffer_count_, 0ul);
ASSERT_EQ(result.second, "");
EXPECT_EQ(no_gpu_access_context->DidDisposeResources(), true);

no_gpu_access_context->FlushTasks(/*fail=*/true);
}
Expand Down