| 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 "wtf/Noncopyable.h" | 8 #include "wtf/Noncopyable.h" |
| 10 #include "wtf/PassOwnPtr.h" | 9 #include "wtf/PassOwnPtr.h" |
| 11 #include "wtf/Vector.h" | 10 #include "wtf/Vector.h" |
| 12 | 11 |
| 13 namespace WebCore { | 12 namespace WebCore { |
| 14 | 13 |
| 14 class CustomElementAsyncImportMicrotaskQueue; |
| 15 class CustomElementCallbackQueue; | 15 class CustomElementCallbackQueue; |
| 16 class CustomElementMicrotaskImportStep; | 16 class CustomElementMicrotaskImportStep; |
| 17 class CustomElementMicrotaskQueue; |
| 17 class CustomElementMicrotaskStep; | 18 class CustomElementMicrotaskStep; |
| 18 class HTMLImportLoader; | 19 class HTMLImportLoader; |
| 19 | 20 |
| 20 class CustomElementMicrotaskDispatcher { | 21 class 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*, PassOwnPtr<CustomElementMicrotaskStep>); |
| 29 void enqueue(HTMLImportLoader*, PassOwnPtr<CustomElementMicrotaskImportStep>
); |
| 28 void enqueue(CustomElementCallbackQueue*); | 30 void enqueue(CustomElementCallbackQueue*); |
| 29 | 31 |
| 32 |
| 30 void importDidFinish(CustomElementMicrotaskImportStep*); | 33 void importDidFinish(CustomElementMicrotaskImportStep*); |
| 31 | 34 |
| 32 bool elementQueueIsEmpty() { return m_elements.isEmpty(); } | 35 bool elementQueueIsEmpty() { return m_elements.isEmpty(); } |
| 33 | 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 |
| 44 void willOrDidEnqueueStep(); |
| 41 void ensureMicrotaskScheduled(); | 45 void ensureMicrotaskScheduled(); |
| 42 | 46 |
| 43 static void dispatch(); | 47 static void dispatch(); |
| 44 void doDispatch(); | 48 void doDispatch(); |
| 45 | 49 |
| 46 bool m_hasScheduledMicrotask; | 50 bool m_hasScheduledMicrotask; |
| 47 enum { | 51 enum { |
| 48 Quiescent, | 52 Quiescent, |
| 49 Resolving, | 53 Resolving, |
| 50 DispatchingCallbacks | 54 DispatchingCallbacks |
| 51 } m_phase; | 55 } m_phase; |
| 52 | 56 |
| 53 RefPtr<CustomElementMicrotaskQueue> m_resolutionAndImports; | 57 RefPtr<CustomElementMicrotaskQueue> m_resolutionAndImports; |
| 58 RefPtr<CustomElementAsyncImportMicrotaskQueue> m_asyncImports; |
| 54 Vector<CustomElementCallbackQueue*> m_elements; | 59 Vector<CustomElementCallbackQueue*> m_elements; |
| 55 }; | 60 }; |
| 56 | 61 |
| 57 } | 62 } |
| 58 | 63 |
| 59 #if !defined(NDEBUG) | 64 #if !defined(NDEBUG) |
| 60 void showCEMD(); | 65 void showCEMD(); |
| 61 #endif | 66 #endif |
| 62 | 67 |
| 63 #endif // CustomElementMicrotaskDispatcher_h | 68 #endif // CustomElementMicrotaskDispatcher_h |
| OLD | NEW |