这是indexloc提供的服务,不要输入任何密码
Skip to content

Reland "Fix the first frame logic in tracing and driver (#35297)" #37192

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

Merged
merged 3 commits into from
Jul 31, 2019

Conversation

liyuqian
Copy link
Contributor

@liyuqian liyuqian commented Jul 29, 2019

This relands #35297

The followings have been done to fix the broken tests:

  1. Add didSendFirstFrameRasterizedEvent extension and its tests
  2. Wait for didSendFirstFrameRasterizedEvent instead of
    didSendFirstFrameEvent during start up tests
  3. Mark missed (probably newly added) start up tests as flaky

liyuqian added 2 commits July 29, 2019 12:45
1. Add didSendFirstFrameRasterizedEvent extension and its tests
2. Wait for didSendFirstFrameRasterizedEvent instead of
   didSendFirstFrameEvent during start up tests
3. Mark missed (probably newly added) start up tests as flaky
Copy link
Contributor

@jonahwilliams jonahwilliams left a comment

Choose a reason for hiding this comment

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

LGTM

@codecov
Copy link

codecov bot commented Jul 29, 2019

Codecov Report

Merging #37192 into master will increase coverage by 0.61%.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #37192      +/-   ##
==========================================
+ Coverage   54.55%   55.16%   +0.61%     
==========================================
  Files         193      193              
  Lines       17849    17851       +2     
==========================================
+ Hits         9738     9848     +110     
+ Misses       8111     8003     -108
Flag Coverage Δ
#flutter_tool 55.16% <0%> (+0.61%) ⬆️
Impacted Files Coverage Δ
packages/flutter_tools/lib/src/vmservice.dart 37.3% <0%> (+0.15%) ⬆️
packages/flutter_tools/lib/src/tracing.dart 0% <0%> (ø) ⬆️
.../flutter_tools/lib/src/commands/build_fuchsia.dart 13.63% <0%> (-68.19%) ⬇️
...tools/lib/src/fuchsia/fuchsia_kernel_compiler.dart 0% <0%> (-7.7%) ⬇️
...ages/flutter_tools/lib/src/commands/build_aot.dart 29.59% <0%> (-6.13%) ⬇️
...ges/flutter_tools/lib/src/fuchsia/fuchsia_sdk.dart 64.81% <0%> (-3.71%) ⬇️
...utter_tools/lib/src/reporting/crash_reporting.dart 72.5% <0%> (-2.5%) ⬇️
...lutter_tools/lib/src/android/android_workflow.dart 62.33% <0%> (-1.95%) ⬇️
...ages/flutter_tools/lib/src/base/user_messages.dart 49.03% <0%> (-0.97%) ⬇️
packages/flutter_tools/lib/src/cache.dart 41.83% <0%> (-0.77%) ⬇️
... and 9 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c8be195...662638e. Read the comment docs.

/// A future that completes when the Flutter engine has rasterized the first
/// frame.
///
/// {@macro flutter.frame_rasterize`_vs_presented}
Copy link
Member

Choose a reason for hiding this comment

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

nit: is the ` supposed to be in there?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No. Thanks!

@@ -567,6 +587,8 @@ mixin WidgetsBinding on BindingBase, SchedulerBinding, GestureBinding, RendererB
///
/// This value can also be obtained over the VM service protocol as
/// `ext.flutter.didSendFirstFrameEvent`.
///
/// See also [firstFrameRasterized].
Copy link
Member

Choose a reason for hiding this comment

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

style for "see also" is:

Suggested change
/// See also [firstFrameRasterized].
/// See also:
///
/// * [firstFrameRasterized], <reason why I should look there>.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

/// A future that completes when the Flutter engine has rasterized the first
/// frame.
///
/// {@macro flutter.frame_rasterize`_vs_presented}
Copy link
Member

Choose a reason for hiding this comment

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

