mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
A mistake was introduced in https://github.com/flutter/engine/pull/39498 where the maskViews are already recycles each frame. Sometimes a PlatformView does not need to be re-composite: (https://github.com/flutter/engine/blob/main/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews.mm#L398-L401), so the mask view for such PlatformView should not be recycled. This PR changed the `recycleMaskViews` API to allow individual maskviews to be recycled. `ApplyMutator` then only recycle the maskView for that particular PlatformView. The MaskViewPool is also reworked to be simpler. - The pool now contains a single set of mask views, there is no index counter needed. - When a maskView is needed, try to get it from the pool. - If pool is empty, create a new view. - If pool has an available maskview, remove it from the pool. - When a PlatformView starts to `applyMutator`, it removes current the maskView, insert the maskView to the pool. - When the above PlatformView needs to a maskView, it grabs one from the pool. fixes: https://github.com/flutter/flutter/issues/125620 [C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style