未验证 提交 d1d54979 编写于 作者: J Jason Simmons 提交者: GitHub

Drain any pending work on the IO thread before shutting down the platform view (#5272)

iOS does not allow usage of OpenGL ES APIs when the app has been moved to the
background.  With this change, the shell will wait until pending IO thread tasks
complete and the Skia unref queue is drained before proceeding with shutdown.

See https://github.com/flutter/flutter/issues/17511
上级 e32e3903
......@@ -438,13 +438,23 @@ void Shell::OnPlatformViewDestroyed(const PlatformView& view) {
fxl::AutoResetWaitableEvent latch;
auto gpu_task = [rasterizer = rasterizer_->GetWeakPtr(), &latch]() {
auto io_task = [io_manager = io_manager_.get(), &latch]() {
// Execute any pending Skia object deletions while GPU access is still
// allowed.
io_manager->GetSkiaUnrefQueue()->Drain();
// Step 3: All done. Signal the latch that the platform thread is waiting
// on.
latch.Signal();
};
auto gpu_task = [rasterizer = rasterizer_->GetWeakPtr(),
io_task_runner = task_runners_.GetIOTaskRunner(),
io_task]() {
if (rasterizer) {
rasterizer->Teardown();
}
// Step 2: All done. Signal the latch that the platform thread is waiting
// on.
latch.Signal();
// Step 2: Next, tell the IO thread to complete its remaining work.
fml::TaskRunner::RunNowOrPostTask(io_task_runner, io_task);
};
auto ui_task = [engine = engine_->GetWeakPtr(),
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册