-
Notifications
You must be signed in to change notification settings - Fork 3.3k
[web_benchmarks] Migrate to PlatformDispatcher API #3512
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
Conversation
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 Hixie on the #hackers channel in Chat (don't just cc him here, he won't see it! He's on 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. |
@@ -238,7 +238,7 @@ abstract class SceneBuilderRecorder extends Recorder { | |||
final Completer<Profile> profileCompleter = Completer<Profile>(); | |||
_profile = Profile(name: name); | |||
|
|||
window.onBeginFrame = (_) { | |||
PlatformDispatcher.instance.onBeginFrame = (_) { |
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.
This API was introduced almost three years ago (flutter/engine#20496) and has been on the stable channel for a long time. Migrating to it directly will not scarify backwards compatibility to any of the versions we care about.
try { | ||
_profile.record('drawFrameDuration', () { | ||
final SceneBuilder sceneBuilder = SceneBuilder(); | ||
onDrawFrame(sceneBuilder); | ||
_profile.record('sceneBuildDuration', () { | ||
final Scene scene = sceneBuilder.build(); | ||
_profile.record('windowRenderDuration', () { | ||
window.render(scene); | ||
// TODO(goderbauer): Migrate to PlatformDispatcher.implicitView once v3.9.0 is the oldest supported Flutter version. | ||
window.render(scene); // ignore: deprecated_member_use |
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.
The replacement API for this particular call was only introduced recently, so we cannot migrate to it yet to remain backwards compatible with older versions. Ignoring the deprecation warning for the upcoming deprecation in flutter/engine#39302.
test-exempt: code refactor with no semantic change |
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.
[web_benchmarks] Migrate to PlatformDispatcher API
Part of flutter/flutter#116929.
Migrates away from the soon to be deprecated
window
singleton API to the PlatformDispatcher API.Pre-launch Checklist
dart format
.)[shared_preferences]
pubspec.yaml
with an appropriate new version according to the pub versioning philosophy, or this PR is exempt from version changes.CHANGELOG.md
to add a description of the change, following repository CHANGELOG style.///
).If you need help, consider asking for advice on the #hackers-new channel on Discord.