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