Chris Yang 259217c7aa [ios_platform_view] only recycle maskView when the view is applying mutators (flutter/engine#41573)
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
2023-05-16 16:24:05 +00:00
Languages
Dart 75%
C++ 16.5%
Objective-C++ 2.9%
Java 2.8%
Objective-C 0.7%
Other 1.9%