[iOS] Migrate VSyncClient to a pure Obj-C implementation#186166
Conversation
|
It looks like this pull request may not have tests. Please make sure to add tests or get an explicit test exemption before merging. 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. If you believe this PR qualifies for a test exemption, contact "@test-exemption-reviewer" in the #hackers channel in Discord (don't just cc them here, they won't see it!). 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. |
There was a problem hiding this comment.
Code Review
This pull request refactors FlutterVSyncClient.mm to simplify vsync handling by removing dependencies on flutter::VsyncWaiter and flutter::FrameTimingsRecorder in favor of a block-based callback using CADisplayLink timestamps directly. A potential issue was identified where link.timestamp and link.targetTimestamp are passed to FlutterTracing in seconds, which may cause a unit mismatch if the tracing method expects microseconds as the previous implementation did.
015e986 to
8711068
Compare
8711068 to
7ed42ca
Compare
Fixes an issue in `FlutterVSyncClient` where platform vsync timestamps were reported incorrectly to the timeline. In flutter#185918 I introduced the Obj-C tracing API, which originally used microseconds as an int64_t. During review this was updated to use NSTimeInterval to be more idiomatic, and type-safe -- as we see here, int64_t doesn't enforce units at all. This fixes the timeline recording issue. This code will be replaced in a followup that migrates off the C++ types entirely: flutter#186166 Issue: flutter#112232
…stamps Migrates `FlutterVSyncClient` from a hybrid C++/Obj-C implementation to a pure Objective-C implementation by removing C++ types from its interface and implementation. Further, in flutter#185918 the timestamps used in `FlutterTracing` were updated from `int64_t` to `NSTimeInterval` in response to code review, but the call site was (incorrectly) not updated. This fixes that. Previously, `FlutterVSyncClient` stored a C++ `flutter::VsyncWaiter::Callback` and used a temporary `std::unique_ptr<flutter::FrameTimingsRecorder>` to propagate vsync timestamps. This was redundant: * `FlutterVSyncClient` allocated a temporary `FrameTimingsRecorder` and recorded vsync times. * It passed this to a C++ lambda wrapper. * The lambda extracted the start/target times as seconds and passed them to the Obj-C block callback. * The temporary recorder was immediately discarded. * `VsyncWaiterIOS` converted the seconds back to `fml::TimePoint`. * `VsyncWaiter::FireCallback` allocated *another* `FrameTimingsRecorder` and recorded the same times again. We now: * manage the callback as pure Obj-C block that accepts raw `CFTimeInterval` (double seconds) directly from `CADisplayLink`. * Remove the redundant `FrameTimingsRecorder` and C++ lambda wrapper. * Rely solely on `VsyncWaiter::FireCallback` to handle the final `FrameTimingsRecorder` creation and recording, which it already does. No test changes because this introduces no semantic change and is covered by existing tests recently added in: https://github.com/flutter/flutter/blob/master/engine/src/flutter/shell/platform/darwin/ios/framework/Source/VSyncClientTest.swift
7ed42ca to
4eff4bc
Compare
…lutter#186190) Fixes an issue in `FlutterVSyncClient` where platform vsync timestamps were reported incorrectly to the timeline. In flutter#185918 I introduced the Obj-C tracing API, which originally used microseconds as an int64_t. During review this was updated to use NSTimeInterval to be more idiomatic and use a clear type in place of int64_t for the timestamp. The tests were updated but the callsite was not. Authoring a test that would differentiate microseconds from fractional seconds (NSTimeInterval) is infeasible in the current state without significant refactoring, however, that refactoring is coming in followup patch: flutter#186166 That patch could be landed as an alternative as it also contains the fix. Issue: flutter#112232 <!-- Thanks for filing a pull request! Reviewers are typically assigned within a week of filing a request. To learn more about code review, see our documentation on Tree Hygiene: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md --> ## Pre-launch Checklist - [X] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [X] I read the [AI contribution guidelines] and understand my responsibilities, or I am not using AI tools. - [X] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [X] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [X] I signed the [CLA]. - [X] I listed at least one issue that this PR fixes in the description above. - [X] I updated/added relevant documentation (doc comments with `///`). - [X] I added new tests to check the change I am making, or this PR is [test-exempt]. - [X] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [X] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. If this change needs to override an active code freeze, provide a comment explaining why. The code freeze workflow can be overridden by code reviewers. See pinned issues for any active code freezes with guidance. **Note**: The Flutter team is currently trialing the use of [Gemini Code Assist for GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code). Comments from the `gemini-code-assist` bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [AI contribution guidelines]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#ai-contribution-guidelines [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
|
autosubmit label was removed for flutter/flutter/186166, because Pull request flutter/flutter/186166 is not in a mergeable state. |
|
Reason for revert: This caused a crash due to using the incorrect time in G3, so reverting it. |
…utter#186166)" (flutter#186266) <!-- start_original_pr_link --> Reverts: flutter#186166 <!-- end_original_pr_link --> <!-- start_initiating_author --> Initiated by: hellohuanlin <!-- end_initiating_author --> <!-- start_revert_reason --> Reason for reverting: This caused a crash due to using the incorrect time in G3, so reverting it. <!-- end_revert_reason --> <!-- start_original_pr_author --> Original PR Author: cbracken <!-- end_original_pr_author --> <!-- start_reviewers --> Reviewed By: {hellohuanlin} <!-- end_reviewers --> <!-- start_revert_body --> This change reverts the following previous change: Migrates `FlutterVSyncClient` from a hybrid C++/Obj-C implementation to a pure Objective-C implementation by removing C++ types from its interface and implementation. Previously, `FlutterVSyncClient` stored a C++ `flutter::VsyncWaiter::Callback` and used a temporary `std::unique_ptr<flutter::FrameTimingsRecorder>` to propagate vsync timestamps. This was redundant: * `FlutterVSyncClient` allocated a temporary `FrameTimingsRecorder` and recorded vsync times. * It passed this to a C++ lambda wrapper. * The lambda extracted the start/target times as seconds and passed them to the Obj-C block callback. * The temporary recorder was immediately discarded. * `VsyncWaiterIOS` converted the seconds back to `fml::TimePoint`. * `VsyncWaiter::FireCallback` allocated *another* `FrameTimingsRecorder` and recorded the same times again. We now: * manage the callback as pure Obj-C block that accepts raw `CFTimeInterval` (double seconds) directly from `CADisplayLink`. * Remove the redundant `FrameTimingsRecorder` and C++ lambda wrapper. * Rely solely on `VsyncWaiter::FireCallback` to handle the final `FrameTimingsRecorder` creation and recording, which it already does. No test changes because this introduces no semantic change and is covered by existing tests recently added in: https://github.com/flutter/flutter/blob/master/engine/src/flutter/shell/platform/darwin/ios/framework/Source/VSyncClientTest.swift ## Pre-launch Checklist - [X] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [X] I read the [AI contribution guidelines] and understand my responsibilities, or I am not using AI tools. - [X] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [X] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [X] I signed the [CLA]. - [X] I listed at least one issue that this PR fixes in the description above. - [X] I updated/added relevant documentation (doc comments with `///`). - [X] I added new tests to check the change I am making, or this PR is [test-exempt]. - [X] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [X] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. If this change needs to override an active code freeze, provide a comment explaining why. The code freeze workflow can be overridden by code reviewers. See pinned issues for any active code freezes with guidance. **Note**: The Flutter team is currently trialing the use of [Gemini Code Assist for GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code). Comments from the `gemini-code-assist` bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [AI contribution guidelines]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#ai-contribution-guidelines [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md <!-- end_revert_body --> Co-authored-by: auto-submit[bot] <flutter-engprod-team@google.com>
Adds doc comments for FlutterVSyncClient and FlutterDisplayLink as well as implementation notes in the -[FlutterDisplayLink onDisplayLink:] callback. Related PRs: * flutter#186166 * flutter#186266
Adds doc comments for FlutterVSyncClient and FlutterDisplayLink as well as implementation notes in the -[FlutterDisplayLink onDisplayLink:] callback. Related PRs: * flutter#186166 * flutter#186266
Adds doc comments for FlutterVSyncClient and FlutterDisplayLink as well as implementation notes in the -[FlutterDisplayLink onDisplayLink:] callback. Related PRs: * flutter#186166 * flutter#186266
…ink (flutter#186456) Adds doc comments for FlutterVSyncClient and FlutterDisplayLink as well as implementation notes in the `-[FlutterDisplayLink onDisplayLink:]` callback. No test changes since this is a documentation-only patch. Related PRs: * flutter#186166 * flutter#186266 ## Pre-launch Checklist - [X] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [X] I read the [AI contribution guidelines] and understand my responsibilities, or I am not using AI tools. - [X] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [X] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [X] I signed the [CLA]. - [ ] I listed at least one issue that this PR fixes in the description above. - [X] I updated/added relevant documentation (doc comments with `///`). - [X] I added new tests to check the change I am making, or this PR is [test-exempt]. - [X] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [X] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. If this change needs to override an active code freeze, provide a comment explaining why. The code freeze workflow can be overridden by code reviewers. See pinned issues for any active code freezes with guidance. **Note**: The Flutter team is currently trialing the use of [Gemini Code Assist for GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code). Comments from the `gemini-code-assist` bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [AI contribution guidelines]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#ai-contribution-guidelines [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
…) (flutter#186935) Migrates `FlutterVSyncClient` from a hybrid C++/Obj-C implementation to a pure Objective-C implementation by removing C++ types from its interface and implementation. Previously, `FlutterVSyncClient` stored a C++ `flutter::VsyncWaiter::Callback` and used a temporary `std::unique_ptr<flutter::FrameTimingsRecorder>` to propagate vsync timestamps. This was redundant: * `FlutterVSyncClient` allocated a temporary `FrameTimingsRecorder` and recorded vsync times. * It passed this to a C++ lambda wrapper. * The lambda extracted the start/target times as seconds and passed them to the Obj-C block callback. * The temporary recorder was immediately discarded. * `VsyncWaiterIOS` converted the seconds back to `fml::TimePoint`. * `VsyncWaiter::FireCallback` allocated *another* `FrameTimingsRecorder` and recorded the same times again. We now: * manage the callback as pure Obj-C block that accepts raw `CFTimeInterval` (double seconds) directly from `CADisplayLink`. * Remove the redundant `FrameTimingsRecorder` and C++ lambda wrapper. * Rely solely on `VsyncWaiter::FireCallback` to handle the final `FrameTimingsRecorder` creation and recording, which it already does. This is a re-land of flutter#186166 which was reverted in flutter#186266. That patch failed to correctly adjust the epoch of timestamps obtained from CoreAnimation (which uses `mach_absolute_time` under the hood) to the epoch used by the core engine, which is built on `fml::TimePoint`, which uses `std::chrono::steady_clock`, which uses `mach_continuous_time` under the hood, consistent with the C++ specification's of a continuous clock. While these two clocks start roughly synchronized at boot, `mach_absolute_time` pauses on device sleep, whereas `mach_continuous_time` does not. The iOS embedder now uses timings based on CoreAnimation throughout and translates to `fml::TimePoint` only at the engine-embedder boundary. This is consistent with embedders based on the embedder API, such as macOS, which does this work in `-[FlutterEngine viewControllerViewDidLoad]` using `FlutterTimeConverter`. Added tests for frame rate snapping/fallback. No other test changes because this introduces no semantic change and is covered by existing tests recently added in: flutter#186457 Issue: flutter#112232 <!-- Thanks for filing a pull request! Reviewers are typically assigned within a week of filing a request. To learn more about code review, see our documentation on Tree Hygiene: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md --> ## Pre-launch Checklist - [X] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [X] I read the [AI contribution guidelines] and understand my responsibilities, or I am not using AI tools. - [X] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [X] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [X] I signed the [CLA]. - [X] I listed at least one issue that this PR fixes in the description above. - [X] I tested the crap outta this cause I really don't want to write another post-mortem. - [X] I updated/added relevant documentation (doc comments with `///`). - [X] I added new tests to check the change I am making, or this PR is [test-exempt]. - [X] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [X] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. If this change needs to override an active code freeze, provide a comment explaining why. The code freeze workflow can be overridden by code reviewers. See pinned issues for any active code freezes with guidance. **Note**: The Flutter team is currently trialing the use of [Gemini Code Assist for GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code). Comments from the `gemini-code-assist` bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [AI contribution guidelines]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#ai-contribution-guidelines [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
…) (flutter#186935) Migrates `FlutterVSyncClient` from a hybrid C++/Obj-C implementation to a pure Objective-C implementation by removing C++ types from its interface and implementation. Previously, `FlutterVSyncClient` stored a C++ `flutter::VsyncWaiter::Callback` and used a temporary `std::unique_ptr<flutter::FrameTimingsRecorder>` to propagate vsync timestamps. This was redundant: * `FlutterVSyncClient` allocated a temporary `FrameTimingsRecorder` and recorded vsync times. * It passed this to a C++ lambda wrapper. * The lambda extracted the start/target times as seconds and passed them to the Obj-C block callback. * The temporary recorder was immediately discarded. * `VsyncWaiterIOS` converted the seconds back to `fml::TimePoint`. * `VsyncWaiter::FireCallback` allocated *another* `FrameTimingsRecorder` and recorded the same times again. We now: * manage the callback as pure Obj-C block that accepts raw `CFTimeInterval` (double seconds) directly from `CADisplayLink`. * Remove the redundant `FrameTimingsRecorder` and C++ lambda wrapper. * Rely solely on `VsyncWaiter::FireCallback` to handle the final `FrameTimingsRecorder` creation and recording, which it already does. This is a re-land of flutter#186166 which was reverted in flutter#186266. That patch failed to correctly adjust the epoch of timestamps obtained from CoreAnimation (which uses `mach_absolute_time` under the hood) to the epoch used by the core engine, which is built on `fml::TimePoint`, which uses `std::chrono::steady_clock`, which uses `mach_continuous_time` under the hood, consistent with the C++ specification's of a continuous clock. While these two clocks start roughly synchronized at boot, `mach_absolute_time` pauses on device sleep, whereas `mach_continuous_time` does not. The iOS embedder now uses timings based on CoreAnimation throughout and translates to `fml::TimePoint` only at the engine-embedder boundary. This is consistent with embedders based on the embedder API, such as macOS, which does this work in `-[FlutterEngine viewControllerViewDidLoad]` using `FlutterTimeConverter`. Added tests for frame rate snapping/fallback. No other test changes because this introduces no semantic change and is covered by existing tests recently added in: flutter#186457 Issue: flutter#112232 <!-- Thanks for filing a pull request! Reviewers are typically assigned within a week of filing a request. To learn more about code review, see our documentation on Tree Hygiene: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md --> ## Pre-launch Checklist - [X] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [X] I read the [AI contribution guidelines] and understand my responsibilities, or I am not using AI tools. - [X] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [X] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [X] I signed the [CLA]. - [X] I listed at least one issue that this PR fixes in the description above. - [X] I tested the crap outta this cause I really don't want to write another post-mortem. - [X] I updated/added relevant documentation (doc comments with `///`). - [X] I added new tests to check the change I am making, or this PR is [test-exempt]. - [X] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [X] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. If this change needs to override an active code freeze, provide a comment explaining why. The code freeze workflow can be overridden by code reviewers. See pinned issues for any active code freezes with guidance. **Note**: The Flutter team is currently trialing the use of [Gemini Code Assist for GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code). Comments from the `gemini-code-assist` bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [AI contribution guidelines]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#ai-contribution-guidelines [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
Migrates
FlutterVSyncClientfrom a hybrid C++/Obj-C implementation to a pure Objective-C implementation by removing C++ types from its interface and implementation.Previously,
FlutterVSyncClientstored a C++flutter::VsyncWaiter::Callbackand used a temporarystd::unique_ptr<flutter::FrameTimingsRecorder>to propagate vsync timestamps. This was redundant:FlutterVSyncClientallocated a temporaryFrameTimingsRecorderand recorded vsync times.VsyncWaiterIOSconverted the seconds back tofml::TimePoint.VsyncWaiter::FireCallbackallocated anotherFrameTimingsRecorderand recorded the same times again.We now:
CFTimeInterval(double seconds) directly fromCADisplayLink.FrameTimingsRecorderand C++ lambda wrapper.VsyncWaiter::FireCallbackto handle the finalFrameTimingsRecordercreation and recording, which it already does.No test changes because this introduces no semantic change and is covered by existing tests recently added in:
https://github.com/flutter/flutter/blob/master/engine/src/flutter/shell/platform/darwin/ios/framework/Source/VSyncClientTest.swift
Pre-launch Checklist
///).If you need help, consider asking for advice on the #hackers-new channel on Discord.
If this change needs to override an active code freeze, provide a comment explaining why. The code freeze workflow can be overridden by code reviewers. See pinned issues for any active code freezes with guidance.
Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the
gemini-code-assistbot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.