Closed as not planned
Description
All the mutators are currently represented in a single Mutator class : https://github.com/flutter/engine/blob/main/flow/embedded_views.h#L38
The Mutator class has a union member that contains local variables for different types of mutators.
This causes some issue:
- Pointers in unions need to manually managed and it is error prone.
- Storing a copy of a scalar object creates overhead.
We can refactor the Mutator class in the following way so that each type of the mutator stores shared_pointers of the wrapped object separately.
- Make the
Mutator
class abstract. Mutator
class contains atype
method that gets the type of the mutator.- Make each type of Mutator a subclass of
Mutator
, for example,class TransformMutator : public Mutator
Mutator
class contains aasXXX
method that casting the object to the particular mutator. For example,asClipRect
returns aClipRectMutator
object.- Each subclass of
Mutator
contains a shared_ptr member that represents the content of the mutator.