mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Fix a race in ShellTest.EncodeImageFailsWithoutGPUImpeller (#167669)
This commit is contained in:
parent
8440a6e75f
commit
e1630da24f
@ -464,13 +464,16 @@ TEST_F(ShellTest, EncodeImageFailsWithoutGPUImpeller) {
|
||||
AddNativeCallback("TurnOffGPU", CREATE_NATIVE_ENTRY(turn_off_gpu));
|
||||
|
||||
auto flush_awaiting_tasks = [&](Dart_NativeArguments args) {
|
||||
task_runners.GetIOTaskRunner()->PostTask([&] {
|
||||
std::shared_ptr<impeller::Context> impeller_context =
|
||||
shell->GetIOManager()->GetImpellerContext();
|
||||
// This will cause the stored tasks to overflow and start throwing them
|
||||
// away.
|
||||
for (int i = 0; i < impeller::Context::kMaxTasksAwaitingGPU; i++) {
|
||||
impeller_context->StoreTaskForGPU([] {}, [] {});
|
||||
fml::WeakPtr io_manager = shell->GetIOManager();
|
||||
task_runners.GetIOTaskRunner()->PostTask([io_manager] {
|
||||
if (io_manager) {
|
||||
std::shared_ptr<impeller::Context> impeller_context =
|
||||
io_manager->GetImpellerContext();
|
||||
// This will cause the stored tasks to overflow and start throwing them
|
||||
// away.
|
||||
for (int i = 0; i < impeller::Context::kMaxTasksAwaitingGPU; i++) {
|
||||
impeller_context->StoreTaskForGPU([] {}, [] {});
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user