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

Break dependency cycle of FlutterViewController <-> FlutterPlatformView #52271

Merged
merged 1 commit into from
Apr 22, 2024

Conversation

jmagman
Copy link
Member

@jmagman jmagman commented Apr 19, 2024

Trying to migrate the iOS embedder MRC to ARC, I'm attempting to break some dependency cycles so it's easier to migrate the "leaf" dependencies to ARC, working my way up.

The cycle is:
FlutterViewController -> FlutterView -> FlutterPlatformView -> (Before this PR)FlutterViewController

FlutterViewController depends on many other large MRC classes, like FlutterEngine., so I'd like to pull that one out so FlutterView, FlutterPlatformView, and FlutterOverlayView can be migrated to ARC in a smaller PR.

FlutterPlatformView only depends on FlutterViewController in this one place, casting a UIViewController and calling -forceTouchesCancelled:.

[((FlutterViewController*)_flutterViewController.get()) forceTouchesCancelled:touches];

Instead, move -forceTouchesCancelled: to the existing FlutterViewResponder protocol with the other touch events, which FlutterViewController already implements. The cast can then be removed, breaking the cycle.

Clean up all the imports.

Part of flutter/flutter#137801, though this doesn't actually migrate anything to ARC.

@jmagman jmagman self-assigned this Apr 19, 2024
@jmagman jmagman force-pushed the flutter-view-imports branch 3 times, most recently from 36251cd to 554bfa5 Compare April 19, 2024 21:48
@@ -1198,7 +1190,7 @@ - (void)touchesCancelled:(NSSet*)touches withEvent:(UIEvent*)event {
// Flutter needs all the cancelled touches to be "cancelled" change types in order to correctly
// handle gesture sequence.
// We always override the change type to "cancelled".
[((FlutterViewController*)_flutterViewController.get()) forceTouchesCancelled:touches];
[_flutterViewController.get() forceTouchesCancelled:touches];
Copy link
Member Author

Choose a reason for hiding this comment

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

(Removing FlutterViewController here)

@jmagman jmagman force-pushed the flutter-view-imports branch from 554bfa5 to c632ba2 Compare April 19, 2024 22:11
@jmagman jmagman marked this pull request as ready for review April 22, 2024 17:14
@@ -60,9 +60,6 @@ typedef void (^FlutterKeyboardAnimationCallback)(fml::TimePoint);
- (fml::WeakNSObject<FlutterViewController>)getWeakNSObject;
- (std::shared_ptr<flutter::FlutterPlatformViewsController>&)platformViewsController;
- (FlutterRestorationPlugin*)restorationPlugin;
// Send touches to the Flutter Engine while forcing the change type to be cancelled.
// The `phase`s in `touches` are ignored.
- (void)forceTouchesCancelled:(NSSet*)touches;
Copy link
Member Author

Choose a reason for hiding this comment

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

Moved to FlutterViewResponder.h

@jmagman jmagman added the autosubmit Merge PR when tree becomes green via auto submit App label Apr 22, 2024
@auto-submit auto-submit bot merged commit bb4c58d into flutter:main Apr 22, 2024
29 checks passed
@jmagman jmagman deleted the flutter-view-imports branch April 22, 2024 19:06
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Apr 22, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Apr 22, 2024
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Apr 23, 2024
…147190)

flutter/engine@a4b71f0...33c828f

2024-04-22 [email protected] Roll Skia from eb29b46236e6 to 3b32e3280b67 (1 revision) (flutter/engine#52298)
2024-04-22 [email protected] Break dependency cycle of FlutterViewController <-> FlutterPlatformView (flutter/engine#52271)
2024-04-22 [email protected] [et] Lookup output filesystem path, not label (flutter/engine#52248)
2024-04-22 [email protected] Roll Skia from 975859a96f8f to eb29b46236e6 (9 revisions) (flutter/engine#52297)
2024-04-22 [email protected] [canvaskit] Add configuration for maximum canvases (flutter/engine#51735)
2024-04-22 [email protected] Fix link in BlendMode.saturation (flutter/engine#52156)
2024-04-22 [email protected] Refactor and migrate FlutterUndoManagerPlugin to ARC (flutter/engine#52234)
2024-04-22 [email protected] Roll Fuchsia Linux SDK from Rr9lFiKCPhMXDGa89... to L533ubzhjWwW7jxbc... (flutter/engine#52293)
2024-04-22 [email protected] Roll Dart SDK from 0a83dd7e61b1 to 0ed66a4d77cb (1 revision) (flutter/engine#52294)

Also rolling transitive DEPS:
  fuchsia/sdk/core/linux-amd64 from Rr9lFiKCPhMX to L533ubzhjWwW

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],[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
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.

2 participants