Migrate vsync_waiter_ios to ARC#52104
Conversation
| // VSyncClient has released the CADisplayLink. | ||
| XCTAssertNil(weakLink); |
There was a problem hiding this comment.
This doesn't currently pass on main with the current code.
| - (void)invalidate { | ||
| [display_link_.get() invalidate]; | ||
| [_displayLink invalidate]; | ||
| _displayLink = nil; // Break retain cycle. |
There was a problem hiding this comment.
The test I wrote to validate the display link is released when VSyncClient invalidates and deallocs doesn't pass without this line (and also doesn't pass on main with the current code).
| recorder->RecordVsync(frame_start_time, frame_target_time); | ||
| if (_allowPauseAfterVsync) { | ||
| display_link_.get().paused = YES; | ||
| link.paused = YES; |
There was a problem hiding this comment.
Use link passed into onDisplayLink: instead of grabbing it again.
| flutter::VsyncWaiter::Callback callback_; | ||
| fml::scoped_nsobject<CADisplayLink> display_link_; | ||
| CADisplayLink* _displayLink; | ||
| double current_refresh_rate_; |
There was a problem hiding this comment.
Optional, but maybe fix the other two names while you are here so they aren't inconsistent?
| // Strongly retain the the captured link until it is added to the runloop. | ||
| CADisplayLink* localDisplayLink = _displayLink; | ||
| task_runner->PostTask([localDisplayLink]() { | ||
| [localDisplayLink addToRunLoop:[NSRunLoop currentRunLoop] forMode:NSRunLoopCommonModes]; |
There was a problem hiding this comment.
Optional modernization nit: NSRunLoop.currentRunLoop since it's a property.
There was a problem hiding this comment.
Did a sweep of this file for dot notation and other property cleanup. Moved refreshRate off the header since it's only used in the implementation file and made it a readonly property, and made displayRefreshRate a class property.
| _displayLink = nil; // Break retain cycle. | ||
| } | ||
|
|
||
| - (void)dealloc { |
There was a problem hiding this comment.
I would remove this method; it's basically a lie (and was before as well). The display link has a strong reference to this object, so it's impossible† for dealloc to be called unless the display link has already been invalidated.
† Unless there's an overrelease, of course, but then we have other problems.
There was a problem hiding this comment.
I removed it and added a comment to -invalidate in the header.
083937b to
08f4b22
Compare
08f4b22 to
7fcab77
Compare
flutter/engine@66ad802...cba7678 2024-04-16 skia-flutter-autoroll@skia.org Roll Dart SDK from 7d02f18b8a84 to cb0c34389d90 (1 revision) (flutter/engine#52151) 2024-04-16 skia-flutter-autoroll@skia.org Roll Skia from 50ac1117f159 to 8013b7f1dcd3 (5 revisions) (flutter/engine#52149) 2024-04-16 49699333+dependabot[bot]@users.noreply.github.com Bump google/osv-scanner-action from 1.6.2.pre.beta1 to 1.7.1 (flutter/engine#52147) 2024-04-16 magder@google.com Migrate vsync_waiter_ios to ARC (flutter/engine#52104) 2024-04-16 skia-flutter-autoroll@skia.org Roll Skia from b159229f2174 to 50ac1117f159 (1 revision) (flutter/engine#52146) 2024-04-16 skia-flutter-autoroll@skia.org Roll Dart SDK from 5f03197b9992 to 7d02f18b8a84 (2 revisions) (flutter/engine#52145) 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
…6811) flutter/engine@66ad802...cba7678 2024-04-16 skia-flutter-autoroll@skia.org Roll Dart SDK from 7d02f18b8a84 to cb0c34389d90 (1 revision) (flutter/engine#52151) 2024-04-16 skia-flutter-autoroll@skia.org Roll Skia from 50ac1117f159 to 8013b7f1dcd3 (5 revisions) (flutter/engine#52149) 2024-04-16 49699333+dependabot[bot]@users.noreply.github.com Bump google/osv-scanner-action from 1.6.2.pre.beta1 to 1.7.1 (flutter/engine#52147) 2024-04-16 magder@google.com Migrate vsync_waiter_ios to ARC (flutter/engine#52104) 2024-04-16 skia-flutter-autoroll@skia.org Roll Skia from b159229f2174 to 50ac1117f159 (1 revision) (flutter/engine#52146) 2024-04-16 skia-flutter-autoroll@skia.org Roll Dart SDK from 5f03197b9992 to 7d02f18b8a84 (2 revisions) (flutter/engine#52145) 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
Smart pointers support ARC as of #47612, and the unit tests were migrated in #48162.
Migrate
vsync_waiter_iosfrom MRC to ARC.Part of flutter/flutter#137801.
Pre-launch Checklist
///).If you need help, consider asking for advice on the #hackers-new channel on Discord.