OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CustomElementMicrotaskDispatcher_h | |
6 #define CustomElementMicrotaskDispatcher_h | |
7 | |
8 #include "platform/heap/Handle.h" | |
9 #include "wtf/Noncopyable.h" | |
10 #include "wtf/Vector.h" | |
11 | |
12 namespace blink { | |
13 | |
14 class CustomElementCallbackQueue; | |
15 | |
16 class CustomElementMicrotaskDispatcher final : public GarbageCollected<CustomEle
mentMicrotaskDispatcher> { | |
17 WTF_MAKE_NONCOPYABLE(CustomElementMicrotaskDispatcher); | |
18 public: | |
19 static CustomElementMicrotaskDispatcher& instance(); | |
20 | |
21 void enqueue(CustomElementCallbackQueue*); | |
22 | |
23 bool elementQueueIsEmpty() { return m_elements.isEmpty(); } | |
24 | |
25 DECLARE_TRACE(); | |
26 | |
27 private: | |
28 CustomElementMicrotaskDispatcher(); | |
29 | |
30 void ensureMicrotaskScheduledForElementQueue(); | |
31 void ensureMicrotaskScheduled(); | |
32 | |
33 static void dispatch(); | |
34 void doDispatch(); | |
35 | |
36 bool m_hasScheduledMicrotask; | |
37 enum { | |
38 Quiescent, | |
39 Resolving, | |
40 DispatchingCallbacks | |
41 } m_phase; | |
42 | |
43 HeapVector<Member<CustomElementCallbackQueue>> m_elements; | |
44 }; | |
45 | |
46 } // namespace blink | |
47 | |
48 #endif // CustomElementMicrotaskDispatcher_h | |
OLD | NEW |