Fix race condition in Unobstructed Platform View Scenario tests (flutter/engine#48096)
Fixes race situation where `_onPlatformMessage` is triggered before the first frame, essentially skipping the first frame. Fixes https://github.com/flutter/flutter/issues/138193. [C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
This commit is contained in:
committed by
GitHub
parent
50edc5f397
commit
1cb5474a11
@@ -422,7 +422,6 @@ class MultiPlatformViewBackgroundForegroundScenario extends Scenario
|
||||
required this.secondId,
|
||||
}) {
|
||||
_nextFrame = _firstFrame;
|
||||
channelBuffers.setListener('flutter/lifecycle', _onPlatformMessage);
|
||||
}
|
||||
|
||||
/// The platform view identifier to use for the first platform view.
|
||||
@@ -438,7 +437,13 @@ class MultiPlatformViewBackgroundForegroundScenario extends Scenario
|
||||
_nextFrame();
|
||||
}
|
||||
|
||||
bool _firstFrameBegan = false;
|
||||
|
||||
void _firstFrame() {
|
||||
if (!_firstFrameBegan) {
|
||||
channelBuffers.setListener('flutter/lifecycle', _onPlatformMessage);
|
||||
}
|
||||
_firstFrameBegan = true;
|
||||
final SceneBuilder builder = SceneBuilder();
|
||||
|
||||
builder.pushOffset(50, 600);
|
||||
|
||||
Reference in New Issue
Block a user