-
Notifications
You must be signed in to change notification settings - Fork 6k
iOS: Migrate FlutterPlatformPlugin to ARC #55571
Conversation
|
It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption, contact "@test-exemption-reviewer" in the #hackers channel in Discord (don't just cc them here, they won't see it!). 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. The test exemption team is a small volunteer group, so all reviewers should feel empowered to ask for tests, without delegating that responsibility entirely to the test exemption group. |
|
test-exempt: Semantically identical. |
Migrates from manual reference counting to automatic reference counting. Issue: flutter/flutter#137801
…156038) flutter/engine@a7abf7a...a5bc2e2 2024-10-01 [email protected] Roll Dart SDK from 345a9d8d3f1c to 691701c26cfd (1 revision) (flutter/engine#55575) 2024-10-01 [email protected] iOS: Migrate FlutterPlatformPlugin to ARC (flutter/engine#55571) 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
| * info.plist makes this value to be false. | ||
| */ | ||
| @property(nonatomic, assign) BOOL enableViewControllerBasedStatusBarAppearance; | ||
| @property(nonatomic, weak) FlutterEngine* engine; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we also fix up -initWithEngine to take a normal FlutterEngine instead of a fml::WeakNSObject?
| _platformPlugin.reset([[FlutterPlatformPlugin alloc] initWithEngine:[self getWeakNSObject]]); |
_platformPlugin.reset([[FlutterPlatformPlugin alloc] initWithEngine:self]);There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes -- I should have tagged that with the same TODO as the other two. Once all translation units importing the header are ARC-ified, I'll remove it. This patch just removed the use of it internal to the translation unit itself.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(how is this even working? It's assigning a FlutterEngine to a fml::WeakNSObject<FlutterEngine>)
engine/shell/platform/darwin/ios/framework/Source/FlutterPlatformPlugin.mm
Lines 85 to 90 in af39fda
| - (instancetype)initWithEngine:(fml::WeakNSObject<FlutterEngine>)engine { | |
| FML_DCHECK(engine) << "engine must be set"; | |
| self = [super init]; | |
| if (self) { | |
| _engine = engine; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Get outta town. I can't wait for this to be over.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh sorry yeah didn't look at the class before I looked it up! You got the right class, but it's this line from the superclass since we're converting from a WeakNSObject<T> to a T:
https://chromium.googlesource.com/chromium/src.git/+/refs/tags/94.0.4606.43/base/ios/weak_nsobject.h#135
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TL;DR this is all horrible and getting rid of it is all a huge win.
Migrates from manual reference counting to automatic reference counting. Migrates ivars to property syntax. Makes a minor update to a doc comment. No semantic changes, therefore not changes to tests. Issue: #137801 [C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
Migrates from manual reference counting to automatic reference counting. Migrates ivars to property syntax. Makes a minor update to a doc comment.
No semantic changes, therefore not changes to tests.
Issue: flutter/flutter#137801
Pre-launch Checklist
///).If you need help, consider asking for advice on the #hackers-new channel on Discord.