From 13c0c1a096956b78bbf447f7cc6d00cd2e905dfb Mon Sep 17 00:00:00 2001 From: gaaclarke <30870216+gaaclarke@users.noreply.github.com> Date: Mon, 15 Mar 2021 14:22:27 -0700 Subject: [PATCH] Fixed issue where the gpu disable syncswitch was being overridden after init. (flutter/engine#24958) --- .../darwin/ios/framework/Source/FlutterEngine.mm | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterEngine.mm b/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterEngine.mm index d635988dde..8ab6c4d2cc 100644 --- a/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterEngine.mm +++ b/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterEngine.mm @@ -526,7 +526,6 @@ static constexpr int kNumProfilerSamplesPerSec = 5; _publisher.reset([[FlutterObservatoryPublisher alloc] initWithEnableObservatoryPublication:doesObservatoryPublication]); [self maybeSetupPlatformViewChannels]; - _shell->GetIsGpuDisabledSyncSwitch()->SetSwitch(_isGpuDisabled ? true : false); } + (BOOL)isProfilerEnabled { @@ -611,15 +610,15 @@ static void SetEntryPoint(flutter::Settings* settings, NSString* entrypoint, NSS _threadHost->io_thread->GetTaskRunner() // io ); + _isGpuDisabled = [UIApplication sharedApplication].applicationState != UIApplicationStateActive; // Create the shell. This is a blocking operation. std::unique_ptr shell = flutter::Shell::Create( - std::move(platformData), // window data - std::move(task_runners), // task runners - std::move(settings), // settings - on_create_platform_view, // platform view creation - on_create_rasterizer, // rasterzier creation - /*is_gpu_disabled=*/[UIApplication sharedApplication].applicationState != - UIApplicationStateActive); + /*platform_data=*/std::move(platformData), + /*task_runners=*/std::move(task_runners), + /*settings=*/std::move(settings), + /*on_create_platform_view=*/on_create_platform_view, + /*on_create_rasterizer=*/on_create_rasterizer, + /*is_gpu_disabled=*/_isGpuDisabled); if (shell == nullptr) { FML_LOG(ERROR) << "Could not start a shell FlutterEngine with entrypoint: "