| 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" | |
| 9 #include "platform/heap/Handle.h" | 8 #include "platform/heap/Handle.h" |
| 10 #include "wtf/Noncopyable.h" | 9 #include "wtf/Noncopyable.h" |
| 11 #include "wtf/PassOwnPtr.h" | 10 #include "wtf/PassOwnPtr.h" |
| 12 #include "wtf/Vector.h" | 11 #include "wtf/Vector.h" |
| 13 | 12 |
| 14 namespace WebCore { | 13 namespace WebCore { |
| 15 | 14 |
| 15 class CustomElementAsyncImportMicrotaskQueue; |
| 16 class CustomElementCallbackQueue; | 16 class CustomElementCallbackQueue; |
| 17 class CustomElementMicrotaskImportStep; | 17 class CustomElementMicrotaskImportStep; |
| 18 class CustomElementMicrotaskQueue; |
| 18 class CustomElementMicrotaskStep; | 19 class CustomElementMicrotaskStep; |
| 19 class HTMLImportLoader; | 20 class HTMLImportLoader; |
| 20 | 21 |
| 21 class CustomElementMicrotaskDispatcher FINAL : public NoBaseWillBeGarbageCollect
ed<CustomElementMicrotaskDispatcher> { | 22 class CustomElementMicrotaskDispatcher FINAL : public NoBaseWillBeGarbageCollect
ed<CustomElementMicrotaskDispatcher> { |
| 22 WTF_MAKE_NONCOPYABLE(CustomElementMicrotaskDispatcher); | 23 WTF_MAKE_NONCOPYABLE(CustomElementMicrotaskDispatcher); |
| 23 DECLARE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(CustomElementMicrotaskDispatcher); | 24 DECLARE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(CustomElementMicrotaskDispatcher); |
| 24 public: | 25 public: |
| 25 | |
| 26 static CustomElementMicrotaskDispatcher& instance(); | 26 static CustomElementMicrotaskDispatcher& instance(); |
| 27 | 27 |
| 28 void enqueue(HTMLImportLoader*, PassOwnPtrWillBeRawPtr<CustomElementMicrotas
kStep>); | 28 void enqueue(HTMLImportLoader* parentLoader, PassOwnPtrWillBeRawPtr<CustomEl
ementMicrotaskStep>); |
| 29 void enqueue(HTMLImportLoader* parentLoader, PassOwnPtrWillBeRawPtr<CustomEl
ementMicrotaskImportStep>, bool importIsSync); |
| 30 |
| 29 void enqueue(CustomElementCallbackQueue*); | 31 void enqueue(CustomElementCallbackQueue*); |
| 30 | 32 |
| 33 |
| 31 void importDidFinish(CustomElementMicrotaskImportStep*); | 34 void importDidFinish(CustomElementMicrotaskImportStep*); |
| 32 | 35 |
| 33 bool elementQueueIsEmpty() { return m_elements.isEmpty(); } | 36 bool elementQueueIsEmpty() { return m_elements.isEmpty(); } |
| 34 | 37 |
| 35 void trace(Visitor*); | 38 void trace(Visitor*); |
| 36 | 39 |
| 37 #if !defined(NDEBUG) | 40 #if !defined(NDEBUG) |
| 38 void show(); | 41 void show(); |
| 39 #endif | 42 #endif |
| 40 | 43 |
| 41 private: | 44 private: |
| 42 CustomElementMicrotaskDispatcher(); | 45 CustomElementMicrotaskDispatcher(); |
| 43 | 46 |
| 47 void ensureMicrotaskScheduledForElementQueue(); |
| 48 void ensureMicrotaskScheduledForMicrotaskSteps(); |
| 44 void ensureMicrotaskScheduled(); | 49 void ensureMicrotaskScheduled(); |
| 45 | 50 |
| 46 static void dispatch(); | 51 static void dispatch(); |
| 47 void doDispatch(); | 52 void doDispatch(); |
| 48 | 53 |
| 49 bool m_hasScheduledMicrotask; | 54 bool m_hasScheduledMicrotask; |
| 50 enum { | 55 enum { |
| 51 Quiescent, | 56 Quiescent, |
| 52 Resolving, | 57 Resolving, |
| 53 DispatchingCallbacks | 58 DispatchingCallbacks |
| 54 } m_phase; | 59 } m_phase; |
| 55 | 60 |
| 56 RefPtrWillBeMember<CustomElementMicrotaskQueue> m_resolutionAndImports; | 61 RefPtrWillBeMember<CustomElementMicrotaskQueue> m_resolutionAndImports; |
| 62 RefPtrWillBeMember<CustomElementAsyncImportMicrotaskQueue> m_asyncImports; |
| 57 WillBeHeapVector<RawPtrWillBeMember<CustomElementCallbackQueue> > m_elements
; | 63 WillBeHeapVector<RawPtrWillBeMember<CustomElementCallbackQueue> > m_elements
; |
| 58 }; | 64 }; |
| 59 | 65 |
| 60 } | 66 } |
| 61 | 67 |
| 62 #if !defined(NDEBUG) | 68 #if !defined(NDEBUG) |
| 63 void showCEMD(); | 69 void showCEMD(); |
| 64 #endif | 70 #endif |
| 65 | 71 |
| 66 #endif // CustomElementMicrotaskDispatcher_h | 72 #endif // CustomElementMicrotaskDispatcher_h |
| OLD | NEW |