Chromium Code Reviews| Index: third_party/WebKit/Source/modules/compositorworker/AnimationWorkletGlobalScope.cpp |
| diff --git a/third_party/WebKit/Source/modules/compositorworker/AnimationWorkletGlobalScope.cpp b/third_party/WebKit/Source/modules/compositorworker/AnimationWorkletGlobalScope.cpp |
| index 5266de02f6bb10a681fac6b8b3e091ed99e47ee1..1922f32d01b82f819d6e5cf1b485d55d8c87f9e7 100644 |
| --- a/third_party/WebKit/Source/modules/compositorworker/AnimationWorkletGlobalScope.cpp |
| +++ b/third_party/WebKit/Source/modules/compositorworker/AnimationWorkletGlobalScope.cpp |
| @@ -41,16 +41,21 @@ AnimationWorkletGlobalScope::AnimationWorkletGlobalScope( |
| AnimationWorkletGlobalScope::~AnimationWorkletGlobalScope() {} |
| DEFINE_TRACE(AnimationWorkletGlobalScope) { |
| - visitor->Trace(m_animatorDefinitions); |
| - visitor->Trace(m_animators); |
| + visitor->Trace(animator_definitions_); |
| + visitor->Trace(animators_); |
| ThreadedWorkletGlobalScope::Trace(visitor); |
| } |
| +DEFINE_TRACE_WRAPPERS(AnimationWorkletGlobalScope) { |
| + for (auto animator : animators_) |
| + visitor->TraceWrappers(animator); |
| + |
| + for (auto definition : animator_definitions_) |
| + visitor->TraceWrappers(definition.value); |
|
Michael Lippautz
2017/05/24 14:42:43
Missing dispatch to parent:
ThreadedWorkletGloba
majidvp
2017/05/25 20:16:57
Done.
|
| +} |
| + |
| void AnimationWorkletGlobalScope::Dispose() { |
| DCHECK(IsContextThread()); |
| - // Clear animators and definitions to avoid reference cycle. |
| - m_animatorDefinitions.clear(); |
| - m_animators.clear(); |
| ThreadedWorkletGlobalScope::Dispose(); |
| } |
| @@ -59,7 +64,7 @@ void AnimationWorkletGlobalScope::registerAnimator( |
| const ScriptValue& ctorValue, |
| ExceptionState& exceptionState) { |
| DCHECK(IsContextThread()); |
| - if (m_animatorDefinitions.Contains(name)) { |
| + if (animator_definitions_.Contains(name)) { |
| exceptionState.ThrowDOMException( |
| kNotSupportedError, |
| "A class with name:'" + name + "' is already registered."); |
| @@ -118,16 +123,18 @@ void AnimationWorkletGlobalScope::registerAnimator( |
| AnimatorDefinition* definition = |
| new AnimatorDefinition(isolate, constructor, animate); |
| - m_animatorDefinitions.Set(name, definition); |
| + animator_definitions_.Set( |
| + name, TraceWrapperMember<AnimatorDefinition>(this, definition)); |
| // Immediately instantiate an animator for the registered definition. |
| // TODO(majidvp): Remove this once you add alternative way to instantiate |
| - m_animators.push_back(CreateInstance(name)); |
| + Animator* animator = CreateInstance(name); |
| + animators_.push_back(TraceWrapperMember<Animator>(this, animator)); |
| } |
| Animator* AnimationWorkletGlobalScope::CreateInstance(const String& name) { |
| DCHECK(IsContextThread()); |
| - AnimatorDefinition* definition = m_animatorDefinitions.at(name); |
| + AnimatorDefinition* definition = animator_definitions_.at(name); |
| if (!definition) |
| return nullptr; |