Skip to content

[iOS] Update previousCompositionOrder to return Obj-C type#185136

Merged
cbracken merged 5 commits into
flutter:masterfrom
cbracken:previouscompositionorder-objc
Apr 17, 2026
Merged

[iOS] Update previousCompositionOrder to return Obj-C type#185136
cbracken merged 5 commits into
flutter:masterfrom
cbracken:previouscompositionorder-objc

Conversation

@cbracken

@cbracken cbracken commented Apr 16, 2026

Copy link
Copy Markdown
Member

This is part of a more general push to eliminate C++ collection types from the public API of FlutterPlatformViewsController to make it more idiomatic for Objective-C callers and reduce barriers for future adoption of more Swift in the embedder.

While creating an NSArray from a std::vector on demand introduces a small amount of boxing and allocation overhead, the number of platform views on screen at any given time is typically very small (usually < 5). Thus, the overhead is negligible.

This property is declared in the Testing category and is only used in unit tests, meaning it has zero impact on production frame rendering performance.

Internal state continues to use std::vector<int64_t> to avoid boxing overhead in performance-sensitive paths like bringLayersIntoView and removeUnusedLayers.

Also moved the associated documentation comment from the implementation file to the header.

Issue: #185139
Related issue: #175878

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 April 16, 2026 04:35
@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 Apr 16, 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 changes the return type of the previousCompositionOrder method from a C++ std::vector to an Objective-C NSArray<NSNumber*>* in FlutterPlatformViewsController. The implementation now converts the internal vector to an array in the getter, and internal references have been updated to use the backing member variable. Unit tests were also updated to accommodate the change in return type. Feedback was provided to correct the documentation for this property, suggesting that it refers to the 'previous frame' rather than the 'previous thread' for better accuracy.

@cbracken cbracken force-pushed the previouscompositionorder-objc branch from 1d1d493 to afaa065 Compare April 16, 2026 04:40
@cbracken cbracken changed the title [iOS] Refactor previousCompositionOrder to return NSArray in public API [iOS] Update previousCompositionOrder to return Obj-C type Apr 16, 2026
@cbracken cbracken force-pushed the previouscompositionorder-objc branch from afaa065 to 0b2d44e Compare April 16, 2026 05:20
hellohuanlin
hellohuanlin previously approved these changes Apr 16, 2026

@hellohuanlin hellohuanlin 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.

Oh hello stranger

@cbracken cbracken force-pushed the previouscompositionorder-objc branch from 0b2d44e to e8a34b3 Compare April 16, 2026 06:12
@cbracken cbracken added the autosubmit Merge PR when tree becomes green via auto submit App label Apr 16, 2026
@cbracken cbracken force-pushed the previouscompositionorder-objc branch from e8a34b3 to 51e7268 Compare April 16, 2026 08:55
@cbracken cbracken enabled auto-merge April 16, 2026 12:17
This is part of a more general push to eliminate C++ collection types
from the public API of `FlutterPlatformViewsController` to make it more
idiomatic for Objective-C callers and reduce barriers for future
adoption of more Swift in the embedder.

While creating an `NSArray` from a `std::vector` on demand introduces a
small amount of boxing and allocation overhead, the number of platform
views on screen at any given time is typically very small (usually < 5).
Thus, the overhead is negligible. 

This property is declared in the `Testing` category and is only used in
unit tests, meaning it has zero impact on production frame rendering
performance.

Internal state continues to use `std::vector<int64_t>` to avoid boxing
overhead in performance-sensitive paths like `bringLayersIntoView` and
`removeUnusedLayers`.

Also moved the associated documentation comment from the implementation
file to the header.
@cbracken cbracken force-pushed the previouscompositionorder-objc branch from e3185c4 to 0708a8d Compare April 16, 2026 13:19
@cbracken

cbracken commented Apr 16, 2026

Copy link
Copy Markdown
Member Author

Hmmm... Looks like rebasing invalidates previous approvals? Did that because the tree was on fire; definitely don't remember "dismissing" the review 😂.

@jmagman jmagman added the CICD Run CI/CD label Apr 16, 2026
@auto-submit

auto-submit Bot commented Apr 16, 2026

Copy link
Copy Markdown
Contributor

autosubmit label was removed for flutter/flutter/185136, because - The status or check suite Linux linux_host_engine_ddm has failed. Please fix the issues identified (or deflake) before re-applying this label.

@auto-submit auto-submit Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Apr 16, 2026
@LouiseHsu LouiseHsu added the autosubmit Merge PR when tree becomes green via auto submit App label Apr 16, 2026
LouiseHsu
LouiseHsu previously approved these changes Apr 16, 2026

@LouiseHsu LouiseHsu 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.

cmon bots. do ur job

@auto-submit auto-submit Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Apr 16, 2026
@auto-submit

auto-submit Bot commented Apr 16, 2026

Copy link
Copy Markdown
Contributor

autosubmit label was removed for flutter/flutter/185136, because - The status or check suite Linux linux_unopt has failed. Please fix the issues identified (or deflake) before re-applying this label.

@github-actions github-actions Bot removed the CICD Run CI/CD label Apr 17, 2026
@jmagman jmagman added the CICD Run CI/CD label Apr 17, 2026
@github-actions github-actions Bot removed the CICD Run CI/CD label Apr 17, 2026
@Renzo-Olivares Renzo-Olivares added the CICD Run CI/CD label Apr 17, 2026
@github-actions github-actions Bot removed the CICD Run CI/CD label Apr 17, 2026
@cbracken cbracken added the CICD Run CI/CD label Apr 17, 2026
@cbracken

Copy link
Copy Markdown
Member Author

