Fix race condition in Platform View Scenario tests (flutter/engine#47575)

Fixes race condition in Platform View Scenario tests, see https://github.com/flutter/flutter/issues/126627 for description of issue.

Fixes https://github.com/flutter/flutter/issues/137547 and https://github.com/flutter/flutter/issues/126627.

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
This commit is contained in:
Victoria Ashworth
2023-11-02 10:16:46 -05:00
committed by GitHub
parent 936eb5a66e
commit 88bfe1a6da

View File

@@ -1758,6 +1758,7 @@ class PlatformViewsWithClipsScrolling extends Scenario
}
final Map<String, int> _createdPlatformViews = <String, int> {};
final Map<String, bool> _calledToBeCreatedPlatformViews = <String, bool> {};
/// Adds the platform view to the scene.
///
@@ -1787,6 +1788,10 @@ void addPlatformView(
);
return;
}
if (_calledToBeCreatedPlatformViews.containsKey(platformViewKey)) {
return;
}
_calledToBeCreatedPlatformViews[platformViewKey] = true;
final bool usesAndroidHybridComposition = scenarioParams['use_android_view'] as bool? ?? false;
final bool expectAndroidHybridCompositionFallback =