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