This repository was archived by the owner on Feb 25, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +15
-4
lines changed
shell/platform/darwin/ios/framework/Source Expand file tree Collapse file tree 1 file changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -452,10 +452,19 @@ - (BOOL)createShell:(NSString*)entrypoint libraryURI:(NSString*)libraryURI {
452452 // initialized.
453453 fml::MessageLoop::EnsureInitializedForCurrentThread ();
454454
455- // TODO (kaushikiska): enable Profiler thread only in debug configurations.
455+ flutter::ThreadHost::Type threadHostType = flutter::ThreadHost::Type::UI |
456+ flutter::ThreadHost::Type::GPU |
457+ flutter::ThreadHost::Type::IO;
458+ bool profilerEnabled = false ;
459+ #if (FLUTTER_RUNTIME_MODE == FLUTTER_RUNTIME_MODE_DEBUG) || \
460+ (FLUTTER_RUNTIME_MODE == FLUTTER_RUNTIME_MODE_PROFILE)
461+ profilerEnabled = true ;
462+ #endif
463+ if (profilerEnabled) {
464+ threadHostType = threadHostType | flutter::ThreadHost::Type::Profiler;
465+ }
456466 _threadHost = {threadLabel.UTF8String , // label
457- flutter::ThreadHost::Type::UI | flutter::ThreadHost::Type::GPU |
458- flutter::ThreadHost::Type::IO | flutter::ThreadHost::Type::Profiler};
467+ threadHostType};
459468
460469 // Lambda captures by pointers to ObjC objects are fine here because the
461470 // create call is
@@ -471,7 +480,9 @@ - (BOOL)createShell:(NSString*)entrypoint libraryURI:(NSString*)libraryURI {
471480 return std::make_unique<flutter::Rasterizer>(shell, shell.GetTaskRunners ());
472481 };
473482
474- [self startProfiler ];
483+ if (profilerEnabled) {
484+ [self startProfiler ];
485+ }
475486
476487 if (flutter::IsIosEmbeddedViewsPreviewEnabled ()) {
477488 // Embedded views requires the gpu and the platform views to be the same.
You can’t perform that action at this time.
0 commit comments