This should probably have a "see also" section (see below for style) linking to firstFrameRasterized.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@@ -556,9 +570,15 @@ mixin WidgetsBinding on BindingBase, SchedulerBinding, GestureBinding, RendererB
/// Whether the Flutter engine has rasterized the first frame.
///
/// {@macro flutter.frame_rasterized_vs_presented}
Future<void> get firstFrameRasterized => _firstFrameCompleter.future;
bool get firstFrameRasterized => _firstFrameCompleter.isCompleted;
Copy link
Member

Choose a reason for hiding this comment

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

Add a "see also" section linking to the future version?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

/// frame.
///
/// {@macro flutter.frame_rasterize`_vs_presented}
Future<void> get waitUntilFirstFrameRasterized => _firstFrameCompleter.future;
Copy link
Member

Choose a reason for hiding this comment

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

The name is a little misleading because calling the getter doesn't actually wait for anything. The caller has to do the waiting by awaiting on the result. Not sure what a better name would be, though...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can't think of a better name either. But since Dart never has a synchronous waiting mechanism, it seems to be Ok to return a Future for a waitUntilXYZ function? The only way to wait in Dart is await (see, e.g., https://github.com/flutter/flutter/blob/master/packages/flutter_driver/lib/src/extension/extension.dart#L242)?

Copy link
Contributor Author

@liyuqian liyuqian left a comment

Choose a reason for hiding this comment

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

Thanks for the suggestions!

@@ -556,9 +570,15 @@ mixin WidgetsBinding on BindingBase, SchedulerBinding, GestureBinding, RendererB
/// Whether the Flutter engine has rasterized the first frame.
///
/// {@macro flutter.frame_rasterized_vs_presented}
Future<void> get firstFrameRasterized => _firstFrameCompleter.future;
bool get firstFrameRasterized => _firstFrameCompleter.isCompleted;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

/// A future that completes when the Flutter engine has rasterized the first
/// frame.
///
/// {@macro flutter.frame_rasterize`_vs_presented}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

No. Thanks!

/// A future that completes when the Flutter engine has rasterized the first
/// frame.
///
/// {@macro flutter.frame_rasterize`_vs_presented}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@@ -567,6 +587,8 @@ mixin WidgetsBinding on BindingBase, SchedulerBinding, GestureBinding, RendererB
///
/// This value can also be obtained over the VM service protocol as
/// `ext.flutter.didSendFirstFrameEvent`.
///
/// See also [firstFrameRasterized].
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

/// frame.
///
/// {@macro flutter.frame_rasterize`_vs_presented}
Future<void> get waitUntilFirstFrameRasterized => _firstFrameCompleter.future;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can't think of a better name either. But since Dart never has a synchronous waiting mechanism, it seems to be Ok to return a Future for a waitUntilXYZ function? The only way to wait in Dart is await (see, e.g., https://github.com/flutter/flutter/blob/master/packages/flutter_driver/lib/src/extension/extension.dart#L242)?

@Piinks Piinks added engine flutter/engine repository. See also e: labels. framework flutter/packages/flutter repository. See also f: labels. labels Jul 30, 2019
Copy link
Member

@goderbauer goderbauer left a comment

Choose a reason for hiding this comment

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

LGTM

@liyuqian liyuqian merged commit e77237d into flutter:master Jul 31, 2019
@liyuqian liyuqian deleted the reland_first_frame branch August 1, 2019 17:20
@Hixie
Copy link
Contributor

Hixie commented Aug 25, 2019

@liyuqian Can we mark the previously existing tests non-flaky again and/or revert this PR? We can't be having these critical benchmarks be considered ok-to-break.

@liyuqian
Copy link
Contributor Author

@Hixie : This PR is quite old so reverting it may introduce many conflicts. PR #39212 should revert the effect of this PR on that flaky test.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 4, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
engine flutter/engine repository. See also e: labels. framework flutter/packages/flutter repository. See also f: labels.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants