Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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 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 skia-flutter-autoroll@skia.org Roll Skia from eb29b46236e6 to 3b32e3280b67 (1 revision) (flutter/engine#52298)
2024-04-22 magder@google.com Break dependency cycle of FlutterViewController <-> FlutterPlatformView (flutter/engine#52271)
2024-04-22 chris@bracken.jp [et] Lookup output filesystem path, not label (flutter/engine#52248)
2024-04-22 skia-flutter-autoroll@skia.org Roll Skia from 975859a96f8f to eb29b46236e6 (9 revisions) (flutter/engine#52297)
2024-04-22 1961493+harryterkelsen@users.noreply.github.com [canvaskit] Add configuration for maximum canvases (flutter/engine#51735)
2024-04-22 120297255+PurplePolyhedron@users.noreply.github.com Fix link in BlendMode.saturation (flutter/engine#52156)
2024-04-22 magder@google.com Refactor and migrate FlutterUndoManagerPlugin to ARC (flutter/engine#52234)
2024-04-22 skia-flutter-autoroll@skia.org Roll Fuchsia Linux SDK from Rr9lFiKCPhMXDGa89... to L533ubzhjWwW7jxbc... (flutter/engine#52293)
2024-04-22 skia-flutter-autoroll@skia.org 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 jsimmons@google.com,rmistry@google.com,zra@google.com 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 join this conversation on GitHub. Already have an account? Sign in to comment
Labels
autosubmit Merge PR when tree becomes green via auto submit App platform-ios
Projects
None yet
2 participants