Skip to content

iOS: Pass composition order NSArray instead of std::vector - #197418

Merged
auto-submit[bot] merged 1 commit into
flutter:masterfrom
cbracken:pv-refactor-14
Nov 26, 2026
Merged

auto-submit[bot] merged 1 commit into
flutter:masterfrom
cbracken:pv-refactor-14

Conversation

@cbracken

Copy link
Copy Markdown
Member

Previously, presentFrame: copied the view IDs of the frame's layers into a std::vector to pass to its helpers, two of which built a std::unordered_set from it. These were the last C++ containers in the controller's platform thread code. We now use NSArray and NSSet.

This is a refactor with no changes to behaviour and is 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-assist bot 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.

@cbracken
cbracken requested a review from a team as a code owner November 25, 2026 22:51
@flutter-dashboard

Copy link
Copy Markdown

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 both you and the PR author believe this PR qualifies for a test exemption, escalate to the tech lead for the changed area to review and apply the test-exempt label. All reviewers should feel empowered to ask for tests before escalating.

@github-actions github-actions Bot added platform-ios iOS applications specifically engine flutter/engine related. See also e: labels. team-ios Owned by iOS platform team labels Nov 25, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refactors FlutterPlatformViewsController.mm to replace C++ containers (std::vector and std::unordered_set) with Objective-C containers (NSArray and NSSet) for managing the composition order of platform views. The review feedback suggests optimizing performance by avoiding the allocation of temporary NSSet objects in removeUnusedOverlayViews:withCompositionOrder: and computeViewsToDisposeWithCompositionOrder:, recommending a direct linear search on the NSArray using containsObject: instead, given the typically small number of platform views.

Previously, `presentFrame:` copied the view IDs of the frame's layers
into a `std::vector` to pass to its helpers, two of which built a
`std::unordered_set` from it. These were the last C++ containers in
the controller's platform thread code. The helpers now take an `NSArray`
and search it directly, since compositions have few enough platform
views that this is cheaper than building a set.

This is a refactor with no changes to behaviour and is covered by
existing tests.

Issue: flutter#112232
@cbracken cbracken added the autosubmit Merge PR when tree becomes green via auto submit App label Nov 26, 2026
@auto-submit auto-submit Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Nov 26, 2026
@auto-submit

auto-submit Bot commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

autosubmit label was removed for flutter/flutter/197418, because - This pull request has the missing-tests label and does not have the test-exempt label. Please add tests or obtain a test exemption from a tech lead before re-applying the autosubmit label.

@cbracken
cbracken requested a review from loic-sharma November 26, 2026 01:01
@cbracken

Copy link
Copy Markdown
Member Author

Adding @loic-sharma as the only test-exemption reviewer around right now :)

@loic-sharma

Copy link
Copy Markdown
Member

Test exemption reason: This is a refactor with no changes to behaviour and is covered by existing tests.

@loic-sharma loic-sharma added the test-exempt Exempt from tests. Overrides `missing-tests` label label Nov 26, 2026
@cbracken cbracken added the autosubmit Merge PR when tree becomes green via auto submit App label Nov 26, 2026
@auto-submit
auto-submit Bot added this pull request to the merge queue Nov 26, 2026
Merged via the queue into flutter:master with commit fe0a966 Nov 26, 2026
25 checks passed
@flutter-dashboard flutter-dashboard Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Nov 26, 2026
auto-submit Bot pushed a commit to flutter/packages that referenced this pull request Nov 26, 2026
Roll Flutter from 06f1c24345a2 to 82ec4242da79 (33 revisions)

flutter/flutter@06f1c24...82ec424

