Reland "[skottie] Don't revalidate during render()"

This reverts commit 2c4ef084e8bc9c97678afd29fd0a3b0e21021d56.

Reason for revert: relanding w/ fixes

Original change's description:
> Revert "[skottie] Don't revalidate during render()"
>
> This reverts commit d35b033017179d6b40f0a81b5ceec2715e4e6012.
>
> Reason for revert: Breaking G3 roll.
>
> Original change's description:
> > [skottie] Don't revalidate during render()
> >
> > Updating property handles causes scene graph invalidation, and requires
> > a revalidation pass before rendering.
> >
> > To hide this detail from clients, we're currently revalidating in
> > sksg::Scene::render(), just before diving into the scene graph.
> >
> > That's problematic, because render() is supposed to be const and
> > thread-safe.
> >
> > This CL removes the revalidation call from Scene::render(), and
> > replaces it with on-the-fly revalidation in property setters:
> >
> >   - Introduce SceneGraphRevalidator (SGR), a trivial wrapper which
> >     forwards revalidation calls to the render tree root. This
> >     indirection is required because the render tree root does not
> >     exist at build time, when property callbacks are issued and
> >     property handles are created.
> >   - Expand PropertyHandle to store a SGR reference, and to issue
> >     revalidate() calls from all property setters.
> >   - Adjust the animation builder to store a sksg::RenderNode root
> >     instead of sksg::Scene, and to push the root information to SGR
> >     as the very last step.
> >
> > Also relocate existing property tests to
> > modules/skottie/tests/PropertyObserver.cpp, and add a new test to
> > verify revalidation for property changes.
> >
> > There are two interesting scenarios to consider:
> >
> > 1) Properties are updated while the animation is loading, in
> > callbacks, and then the animation is rendered without an explicit
> > seek() call: in this case, on-the-fly revalidation is suppressed because the root node does not exist, but an initial revalidation is
> > triggered at the end of parsing, in AnimationBuilder::parse().
> >
> > 2) Properties are updated after the animation is loaded, and then
> > the animation is rendered without an explicit seek() call: in this
> > case, revalidation is triggered on-the-fly, from property setters.
> >
> >
> > Change-Id: I72fb515d5d82dbaa595ba546fb1b8ab81cec2638
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/699577
> > Reviewed-by: Jorge Betancourt <jmbetancourt@google.com>
> > Commit-Queue: Florin Malita <fmalita@chromium.org>
>
> Change-Id: Iae6bccab9346e9554ae0100e0ce1a633b18df934
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/701525
> Auto-Submit: Leon Scroggins <scroggo@google.com>
> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
> Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>

Change-Id: I0439fe987f8a85b0b30d3e1bd69dfabea6a0e86e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/701897
Commit-Queue: Florin Malita <fmalita@google.com>
Reviewed-by: Jorge Betancourt <jmbetancourt@google.com>
13 files changed