@LouiseHsu or @hellohuanlin if you get a moment, I'd love a re-review because the formatter really wanted me to remove a blank line.

@cbracken cbracken force-pushed the previouscompositionorder-objc branch from 968b801 to 102a806 Compare April 17, 2026 07:23
@github-actions github-actions Bot removed the CICD Run CI/CD label Apr 17, 2026

@goderbauer goderbauer left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, blank line removal looks 🔥

@cbracken cbracken added the CICD Run CI/CD label Apr 17, 2026
@github-actions github-actions Bot removed the CICD Run CI/CD label Apr 17, 2026
@cbracken cbracken added the CICD Run CI/CD label Apr 17, 2026
@cbracken cbracken added this pull request to the merge queue Apr 17, 2026
Merged via the queue into flutter:master with commit 408f4f2 Apr 17, 2026
194 checks passed
@cbracken cbracken deleted the previouscompositionorder-objc branch April 17, 2026 16:04
auto-submit Bot pushed a commit to flutter/packages that referenced this pull request Apr 20, 2026
flutter/flutter@8e8a194...2844af6

2026-04-19 engine-flutter-autoroll@skia.org Roll Fuchsia Linux SDK from bWoigpGIb60B6C7hD... to aDbXQm6WA0wFCAUp-... (flutter/flutter#185253)
2026-04-18 engine-flutter-autoroll@skia.org Roll Fuchsia Linux SDK from di3JdYrdE9OFu8Iyl... to bWoigpGIb60B6C7hD... (flutter/flutter#185231)
2026-04-18 rmolivares@renzo-olivares.dev Fix: text selection context menu should reappear after a non-fling scroll on Android and iOS (flutter/flutter#185054)
2026-04-18 flar@google.com Rect constructors for circle bounds (MakeCircle/EllipseBounds) (flutter/flutter#185110)
2026-04-17 97480502+b-luk@users.noreply.github.com Change uber SDF to get pixel size (for AA) using euclidean distance rather than manhattan distance. (flutter/flutter#184984)
2026-04-17 engine-flutter-autoroll@skia.org Roll Dart SDK from 7c2564c18770 to 9648f446f131 (7 revisions) (flutter/flutter#185223)
2026-04-17 47866232+chunhtai@users.noreply.github.com Rewrites no-response workflow to work with pr as well (flutter/flutter#185163)
2026-04-17 15619084+vashworth@users.noreply.github.com Only use LLDB breakpoint in debug mode (flutter/flutter#185158)
2026-04-17 flar@google.com add playground to test SDF primitive rendering under transforms (flutter/flutter#185010)
2026-04-17 30870216+gaaclarke@users.noreply.github.com Adds sdf rrects (and fixes opacity + color source) (flutter/flutter#184999)
2026-04-17 matt.kosarek@canonical.com Implementation of popup windows for Win32 (flutter/flutter#184516)
2026-04-17 engine-flutter-autoroll@skia.org Roll Fuchsia Test Scripts from R2EllDf4DgBXVNuiN... to dQ4PjIJB5kZFU8Y32... (flutter/flutter#185207)
2026-04-17 chris@bracken.jp [iOS] Update previousCompositionOrder to return Obj-C type (flutter/flutter#185136)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages
Please CC boetger@google.com,stuartmorgan@google.com 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:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
creatorpiyush pushed a commit to creatorpiyush/packages that referenced this pull request Jun 10, 2026
…r#11531)

flutter/flutter@8e8a194...2844af6

2026-04-19 engine-flutter-autoroll@skia.org Roll Fuchsia Linux SDK from bWoigpGIb60B6C7hD... to aDbXQm6WA0wFCAUp-... (flutter/flutter#185253)
2026-04-18 engine-flutter-autoroll@skia.org Roll Fuchsia Linux SDK from di3JdYrdE9OFu8Iyl... to bWoigpGIb60B6C7hD... (flutter/flutter#185231)
2026-04-18 rmolivares@renzo-olivares.dev Fix: text selection context menu should reappear after a non-fling scroll on Android and iOS (flutter/flutter#185054)
2026-04-18 flar@google.com Rect constructors for circle bounds (MakeCircle/EllipseBounds) (flutter/flutter#185110)
2026-04-17 97480502+b-luk@users.noreply.github.com Change uber SDF to get pixel size (for AA) using euclidean distance rather than manhattan distance. (flutter/flutter#184984)
2026-04-17 engine-flutter-autoroll@skia.org Roll Dart SDK from 7c2564c18770 to 9648f446f131 (7 revisions) (flutter/flutter#185223)
2026-04-17 47866232+chunhtai@users.noreply.github.com Rewrites no-response workflow to work with pr as well (flutter/flutter#185163)
2026-04-17 15619084+vashworth@users.noreply.github.com Only use LLDB breakpoint in debug mode (flutter/flutter#185158)
2026-04-17 flar@google.com add playground to test SDF primitive rendering under transforms (flutter/flutter#185010)
2026-04-17 30870216+gaaclarke@users.noreply.github.com Adds sdf rrects (and fixes opacity + color source) (flutter/flutter#184999)
2026-04-17 matt.kosarek@canonical.com Implementation of popup windows for Win32 (flutter/flutter#184516)
2026-04-17 engine-flutter-autoroll@skia.org Roll Fuchsia Test Scripts from R2EllDf4DgBXVNuiN... to dQ4PjIJB5kZFU8Y32... (flutter/flutter#185207)
2026-04-17 chris@bracken.jp [iOS] Update previousCompositionOrder to return Obj-C type (flutter/flutter#185136)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages
Please CC boetger@google.com,stuartmorgan@google.com 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:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
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. platform-ios iOS applications specifically team-ios Owned by iOS platform team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants