Skip to content

Commit 52519f5

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 47912c9 commit 52519f5

15 files changed

Lines changed: 24 additions & 168 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 & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,6 @@ @implementation FlutterEngine {
200200
// -destroyContext must wait for this group to drain before it is safe to free _shell.
201201
dispatch_group_t _firstFrameWaiters;
202202

203-
flutter::IOSRenderingAPI _renderingApi;
204203
std::shared_ptr<flutter::SamplingProfiler> _profiler;
205204

206205
FlutterBinaryMessengerRelay* _binaryMessenger;
@@ -343,14 +342,9 @@ - (void)sceneWillConnect:(NSNotification*)notification API_AVAILABLE(ios(13.0))
343342
}
344343

345344
- (void)recreatePlatformViewsController {
346-
_renderingApi = flutter::GetRenderingAPIForProcess();
347345
_platformViewsController = [[FlutterPlatformViewsController alloc] init];
348346
}
349347

350-
- (flutter::IOSRenderingAPI)platformViewsRenderingAPI {
351-
return _renderingApi;
352-
}
353-
354348
- (void)dealloc {
355349
/// Notify plugins of dealloc. This should happen first in dealloc since the
356350
/// plugins may be talking to things like the binaryMessenger.
@@ -926,9 +920,9 @@ - (BOOL)createShell:(NSString*)entrypoint
926920
[strongSelf recreatePlatformViewsController];
927921
strongSelf.platformViewsController.taskRunner = [[FlutterFMLTaskRunner alloc]
928922
initWithTaskRunner:shell.GetTaskRunners().GetPlatformTaskRunner()];
929-
return std::make_unique<flutter::PlatformViewIOS>(
930-
shell, strongSelf->_renderingApi, strongSelf.platformViewsController,
931-
shell.GetTaskRunners(), shell.GetIsGpuDisabledSyncSwitch());
923+
return std::make_unique<flutter::PlatformViewIOS>(shell, strongSelf.platformViewsController,
924+
shell.GetTaskRunners(),
925+
shell.GetIsGpuDisabledSyncSwitch());
932926
};
933927

934928
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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ - (void)layoutSubviews {
191191
}
192192

193193
+ (Class)layerClass {
194-
return flutter::GetCoreAnimationLayerClassForRenderingAPI(flutter::GetRenderingAPIForProcess());
194+
return flutter::GetCoreAnimationLayerClassForRenderingAPI();
195195
}
196196

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

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

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

‎engine/src/flutter/shell/platform/darwin/ios/ios_context.h‎

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,16 +42,9 @@ class IOSContext {
4242
/// @brief Create an iOS context object capable of creating the on-screen
4343
/// and off-screen GPU context for use by Impeller.
4444
///
45-
/// In case the engine does not support the specified client
46-
/// rendering API, this a `nullptr` may be returned.
47-
///
48-
/// @param[in] api A client rendering API supported by the
49-
/// engine/platform.
50-
///
5145
/// @return A valid context on success. `nullptr` on failure.
5246
///
5347
static std::unique_ptr<IOSContext> Create(
54-
IOSRenderingAPI api,
5548
const std::shared_ptr<const fml::SyncSwitch>& is_gpu_disabled_sync_switch,
5649
const Settings& settings);
5750

‎engine/src/flutter/shell/platform/darwin/ios/ios_context.mm‎

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,9 @@
2020
IOSContext::~IOSContext() = default;
2121

2222
std::unique_ptr<IOSContext> IOSContext::Create(
23-
IOSRenderingAPI api,
2423
const std::shared_ptr<const fml::SyncSwitch>& is_gpu_disabled_sync_switch,
2524
const Settings& settings) {
26-
switch (api) {
27-
case IOSRenderingAPI::kMetal:
28-
return std::make_unique<IOSContextMetalImpeller>(settings, is_gpu_disabled_sync_switch);
29-
}
30-
FML_CHECK(false);
31-
return nullptr;
25+
return std::make_unique<IOSContextMetalImpeller>(settings, is_gpu_disabled_sync_switch);
3226
}
3327

3428
std::shared_ptr<impeller::Context> IOSContext::GetImpellerContext() const {

0 commit comments

Comments
 (0)