2026-11-26 [email protected] Roll Dart SDK from 7663c79b8a29 to 7fcaf46b0308 (1 revision) (flutter/flutter#197465)
2026-11-26 [email protected] Roll Skia from 8bf5f2e2b358 to cef5963c1bb2 (1 revision) (flutter/flutter#197453)
2026-11-26 [email protected] Roll Dart SDK from 771539f4435a to 7663c79b8a29 (2 revisions) (flutter/flutter#197451)
2026-11-26 [email protected] Roll Skia from 535259fe7750 to 8bf5f2e2b358 (1 revision) (flutter/flutter#197449)
2026-11-26 [email protected] Roll Skia from f20b7f274ec8 to 535259fe7750 (4 revisions) (flutter/flutter#197442)
2026-11-26 [email protected] Roll Fuchsia Test Scripts from 56keLr8vaDtnH6vqW... to d5xIJpr0Hxkwjlpnr... (flutter/flutter#197441)
2026-11-26 [email protected] Roll Skia from 168ddb88c5b6 to f20b7f274ec8 (1 revision) (flutter/flutter#197438)
2026-11-26 [email protected] Roll Dart SDK from dcfa4247aa49 to 771539f4435a (1 revision) (flutter/flutter#197431)
2026-11-26 [email protected] Roll Skia from 67badb88843a to 168ddb88c5b6 (1 revision) (flutter/flutter#197430)
2026-11-26 [email protected] iOS: Pass composition order NSArray instead of std::vector (flutter/flutter#197418)
2026-11-26 [email protected] Migrate function type define to use the dart style define (flutter/flutter#197419)
2026-11-26 [email protected] iOS: Submit platform view frames from IOSExternalViewEmbedder (flutter/flutter#197411)
2026-11-26 [email protected] Roll Skia from fc1230e8afbb to 67badb88843a (1 revision) (flutter/flutter#197422)
2026-11-25 [email protected] Roll Fuchsia Linux SDK from HtAKfFLbfAQ6g96RY... to 0bgCrr76CM4IqPO0v... (flutter/flutter#197415)
2026-11-25 [email protected] Roll Dart SDK from 6155a47022d7 to dcfa4247aa49 (2 revisions) (flutter/flutter#197413)
2026-11-25 [email protected] Roll Skia from c2d40fc8f6b3 to fc1230e8afbb (2 revisions) (flutter/flutter#197407)
2026-11-25 [email protected] [flutter_tools] Add ProjectExtensionFinder and ExtensionKernelCompiler (flutter/flutter#194772)
2026-11-25 [email protected] [flutter_tools] Migrate resident runner, hot/cold, and TestBed tests off testUsingContext (flutter/flutter#197256)
2026-11-25 [email protected] [flutter_tools] Migrate create, packages, upgrade, runner, and args tests off testUsingContext (flutter/flutter#197255)
2026-11-25 [email protected] [flutter_tools] Migrate Darwin platform and build command tests off testUsingContext (flutter/flutter#197254)
2026-11-25 [email protected] [flutter_tools] Migrate Android, desktop, and web build tests off testUsingContext (flutter/flutter#197252)
2026-11-25 [email protected] iOS: Move platform view frame state to IOSExternalViewEmbedder (flutter/flutter#197362)
2026-11-25 [email protected] [flutter_tools] Migrate build target and native assets tests off testUsingContext (flutter/flutter#197246)
2026-11-25 [email protected] [flutter_tools] Migrate hermetic command tests off testUsingContext (flutter/flutter#197250)
2026-11-25 [email protected] [flutter_tools] Migrate widget preview, asset, plugin, compiler, and device tests off testUsingContext (flutter/flutter#197257)
2026-11-25 [email protected] Roll Skia from e84ecd98d9f2 to c2d40fc8f6b3 (2 revisions) (flutter/flutter#197398)
2026-11-25 [email protected] Roll Fuchsia Test Scripts from GPtykFNizlaauBqzs... to 56keLr8vaDtnH6vqW... (flutter/flutter#197382)
2026-11-25 [email protected] [flutter_tools] Remove last remaining context.get calls in lib/ (flutter/flutter#197253)
2026-11-25 [email protected] [Impeller] Subtract global pass position from backdrop filter local-to-pass transform (flutter/flutter#197324)
2026-11-25 [email protected] [Impeller] Skip mipmaps for decoded images that are resized on the GPU (flutter/flutter#197013)
2026-11-25 [email protected] [flutter_tools] Remove testWithoutContext in favor of test (flutter/flutter#197259)
2026-11-25 [email protected] Roll Packages from f455dfa to 105a874 (10 revisions) (flutter/flutter#197386)
2026-11-25 [email protected] Roll Dart SDK from 5202130a51b8 to 6155a47022d7 (1 revision) (flutter/flutter#197384)

If this roll has caused a breakage, revert this CL and set the roller
to dry run mode using the controls here:
https://autoroll.skia.org/r/flutter-packages
Please CC [email protected],[email protected] on the revert to ensure that a human
is aware of the problem.

To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CICD Run CI/CD engine flutter/engine related. See also e: labels. missing-tests platform-ios iOS applications specifically team-ios Owned by iOS platform team test-exempt Exempt from tests. Overrides `missing-tests` label

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants