OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 CustomElementMicrotaskDispatcher_h | 5 #ifndef CustomElementMicrotaskDispatcher_h |
6 #define CustomElementMicrotaskDispatcher_h | 6 #define CustomElementMicrotaskDispatcher_h |
7 | 7 |
8 #include "core/dom/custom/CustomElementMicrotaskQueue.h" | 8 #include "core/dom/custom/CustomElementMicrotaskQueue.h" |
| 9 #include "platform/heap/Handle.h" |
9 #include "wtf/Noncopyable.h" | 10 #include "wtf/Noncopyable.h" |
10 #include "wtf/PassOwnPtr.h" | 11 #include "wtf/PassOwnPtr.h" |
11 #include "wtf/Vector.h" | 12 #include "wtf/Vector.h" |
12 | 13 |
13 namespace WebCore { | 14 namespace WebCore { |
14 | 15 |
15 class CustomElementCallbackQueue; | 16 class CustomElementCallbackQueue; |
16 class CustomElementMicrotaskImportStep; | 17 class CustomElementMicrotaskImportStep; |
17 class CustomElementMicrotaskStep; | 18 class CustomElementMicrotaskStep; |
18 class HTMLImportLoader; | 19 class HTMLImportLoader; |
19 | 20 |
20 class CustomElementMicrotaskDispatcher { | 21 class CustomElementMicrotaskDispatcher FINAL : public NoBaseWillBeGarbageCollect
edFinalized<CustomElementMicrotaskDispatcher> { |
21 WTF_MAKE_NONCOPYABLE(CustomElementMicrotaskDispatcher); | 22 WTF_MAKE_NONCOPYABLE(CustomElementMicrotaskDispatcher); |
22 public: | 23 public: |
23 ~CustomElementMicrotaskDispatcher() { } | 24 ~CustomElementMicrotaskDispatcher() { } |
24 | 25 |
25 static CustomElementMicrotaskDispatcher& instance(); | 26 static CustomElementMicrotaskDispatcher& instance(); |
26 | 27 |
27 void enqueue(HTMLImportLoader*, PassOwnPtr<CustomElementMicrotaskStep>); | 28 void enqueue(HTMLImportLoader*, PassOwnPtrWillBeRawPtr<CustomElementMicrotas
kStep>); |
28 void enqueue(CustomElementCallbackQueue*); | 29 void enqueue(CustomElementCallbackQueue*); |
29 | 30 |
30 void importDidFinish(CustomElementMicrotaskImportStep*); | 31 void importDidFinish(CustomElementMicrotaskImportStep*); |
31 | 32 |
32 bool elementQueueIsEmpty() { return m_elements.isEmpty(); } | 33 bool elementQueueIsEmpty() { return m_elements.isEmpty(); } |
33 | 34 |
| 35 void trace(Visitor*); |
| 36 |
34 #if !defined(NDEBUG) | 37 #if !defined(NDEBUG) |
35 void show(); | 38 void show(); |
36 #endif | 39 #endif |
37 | 40 |
38 private: | 41 private: |
39 CustomElementMicrotaskDispatcher(); | 42 CustomElementMicrotaskDispatcher(); |
40 | 43 |
41 void ensureMicrotaskScheduled(); | 44 void ensureMicrotaskScheduled(); |
42 | 45 |
43 static void dispatch(); | 46 static void dispatch(); |
44 void doDispatch(); | 47 void doDispatch(); |
45 | 48 |
46 bool m_hasScheduledMicrotask; | 49 bool m_hasScheduledMicrotask; |
47 enum { | 50 enum { |
48 Quiescent, | 51 Quiescent, |
49 Resolving, | 52 Resolving, |
50 DispatchingCallbacks | 53 DispatchingCallbacks |
51 } m_phase; | 54 } m_phase; |
52 | 55 |
53 RefPtr<CustomElementMicrotaskQueue> m_resolutionAndImports; | 56 RefPtrWillBeMember<CustomElementMicrotaskQueue> m_resolutionAndImports; |
54 Vector<CustomElementCallbackQueue*> m_elements; | 57 WillBeHeapVector<RawPtrWillBeMember<CustomElementCallbackQueue> > m_elements
; |
55 }; | 58 }; |
56 | 59 |
57 } | 60 } |
58 | 61 |
59 #if !defined(NDEBUG) | 62 #if !defined(NDEBUG) |
60 void showCEMD(); | 63 void showCEMD(); |
61 #endif | 64 #endif |
62 | 65 |
63 #endif // CustomElementMicrotaskDispatcher_h | 66 #endif // CustomElementMicrotaskDispatcher_h |
OLD | NEW |