Skip to content

Commit 5b57281

Browse files
committed
iOS: Remove the IOSRenderingAPI selection code
Flutter iOS requires Metal. Skia support has been removed. Impeller has no software fallback. `IOSRenderingAPI` had one value (`kMetal`) and `GetRenderingAPIForProcess` only ever returned that value after asserting Metal was available. This removes the enum and the selection plumbing that was threaded through the engine, view, platform view, and context. `GetCoreAnimationLayerClassForRenderingAPI` still returns `FlutterMetalLayer` or `CAMetalLayer` depending on embedder settings. Issue: flutter#190041
1 parent 9b8cb9c commit 5b57281

15 files changed

Lines changed: 25 additions & 172 deletions

‎engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterEngine+Test.h‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
#import "flutter/shell/platform/darwin/ios/framework/Headers/FlutterEngine.h"
1010
#import "flutter/shell/platform/darwin/ios/framework/Source/FlutterTextInputDelegate.h"
1111
#include "flutter/shell/platform/darwin/ios/platform_view_ios.h"
12-
#import "flutter/shell/platform/darwin/ios/rendering_api_selection.h"
1312
#include "flutter/shell/platform/embedder/embedder.h"
1413

1514
@class FlutterBinaryMessengerRelay;
@@ -30,7 +29,6 @@ class ThreadHost;
3029
- (flutter::PlatformViewIOS*)platformView;
3130

3231
- (void)setBinaryMessenger:(FlutterBinaryMessengerRelay*)binaryMessenger;
33-
- (flutter::IOSRenderingAPI)platformViewsRenderingAPI;
3432
- (void)waitForFirstFrame:(NSTimeInterval)timeout callback:(void (^)(BOOL didTimeout))callback;
3533
- (FlutterEngine*)spawnWithEntrypoint:(/*nullable*/ NSString*)entrypoint
3634
libraryURI:(/*nullable*/ NSString*)libraryURI

‎engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterEngine.mm‎

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@
4141
#import "flutter/shell/platform/darwin/ios/framework/Source/profiler_metrics_ios.h"
4242
#import "flutter/shell/platform/darwin/ios/framework/Source/vsync_waiter_ios.h"
4343
#import "flutter/shell/platform/darwin/ios/platform_view_ios.h"
44-
#import "flutter/shell/platform/darwin/ios/rendering_api_selection.h"
4544
#include "flutter/shell/profiling/sampling_profiler.h"
4645

4746
FLUTTER_ASSERT_ARC
@@ -200,7 +199,6 @@ @implementation FlutterEngine {
200199
// -destroyContext must wait for this group to drain before it is safe to free _shell.
201200
dispatch_group_t _firstFrameWaiters;
202201

203-
flutter::IOSRenderingAPI _renderingApi;
204202
std::shared_ptr<flutter::SamplingProfiler> _profiler;
205203

206204
FlutterBinaryMessengerRelay* _binaryMessenger;
@@ -343,14 +341,9 @@ - (void)sceneWillConnect:(NSNotification*)notification API_AVAILABLE(ios(13.0))
343341
}
344342

345343
- (void)recreatePlatformViewsController {
346-
_renderingApi = flutter::GetRenderingAPIForProcess();
347344
_platformViewsController = [[FlutterPlatformViewsController alloc] init];
348345
}
349346

350-
- (flutter::IOSRenderingAPI)platformViewsRenderingAPI {
351-
return _renderingApi;
352-
}
353-
354347
- (void)dealloc {
355348
/// Notify plugins of dealloc. This should happen first in dealloc since the
356349
/// plugins may be talking to things like the binaryMessenger.
@@ -926,9 +919,9 @@ - (BOOL)createShell:(NSString*)entrypoint
926919
[strongSelf recreatePlatformViewsController];
927920
strongSelf.platformViewsController.taskRunner = [[FlutterFMLTaskRunner alloc]
928921
initWithTaskRunner:shell.GetTaskRunners().GetPlatformTaskRunner()];
929-
return std::make_unique<flutter::PlatformViewIOS>(
930-
shell, strongSelf->_renderingApi, strongSelf.platformViewsController,
931-
shell.GetTaskRunners(), shell.GetIsGpuDisabledSyncSwitch());
922+
return std::make_unique<flutter::PlatformViewIOS>(shell, strongSelf.platformViewsController,
923+
shell.GetTaskRunners(),
924+
shell.GetIsGpuDisabledSyncSwitch());
932925
};
933926

934927
flutter::Shell::CreateCallback<flutter::Rasterizer> on_create_rasterizer =

‎engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterEnginePlatformViewTest.mm‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ - (void)setUp {
8686
/*io=*/thread_task_runner);
8787
platform_view = std::make_unique<flutter::PlatformViewIOS>(
8888
/*delegate=*/fake_delegate,
89-
/*rendering_api=*/flutter::IOSRenderingAPI::kMetal,
9089
/*platform_views_controller=*/nil,
9190
/*task_runners=*/runners,
9291
/*is_gpu_disabled_sync_switch=*/sync_switch);

‎engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterEngineTest.mm‎

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -284,14 +284,6 @@ - (void)testInitialRouteSettingsSendsNavigationMessage {
284284
message:encodedSetInitialRouteMethod]);
285285
}
286286

287-
- (void)testPlatformViewsControllerRenderingMetalBackend {
288-
FlutterEngine* engine = [[FlutterEngine alloc] init];
289-
[engine run];
290-
flutter::IOSRenderingAPI renderingApi = [engine platformViewsRenderingAPI];
291-
292-
XCTAssertEqual(renderingApi, flutter::IOSRenderingAPI::kMetal);
293-
}
294-
295287
- (void)testWaitForFirstFrameTimeout {
296288
FlutterEngine* engine = [[FlutterEngine alloc] initWithName:@"foobar"];
297289
[engine run];

‎engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterPlatformViewsTest.mm‎

Lines changed: 0 additions & 53 deletions
Large diffs are not rendered by default.

‎engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterTextInputPluginTest.mm‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -891,7 +891,6 @@ - (void)testHotRestart {
891891
thread_task_runner->PostTask([&] {
892892
auto platform_view = std::make_unique<flutter::PlatformViewIOS>(
893893
/*delegate=*/mock_platform_view_delegate,
894-
/*rendering_api=*/flutter::IOSRenderingAPI::kMetal,
895894
/*platform_views_controller=*/nil,
896895
/*task_runners=*/runners,
897896
/*is_gpu_disabled_sync_switch=*/std::make_shared<fml::SyncSwitch>());

‎engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterView.mm‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#import "flutter/shell/platform/darwin/ios/framework/Source/FlutterSceneLifeCycle_Internal.h"
99
#import "flutter/shell/platform/darwin/ios/framework/Source/FlutterSharedApplication.h"
1010
#import "flutter/shell/platform/darwin/ios/framework/Source/SemanticsObject.h"
11+
#import "flutter/shell/platform/darwin/ios/rendering_api_selection.h"
1112

1213
FLUTTER_ASSERT_ARC
1314

@@ -191,7 +192,7 @@ - (void)layoutSubviews {
191192
}
192193

193194
+ (Class)layerClass {
194-
return flutter::GetCoreAnimationLayerClassForRenderingAPI(flutter::GetRenderingAPIForProcess());
195+
return flutter::GetCoreAnimationLayerClass();
195196
}
196197

197198
- (void)drawLayer:(CALayer*)layer inContext:(CGContextRef)context {

0 commit comments

Comments
 (0)