@@ -426,19 +426,43 @@ - (BOOL)createShell:(NSString*)entrypoint libraryURI:(NSString*)libraryURI {
426426 return std::make_unique<flutter::Rasterizer>(shell, shell.GetTaskRunners ());
427427 };
428428
429- flutter::TaskRunners task_runners (threadLabel.UTF8String , // label
430- fml::MessageLoop::GetCurrent ().GetTaskRunner (), // platform
431- _threadHost.gpu_thread ->GetTaskRunner (), // gpu
432- _threadHost.ui_thread ->GetTaskRunner (), // ui
433- _threadHost.io_thread ->GetTaskRunner () // io
434- );
435- // Create the shell. This is a blocking operation.
436- _shell = flutter::Shell::Create (std::move (task_runners), // task runners
437- std::move (windowData), // window data
438- std::move (settings), // settings
439- on_create_platform_view, // platform view creation
440- on_create_rasterizer // rasterzier creation
441- );
429+ if (flutter::IsIosEmbeddedViewsPreviewEnabled ()) {
430+ // Embedded views requires the gpu and the platform views to be the same.
431+ // The plan is to eventually dynamically merge the threads when there's a
432+ // platform view in the layer tree.
433+ // For now we use a fixed thread configuration with the same thread used as the
434+ // gpu and platform task runner.
435+ // TODO(amirh/chinmaygarde): remove this, and dynamically change the thread configuration.
436+ // https://github.com/flutter/flutter/issues/23975
437+
438+ flutter::TaskRunners task_runners (threadLabel.UTF8String , // label
439+ fml::MessageLoop::GetCurrent ().GetTaskRunner (), // platform
440+ fml::MessageLoop::GetCurrent ().GetTaskRunner (), // gpu
441+ _threadHost.ui_thread ->GetTaskRunner (), // ui
442+ _threadHost.io_thread ->GetTaskRunner () // io
443+ );
444+ // Create the shell. This is a blocking operation.
445+ _shell = flutter::Shell::Create (std::move (task_runners), // task runners
446+ std::move (windowData), // window data
447+ std::move (settings), // settings
448+ on_create_platform_view, // platform view creation
449+ on_create_rasterizer // rasterzier creation
450+ );
451+ } else {
452+ flutter::TaskRunners task_runners (threadLabel.UTF8String , // label
453+ fml::MessageLoop::GetCurrent ().GetTaskRunner (), // platform
454+ _threadHost.gpu_thread ->GetTaskRunner (), // gpu
455+ _threadHost.ui_thread ->GetTaskRunner (), // ui
456+ _threadHost.io_thread ->GetTaskRunner () // io
457+ );
458+ // Create the shell. This is a blocking operation.
459+ _shell = flutter::Shell::Create (std::move (task_runners), // task runners
460+ std::move (windowData), // window data
461+ std::move (settings), // settings
462+ on_create_platform_view, // platform view creation
463+ on_create_rasterizer // rasterzier creation
464+ );
465+ }
442466
443467 if (_shell == nullptr ) {
444468 FML_LOG (ERROR) << " Could not start a shell FlutterEngine with entrypoint: "
0 commit comments