Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Migrate PlatformViewIOS to ARC #55672

Merged
merged 3 commits into from
Oct 28, 2024
Merged

Conversation

cbracken
Copy link
Member

@cbracken cbracken commented Oct 5, 2024

Migrates PlatformViewIOS from manual reference counting to ARC. Eliminates use of scoped_nsobject, scoped_nsprotocol, and WeakNSObject.

Since this is the last non-ARC file in flutter_framework_source, this also eliminates the flutter_framework_source target, then also renames the flutter_framework_source_arc target to flutter_framework_source since... it's ALL ARC.

No semantic changes, therefore no semantic changes to tests.

Issue: flutter/flutter#137801

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the Flutter Style Guide and the C++, Objective-C, Java style guides.
  • I listed at least one issue that this PR fixes in the description above.
  • I'm hopeful this is the last time anyone needs to come up with some ARCane pun on ARC to jam into the checkboxes.
  • I added new tests to check the change I am making or feature I am adding, or the PR is test-exempt. See testing the engine for instructions on writing and running engine tests.
  • I updated/added relevant documentation (doc comments with ///).
  • I signed the CLA.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

// Since the `ios_surface_` is created on the platform thread but
// used on the raster thread we need to protect it with a mutex.
std::mutex ios_surface_mutex_;
std::unique_ptr<IOSSurface> ios_surface_;
std::shared_ptr<IOSContext> ios_context_;
const std::shared_ptr<PlatformViewsController>& platform_views_controller_;
AccessibilityBridgeManager accessibility_bridge_;
fml::scoped_nsprotocol<FlutterTextInputPlugin*> text_input_plugin_;
Copy link
Member Author

Choose a reason for hiding this comment

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

This... wasn't used anywhere at all.

]
}

source_set("flutter_framework_source") {
Copy link
Member

Choose a reason for hiding this comment

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

I'm jumping for joy over here!

auto ca_layer = fml::scoped_nsobject<CALayer>{[[flutter_view layer] retain]};
FML_DCHECK(owner_controller_.isViewLoaded) << "FlutterViewController's view should be loaded "
"before attaching to PlatformViewIOS.";
FlutterView* flutter_view = static_cast<FlutterView*>(owner_controller_.view);
Copy link
Member

Choose a reason for hiding this comment

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

Is this static_cast needed?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, unfortunately since owner_controller_.view returns a UIView*.

@chinmaygarde
Copy link
Member

Is this blocked?

@cbracken
Copy link
Member Author

This is queued up behind #55669, which should land today.

@cbracken cbracken force-pushed the arc-platformviewios branch from 79ad78a to 7946f64 Compare October 26, 2024 18:10
@cbracken
Copy link
Member Author

cbracken commented Oct 26, 2024

Alright this is ready for review whenever people are ready to give it a look. We're finally at the end (compile/linker-wise), folks!

Copy link
Member

@jmagman jmagman left a comment

Choose a reason for hiding this comment

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

It's so beautiful.

Copy link
Contributor

@stuartmorgan-g stuartmorgan-g left a comment

Choose a reason for hiding this comment

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

LGTM once the unrelated TODO is restored.

Migrates PlatformViewIOS from manual reference counting to ARC.
Eliminates use of scoped_nsobject, scoped_nsprotocol, and WeakNSObject.

Since this is the last non-ARC file in `flutter_framework_source`, this
also eliminates the `flutter_framework_source` target, then also renames
the `flutter_framework_source_arc` target to `flutter_framework_source`
since... it's ALL ARC.

No semantic changes, therefore no changes to tests.

Issue: flutter/flutter#137801
@cbracken cbracken force-pushed the arc-platformviewios branch from 58a36b8 to 9abdbf3 Compare October 28, 2024 18:05
@cbracken cbracken added the autosubmit Merge PR when tree becomes green via auto submit App label Oct 28, 2024
@auto-submit auto-submit bot merged commit 8c74f3f into flutter:main Oct 28, 2024
30 checks passed
@cbracken cbracken deleted the arc-platformviewios branch October 28, 2024 19:34
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Oct 28, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Oct 28, 2024
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Oct 28, 2024
…157751)

flutter/engine@70671ba...ed587dc

2024-10-28 [email protected] Roll Dart SDK from 69b50768d733 to c9180e9de9e8 (1 revision) (flutter/engine#56180)
2024-10-28 [email protected] [Impeller] fix initial layout for loadOp load and incorrect usage of host visible textures. (flutter/engine#56148)
2024-10-28 [email protected] Roll Skia from 21035cd95b68 to bdd225968dab (1 revision) (flutter/engine#56178)
2024-10-28 [email protected] iOS/macOS: migrate darwin/common to ARC (flutter/engine#56155)
2024-10-28 98614782+auto-submit[bot]@users.noreply.github.com Reverts "Pin local_engine mac builds to arm64 (#56172)" (flutter/engine#56179)
2024-10-28 [email protected] Migrate PlatformViewIOS to ARC (flutter/engine#55672)
2024-10-28 [email protected] Roll Skia from 35ad4e89212f to 21035cd95b68 (1 revision) (flutter/engine#56176)
2024-10-28 [email protected] Roll buildroot to pick up revert of debugging gen_snapshot prints (flutter/engine#56175)
2024-10-28 [email protected] Pin local_engine mac builds to arm64 (flutter/engine#56172)
2024-10-28 [email protected] Switch some mac_unopt tests from intel to arm hosts (flutter/engine#55882)

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

To file a bug in Flutter: 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
nick9822 pushed a commit to nick9822/flutter that referenced this pull request Dec 18, 2024
Migrates PlatformViewIOS from manual reference counting to ARC. Eliminates use of scoped_nsobject, scoped_nsprotocol, and WeakNSObject.

Since this is the last non-ARC file in `flutter_framework_source`, this also eliminates the `flutter_framework_source` target, then also renames the `flutter_framework_source_arc` target to `flutter_framework_source` since... it's ALL ARC.

No semantic changes, therefore no semantic changes to tests.

Issue: flutter#137801

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
autosubmit Merge PR when tree becomes green via auto submit App platform-ios
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants