Repository navigation
[iOS] Split FlutterEngine setUpShell into orthogonal helpers - #192808
Conversation
|
It looks like this pull request may not have tests. Please make sure to add tests or get an explicit test exemption before merging. If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix? Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. If you believe this PR qualifies for a test exemption, contact "@test-exemption-reviewer" in the #hackers channel in Discord (don't just cc them here, they won't see it!). The test exemption team is a small volunteer group, so all reviewers should feel empowered to ask for tests, without delegating that responsibility entirely to the test exemption group. |
There was a problem hiding this comment.
Code Review
This pull request refactors the setUpShell:withVMServicePublication: method in FlutterEngine.mm by splitting its functionality into two helper methods: adoptShell: and configureForRunningShellWithVMServicePublication:. Feedback suggests adding an FML_DCHECK assertion in adoptShell: to verify that the shell parameter is not null before it is dereferenced, preventing potential crashes.
`-setUpShell:withVMServicePublication:` did three things: * shell mechanics: taking ownership of the shell and building the two `FlutterFMLTaskRunner` wrappers * engine configuration: channels, locales, displays, the VM Service publisher, and the platform view channels * additional shell configuration: write GPU availability. It turns out that after recent refactoring, we already set GPU availability during Shell construction, so the write was redundant and had no effect: * `-createShell:` passes `_isGpuDisabled` to `Shell::Create`, and the `Shell` constructor initialises the switch from it. * `Shell::Spawn` reads the spawning engine's switch and passes it to the spawned engine's constructor. `-spawnWithEntrypoint:` copies the spawning engine's `_isGpuDisabled` into the child engine. Both the engine flag and the switch will always match since they're both set in `-setIsGpuDisabled:`. This deletes the GPU avaialability call and splits the reset into separate methods: * `-adoptShell:` * `-configureForRunningShellWithVMServicePublication:` This is preparation for extracting the shell-ownership parts of `FlutterEngine` into a separate backend class. This is a refactor with no behavioural change, covered by existing tests. Issue: flutter#112232
908c34c to
988e582
Compare
|
test-exempt: code refactor with no semantic change |
-setUpShell:withVMServicePublication:did three things:FlutterFMLTaskRunnerwrappersIt turns out that after recent refactoring, we already set GPU availability during Shell construction, so the write was redundant and had no effect:
-createShell:passes_isGpuDisabledtoShell::Create, and theShellconstructor initialises the switch from it.Shell::Spawnreads the spawning engine's switch and passes it to the spawned engine's constructor.-spawnWithEntrypoint:copies the spawning engine's_isGpuDisabledinto the child engine. Both the engine flag and the switch will always match since they're both set in-setIsGpuDisabled:.This deletes the GPU avaialability call and splits the reset into separate methods:
-adoptShell:-configureForRunningShellWithVMServicePublication:This is preparation for extracting the shell-ownership parts of
FlutterEngineinto a separate backend class.This is a refactor with no behavioural change, covered by existing tests.
Issue: #112232
Pre-launch Checklist
///).If you need help, consider asking for advice on the #hackers-new channel on Discord.
If this change needs to override an active code freeze, provide a comment explaining why. The code freeze workflow can be overridden by code reviewers. See pinned issues for any active code freezes with guidance.
Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the
gemini-code-assistbot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.