| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef Animator_h | 5 #ifndef Animator_h |
| 6 #define Animator_h | 6 #define Animator_h |
| 7 | 7 |
| 8 #include "platform/bindings/ScopedPersistent.h" | 8 #include "platform/bindings/ScriptWrappable.h" |
| 9 #include "platform/bindings/TraceWrapperMember.h" |
| 10 #include "platform/bindings/TraceWrapperV8Reference.h" |
| 9 #include "platform/heap/Handle.h" | 11 #include "platform/heap/Handle.h" |
| 10 #include "v8/include/v8.h" | 12 #include "v8/include/v8.h" |
| 11 | 13 |
| 12 namespace blink { | 14 namespace blink { |
| 13 | 15 |
| 14 class AnimatorDefinition; | 16 class AnimatorDefinition; |
| 15 | 17 |
| 16 class Animator final : public GarbageCollectedFinalized<Animator> { | 18 class Animator final : public GarbageCollectedFinalized<Animator>, |
| 19 public TraceWrapperBase { |
| 17 public: | 20 public: |
| 18 Animator(v8::Isolate*, AnimatorDefinition*, v8::Local<v8::Object> instance); | 21 Animator(v8::Isolate*, AnimatorDefinition*, v8::Local<v8::Object> instance); |
| 19 ~Animator(); | 22 ~Animator(); |
| 20 DECLARE_TRACE(); | 23 DECLARE_TRACE(); |
| 24 DECLARE_TRACE_WRAPPERS(); |
| 21 | 25 |
| 22 private: | 26 private: |
| 23 // This object keeps the definition object, and animator instance alive. | 27 // This object keeps the definition object, and animator instance alive. |
| 24 // It needs to be destroyed to break a reference cycle between it and the | 28 // It participates in wrapper tracing as it holds onto V8 wrappers. |
| 25 // AnimationWorkletGlobalScope. The reference cycle is broken at | 29 TraceWrapperMember<AnimatorDefinition> definition_; |
| 26 // |AnimationWorkletGlobalScope::Dispose()|. | 30 TraceWrapperV8Reference<v8::Object> instance_; |
| 27 Member<AnimatorDefinition> definition_; | |
| 28 ScopedPersistent<v8::Object> instance_; | |
| 29 }; | 31 }; |
| 30 | 32 |
| 31 } // namespace blink | 33 } // namespace blink |
| 32 | 34 |
| 33 #endif // Animator_h | 35 #endif // Animator_h |
| OLD | NEW |