Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 93a88853044da9b0fa1c3f07a42945b909fb68b7
https://github.com/WebKit/WebKit/commit/93a88853044da9b0fa1c3f07a42945b909fb68b7
Author: Ahmad Saleem <[email protected]>
Date: 2026-08-02 (Sun, 02 Aug 2026)
Changed paths:
M Source/WebCore/svg/animation/SMILTimeContainer.cpp
Log Message:
-----------
SMILTimeContainer::updateAnimations() copies the scheduled animations map
twice per frame
https://bugs.webkit.org/show_bug.cgi?id=320819
rdar://183831859
Reviewed by Chris Dumez.
updateAnimations() is the per-frame entry point for SMIL, and it deep-copies
m_scheduledAnimations twice: once via processScheduledAnimations() for the
lazy connectConditions() pass, and again for the loop that progresses the
animations. Since the map value type is a Vector<WeakRef<SVGSMILElement>>,
each copyToVector() allocates the outer vector plus one inner vector per
element/attribute group, and ref/derefs every scheduled animation's
WeakPtrImpl. All of that happens twice on every animation tick.
Take one snapshot and share it between the two passes. The copy itself has
to stay: 225240@main added it because progressing an animation can run
script that calls schedule()/unschedule() and invalidates the map's
iterators. Connecting conditions cannot do that, though. connectConditions()
can reach addTimeDependent() -> createInstanceTimesFromSyncbase() ->
addInstanceTime() -> beginListChanged()/endListChanged(), but nothing on
that path schedules or unschedules, and SMIL events are queued through
SMILEventSender::dispatchEventSoon() rather than dispatched synchronously.
So the first pass cannot invalidate the snapshot the second pass relies on.
The connect pass is inlined rather than left in processScheduledAnimations(),
since sharing a snapshot means iterating a vector the caller owns.
processScheduledAnimations() is still used by setElapsed().
No change in behavior.
* Source/WebCore/svg/animation/SMILTimeContainer.cpp:
(WebCore::SMILTimeContainer::updateAnimations):
Canonical link: https://commits.webkit.org/318420@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications