Introduce UnderlyingValue to avoid mutable NonInterpolableValues
Instead of passing around scoped_refptr<NonInterpolableValue>&, pass around a virtual UnderlyingValue& which represents the underlying value. This should allow the internal APIs to cooperate better long term, since UnderlyingValue can have multiple implementations depending on what's required by the circumstance. If ::Composite now wants to modify the NonInterpolableValue, it must replace the entire value; it can no longer mutate the incoming scoped_refptr. This property will make it possible to store a scoped_refptr<const NonInterpolableValue> in InterpolationValue. A consequence of this is that ListInterpolationFunctions can no longer modify the underlying NonInterpolableList in-place. Hence NonInterpolableList::AutoBuilder is added to implement copy-on-write-like behavior for those lists. (Note that this in-place mutation of the underlying NonInterpolableList is the main reason why we can't just store a scoped_refptr<const NonInterpolableValue> in InterpolationValue in the first place ...) Bug: 981024 Change-Id: Iadc105beea9ea0006ce638011dd7b3168149449f Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1722967 Commit-Queue: Anders Hartvoll Ruud <andruud@chromium.org> Reviewed-by:Robert Flack <flackr@chromium.org> Cr-Commit-Position: refs/heads/master@{#682627}
Showing
Please register or sign in to comment