Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(743)

Unified Diff: third_party/WebKit/Source/modules/compositorworker/AnimationWorkletGlobalScope.cpp

Issue 2903703003: Use wrapper tracing for worklets. (Closed)
Patch Set: Separating in two CLs Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..c585d7bba24a2b1fe032a0db1863c4171ebef72c 100644
--- a/third_party/WebKit/Source/modules/compositorworker/AnimationWorkletGlobalScope.cpp
+++ b/third_party/WebKit/Source/modules/compositorworker/AnimationWorkletGlobalScope.cpp
@@ -41,17 +41,19 @@ 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);
}
-void AnimationWorkletGlobalScope::Dispose() {
- DCHECK(IsContextThread());
- // Clear animators and definitions to avoid reference cycle.
- m_animatorDefinitions.clear();
- m_animators.clear();
- ThreadedWorkletGlobalScope::Dispose();
+DEFINE_TRACE_WRAPPERS(AnimationWorkletGlobalScope) {
+ for (auto animator : animators_)
+ visitor->TraceWrappers(animator);
+
+ for (auto definition : animator_definitions_)
+ visitor->TraceWrappers(definition.value);
+
+ ThreadedWorkletGlobalScope::TraceWrappers(visitor);
}
void AnimationWorkletGlobalScope::registerAnimator(
@@ -59,7 +61,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 +120,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;

Powered by Google App Engine
This is Rietveld 408576698