OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 CustomElementReactionStack_h | 5 #ifndef CustomElementReactionStack_h |
6 #define CustomElementReactionStack_h | 6 #define CustomElementReactionStack_h |
7 | 7 |
| 8 #include "bindings/core/v8/ScriptWrappable.h" |
8 #include "core/CoreExport.h" | 9 #include "core/CoreExport.h" |
9 #include "platform/heap/Handle.h" | 10 #include "platform/heap/Handle.h" |
10 #include "wtf/Noncopyable.h" | 11 #include "wtf/Noncopyable.h" |
11 | 12 |
12 namespace blink { | 13 namespace blink { |
13 | 14 |
14 class CustomElementReaction; | 15 class CustomElementReaction; |
15 class CustomElementReactionQueue; | 16 class CustomElementReactionQueue; |
16 class Element; | 17 class Element; |
17 | 18 |
18 // https://html.spec.whatwg.org/multipage/scripting.html#custom-element-reaction
s | 19 // https://html.spec.whatwg.org/multipage/scripting.html#custom-element-reaction
s |
19 class CORE_EXPORT CustomElementReactionStack final | 20 class CORE_EXPORT CustomElementReactionStack final |
20 : public GarbageCollected<CustomElementReactionStack> { | 21 : public GarbageCollected<CustomElementReactionStack>, |
| 22 public TraceWrapperBase { |
21 WTF_MAKE_NONCOPYABLE(CustomElementReactionStack); | 23 WTF_MAKE_NONCOPYABLE(CustomElementReactionStack); |
22 | 24 |
23 public: | 25 public: |
24 CustomElementReactionStack(); | 26 CustomElementReactionStack(); |
25 | 27 |
26 DECLARE_TRACE(); | 28 DECLARE_TRACE(); |
| 29 DECLARE_VIRTUAL_TRACE_WRAPPERS(); |
27 | 30 |
28 void push(); | 31 void push(); |
29 void popInvokingReactions(); | 32 void popInvokingReactions(); |
30 void enqueueToCurrentQueue(Element*, CustomElementReaction*); | 33 void enqueueToCurrentQueue(Element*, CustomElementReaction*); |
31 void enqueueToBackupQueue(Element*, CustomElementReaction*); | 34 void enqueueToBackupQueue(Element*, CustomElementReaction*); |
32 void clearQueue(Element*); | 35 void clearQueue(Element*); |
33 | 36 |
34 static CustomElementReactionStack& current(); | 37 static CustomElementReactionStack& current(); |
35 | 38 |
36 private: | 39 private: |
37 friend class CustomElementReactionStackTestSupport; | 40 friend class CustomElementReactionStackTestSupport; |
38 | 41 |
39 using ElementReactionQueueMap = | 42 using ElementReactionQueueMap = |
40 HeapHashMap<Member<Element>, Member<CustomElementReactionQueue>>; | 43 HeapHashMap<TraceWrapperMember<Element>, |
| 44 Member<CustomElementReactionQueue>>; |
41 ElementReactionQueueMap m_map; | 45 ElementReactionQueueMap m_map; |
42 | 46 |
43 using ElementQueue = HeapVector<Member<Element>, 1>; | 47 using ElementQueue = HeapVector<Member<Element>, 1>; |
44 HeapVector<Member<ElementQueue>> m_stack; | 48 HeapVector<Member<ElementQueue>> m_stack; |
45 Member<ElementQueue> m_backupQueue; | 49 Member<ElementQueue> m_backupQueue; |
46 | 50 |
47 void invokeBackupQueue(); | 51 void invokeBackupQueue(); |
48 void invokeReactions(ElementQueue&); | 52 void invokeReactions(ElementQueue&); |
49 void enqueue(Member<ElementQueue>&, Element*, CustomElementReaction*); | 53 void enqueue(Member<ElementQueue>&, Element*, CustomElementReaction*); |
50 }; | 54 }; |
51 | 55 |
52 class CORE_EXPORT CustomElementReactionStackTestSupport final { | 56 class CORE_EXPORT CustomElementReactionStackTestSupport final { |
53 private: | 57 private: |
54 friend class ResetCustomElementReactionStackForTest; | 58 friend class ResetCustomElementReactionStackForTest; |
55 | 59 |
56 CustomElementReactionStackTestSupport() = delete; | 60 CustomElementReactionStackTestSupport() = delete; |
57 static CustomElementReactionStack* setCurrentForTest( | 61 static CustomElementReactionStack* setCurrentForTest( |
58 CustomElementReactionStack*); | 62 CustomElementReactionStack*); |
59 }; | 63 }; |
60 | 64 |
61 } // namespace blink | 65 } // namespace blink |
62 | 66 |
63 #endif // CustomElementReactionStack_h | 67 #endif // CustomElementReactionStack_h |
OLD | NEW |