From e07571cfcd3f292bae4144ac49ef68af94b36b42 Mon Sep 17 00:00:00 2001 From: Chris Yang Date: Mon, 27 Jan 2020 14:40:07 -0800 Subject: [PATCH 1/2] enable thread merging --- .../darwin/ios/framework/Source/FlutterEngine.mm | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/shell/platform/darwin/ios/framework/Source/FlutterEngine.mm b/shell/platform/darwin/ios/framework/Source/FlutterEngine.mm index ec22caa532f45..64de1d04de6c3 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterEngine.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterEngine.mm @@ -427,17 +427,9 @@ - (BOOL)createShell:(NSString*)entrypoint libraryURI:(NSString*)libraryURI { }; if (flutter::IsIosEmbeddedViewsPreviewEnabled()) { - // Embedded views requires the gpu and the platform views to be the same. - // The plan is to eventually dynamically merge the threads when there's a - // platform view in the layer tree. - // For now we use a fixed thread configuration with the same thread used as the - // gpu and platform task runner. - // TODO(amirh/chinmaygarde): remove this, and dynamically change the thread configuration. - // https://github.com/flutter/flutter/issues/23975 - flutter::TaskRunners task_runners(threadLabel.UTF8String, // label fml::MessageLoop::GetCurrent().GetTaskRunner(), // platform - fml::MessageLoop::GetCurrent().GetTaskRunner(), // gpu + _threadHost.gpu_thread->GetTaskRunner(), // gpu _threadHost.ui_thread->GetTaskRunner(), // ui _threadHost.io_thread->GetTaskRunner() // io ); From 2c423f9d0036043f3eb5f87f403354c1dc9e5259 Mon Sep 17 00:00:00 2001 From: Chris Yang Date: Mon, 27 Jan 2020 14:41:15 -0800 Subject: [PATCH 2/2] enable --- .../ios/framework/Source/FlutterEngine.mm | 42 ++++++------------- 1 file changed, 13 insertions(+), 29 deletions(-) diff --git a/shell/platform/darwin/ios/framework/Source/FlutterEngine.mm b/shell/platform/darwin/ios/framework/Source/FlutterEngine.mm index 64de1d04de6c3..24563a860eab5 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterEngine.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterEngine.mm @@ -426,35 +426,19 @@ - (BOOL)createShell:(NSString*)entrypoint libraryURI:(NSString*)libraryURI { return std::make_unique(shell, shell.GetTaskRunners()); }; - if (flutter::IsIosEmbeddedViewsPreviewEnabled()) { - flutter::TaskRunners task_runners(threadLabel.UTF8String, // label - fml::MessageLoop::GetCurrent().GetTaskRunner(), // platform - _threadHost.gpu_thread->GetTaskRunner(), // gpu - _threadHost.ui_thread->GetTaskRunner(), // ui - _threadHost.io_thread->GetTaskRunner() // io - ); - // Create the shell. This is a blocking operation. - _shell = flutter::Shell::Create(std::move(task_runners), // task runners - std::move(windowData), // window data - std::move(settings), // settings - on_create_platform_view, // platform view creation - on_create_rasterizer // rasterzier creation - ); - } else { - flutter::TaskRunners task_runners(threadLabel.UTF8String, // label - fml::MessageLoop::GetCurrent().GetTaskRunner(), // platform - _threadHost.gpu_thread->GetTaskRunner(), // gpu - _threadHost.ui_thread->GetTaskRunner(), // ui - _threadHost.io_thread->GetTaskRunner() // io - ); - // Create the shell. This is a blocking operation. - _shell = flutter::Shell::Create(std::move(task_runners), // task runners - std::move(windowData), // window data - std::move(settings), // settings - on_create_platform_view, // platform view creation - on_create_rasterizer // rasterzier creation - ); - } + flutter::TaskRunners task_runners(threadLabel.UTF8String, // label + fml::MessageLoop::GetCurrent().GetTaskRunner(), // platform + _threadHost.gpu_thread->GetTaskRunner(), // gpu + _threadHost.ui_thread->GetTaskRunner(), // ui + _threadHost.io_thread->GetTaskRunner() // io + ); + // Create the shell. This is a blocking operation. + _shell = flutter::Shell::Create(std::move(task_runners), // task runners + std::move(windowData), // window data + std::move(settings), // settings + on_create_platform_view, // platform view creation + on_create_rasterizer // rasterzier creation + ); if (_shell == nullptr) { FML_LOG(ERROR) << "Could not start a shell FlutterEngine with entrypoint: "