Expose `vsync` information to developer
This PR tries to expose vsync information to the developer, so they can know when it is proper to call the more un-restricted window.render proposed in #36438.
Currently only the API is shown, because IMHO the implementation details is unrelated to thoughts about #36438, and the API (and therefore implementations) are subject to changes. I will continue working on it, once the API is approved.
For detailed design about this API and its implementation, please have a look at "Get last vsync time information" section of https://docs.google.com/document/d/1FuNcBvAPghUyjeqQCOYxSt6lGDAQ1YxsNlOvrUx0Gko/edit.
Sample usage:
final info = SchedulerBinding.instance.lastVsyncInfo();
List of work:
- [x] code the (draft) Dart API
- [ ] discuss whether the API is acceptable
- [ ] implement the C++ part on SDK<=29 Android
- [ ] implement the C++ part on new android, ios, and other platforms
- [ ] create a wrapper function in
flutter/flutterrepo, probably inSchedulerBinding
List which issues are fixed by this PR. You must list at least one issue.
If you had to change anything in the flutter/tests repo, include a link to the migration guide as per the breaking change policy.
Pre-launch Checklist
- [x] I read the Contributor Guide and followed the process outlined there for submitting PRs.
- [x] I read the Tree Hygiene wiki page, which explains my responsibilities.
- [x] I read and followed the Flutter Style Guide and the C++, Objective-C, Java style guides.
- [ ] I listed at least one issue that this PR fixes in the description above.
- [ ] I added new tests to check the change I am making or feature I am adding, or Hixie said the PR is test-exempt. See testing the engine for instructions on writing and running engine tests.
- [x] I updated/added relevant documentation (doc comments with
///). - [x] I signed the CLA.
- [ ] All existing and new tests are passing.
If you need help, consider asking for advice on the #hackers-new channel on Discord.