| 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" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 class CustomElementMicrotaskDispatcher final { | 21 class CustomElementMicrotaskDispatcher final { |
| 22 WTF_MAKE_NONCOPYABLE(CustomElementMicrotaskDispatcher); | 22 WTF_MAKE_NONCOPYABLE(CustomElementMicrotaskDispatcher); |
| 23 DECLARE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(CustomElementMicrotaskDispatcher); | 23 DECLARE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(CustomElementMicrotaskDispatcher); |
| 24 public: | 24 public: |
| 25 static CustomElementMicrotaskDispatcher& instance(); | 25 static CustomElementMicrotaskDispatcher& instance(); |
| 26 | 26 |
| 27 void enqueue(CustomElementCallbackQueue*); | 27 void enqueue(CustomElementCallbackQueue*); |
| 28 | 28 |
| 29 bool elementQueueIsEmpty() { return m_elements.isEmpty(); } | 29 bool elementQueueIsEmpty() { return m_elements.isEmpty(); } |
| 30 | 30 |
| 31 void trace(Visitor*); | |
| 32 | |
| 33 private: | 31 private: |
| 34 CustomElementMicrotaskDispatcher(); | 32 CustomElementMicrotaskDispatcher(); |
| 35 | 33 |
| 36 void ensureMicrotaskScheduledForElementQueue(); | 34 void ensureMicrotaskScheduledForElementQueue(); |
| 37 void ensureMicrotaskScheduled(); | 35 void ensureMicrotaskScheduled(); |
| 38 | 36 |
| 39 static void dispatch(); | 37 static void dispatch(); |
| 40 void doDispatch(); | 38 void doDispatch(); |
| 41 | 39 |
| 42 bool m_hasScheduledMicrotask; | 40 bool m_hasScheduledMicrotask; |
| 43 enum { | 41 enum { |
| 44 Quiescent, | 42 Quiescent, |
| 45 Resolving, | 43 Resolving, |
| 46 DispatchingCallbacks | 44 DispatchingCallbacks |
| 47 } m_phase; | 45 } m_phase; |
| 48 | 46 |
| 49 Vector<RawPtr<CustomElementCallbackQueue> > m_elements; | 47 Vector<RawPtr<CustomElementCallbackQueue> > m_elements; |
| 50 }; | 48 }; |
| 51 | 49 |
| 52 } | 50 } |
| 53 | 51 |
| 54 #endif // CustomElementMicrotaskDispatcher_h | 52 #endif // CustomElementMicrotaskDispatcher_h |
| OLD | NEW |