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

Migrate FlutterDartVMServicePublisher to ARC #52081

Merged
merged 2 commits into from
Apr 15, 2024

Conversation

jmagman
Copy link
Member

@jmagman jmagman commented Apr 12, 2024

Smart pointers support ARC as of #47612, and the unit tests were migrated in #48162.

Migrate FlutterDartVMServicePublisher from MRC to ARC. I validated flutter attach works on this engine PR, so the VM service URL is being advertised and the tool is discovering it.

Part of flutter/flutter#137801.

@jmagman jmagman self-assigned this Apr 12, 2024
@jmagman jmagman marked this pull request as ready for review April 12, 2024 20:00
@flutter-dashboard
Copy link

It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact "@test-exemption-reviewer" in the #hackers channel in Chat (don't just cc them here, they won't see it! Use Discord!).

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.

@Hixie
Copy link
Contributor

Hixie commented Apr 12, 2024

test-exempt: code refactor with no semantic change

@@ -78,6 +80,8 @@ source_set("flutter_framework_source_arc") {
"UIKit.framework",
"IOSurface.framework",
]

deps += [ "//flutter/runtime" ]
Copy link
Contributor

Choose a reason for hiding this comment

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

what is this change?

Copy link
Member Author

Choose a reason for hiding this comment

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

It's because of the #include "flutter/runtime/dart_service_isolate.h"

ERROR at //flutter/shell/platform/darwin/ios/framework/Source/FlutterDartVMServicePublisher.mm:45:11: Can't include this header from here.
#include "flutter/runtime/dart_service_isolate.h"
          ^-------------------------------------
The target:
  //flutter/shell/platform/darwin/ios:flutter_framework_source_arc
is including a file from the target:
  //flutter/runtime:runtime

It's usually best to depend directly on the destination target.
In some cases, the destination target is considered a subcomponent
of an intermediate target. In this case, the intermediate target
should depend publicly on the destination to forward the ability
to include headers.

Dependency chain (there may also be others):
  //flutter/shell/platform/darwin/ios:flutter_framework_source_arc -->
  //flutter/shell/platform/darwin/ios:flutter_framework_source --[private]-->
  //flutter/runtime:runtime

@@ -14,7 +14,7 @@
- (instancetype)init NS_UNAVAILABLE;
+ (instancetype)new NS_UNAVAILABLE;

@property(nonatomic, retain, readonly) NSURL* url;
@property(nonatomic, strong, readonly) NSURL* url;
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: I thought from the last discussion that we were moving toward not putting strong?

Copy link
Member Author

Choose a reason for hiding this comment

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

You're right, I just saw a stray retain and didn't think about it. Removing.

weak.get().url = url;
if (weak.get().enableVMServicePublication) {
[[weak.get() delegate] publishServiceProtocolPort:url];
if (weakSelf) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm surprised we aren't getting a warning here; this is violating the repeated-use-of-weak-self that Xcode usually warns on. The strongly preferred pattern is to have the first statement be a strongSelf = weakSelf, and then have all the instances be strongSelf, so that it's impossible to have self become nil part way through the method.

Copy link
Contributor

@stuartmorgan stuartmorgan left a comment

Choose a reason for hiding this comment

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

LGTM

@jmagman jmagman added the autosubmit Merge PR when tree becomes green via auto submit App label Apr 15, 2024
@auto-submit auto-submit bot merged commit 557ffb1 into flutter:main Apr 15, 2024
29 checks passed
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Apr 16, 2024
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Apr 16, 2024
…146791)

flutter/engine@503e7e8...557ffb1

2024-04-15 magder@google.com Migrate FlutterDartVMServicePublisher to ARC (flutter/engine#52081)

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 chinmaygarde@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
@jmagman jmagman deleted the vmservice-arc branch April 16, 2024 02:41
gilnobrega pushed a commit to gilnobrega/flutter that referenced this pull request Apr 22, 2024
…lutter#146791)

flutter/engine@503e7e8...557ffb1

2024-04-15 magder@google.com Migrate FlutterDartVMServicePublisher to ARC (flutter/engine#52081)

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 chinmaygarde@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
Development

Successfully merging this pull request may close these issues.

4 participants