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

This should fix https://github.com/flutter/flutter/issues/31442 and https://github.com/flutter/flutter/issues/34867
This commit is contained in:
liyuqian
2019-07-26 09:38:12 -07:00
committed by GitHub
parent 2e43b47008
commit 68fc7231b3
11 changed files with 103 additions and 14 deletions

View File

@@ -499,6 +499,14 @@ class FlutterDriver {
await _sendCommand(WaitUntilNoTransientCallbacks(timeout: timeout));
}
/// Waits until the next [Window.onReportTimings] is called.
///
/// Use this method to wait for the first frame to be rasterized during the
/// app launch.
Future<void> waitUntilFirstFrameRasterized() async {
await _sendCommand(const WaitUntilFirstFrameRasterized());
}
Future<DriverOffset> _getOffset(SerializableFinder finder, OffsetType type, { Duration timeout }) async {
final GetOffset command = GetOffset(finder, type, timeout: timeout);
final GetOffsetResult result = GetOffsetResult.fromJson(await _sendCommand(command));