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 CustomElementMicrotaskRunQueue_h | 5 #ifndef CustomElementMicrotaskRunQueue_h |
6 #define CustomElementMicrotaskRunQueue_h | 6 #define CustomElementMicrotaskRunQueue_h |
7 | 7 |
8 #include "platform/heap/Handle.h" | 8 #include "platform/heap/Handle.h" |
9 #include "wtf/RefCounted.h" | 9 #include "wtf/RefCounted.h" |
10 #include "wtf/WeakPtr.h" | 10 #include "wtf/WeakPtr.h" |
11 | 11 |
12 namespace blink { | 12 namespace blink { |
13 | 13 |
14 class CustomElementSyncMicrotaskQueue; | 14 class CustomElementSyncMicrotaskQueue; |
15 class CustomElementAsyncImportMicrotaskQueue; | 15 class CustomElementAsyncImportMicrotaskQueue; |
16 class CustomElementMicrotaskStep; | 16 class CustomElementMicrotaskStep; |
17 class HTMLImportLoader; | 17 class HTMLImportLoader; |
18 | 18 |
19 class CustomElementMicrotaskRunQueue : public RefCountedWillBeGarbageCollectedFi
nalized<CustomElementMicrotaskRunQueue> { | 19 class CustomElementMicrotaskRunQueue : public RefCountedWillBeGarbageCollectedFi
nalized<CustomElementMicrotaskRunQueue> { |
20 DECLARE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(CustomElementMicrotaskRunQueue) | 20 DECLARE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(CustomElementMicrotaskRunQueue) |
21 public: | 21 public: |
22 static PassRefPtrWillBeRawPtr<CustomElementMicrotaskRunQueue> create() { ret
urn adoptRefWillBeNoop(new CustomElementMicrotaskRunQueue()); } | 22 static PassRefPtrWillBeRawPtr<CustomElementMicrotaskRunQueue> create() { ret
urn adoptRefWillBeNoop(new CustomElementMicrotaskRunQueue()); } |
23 | 23 |
24 void enqueue(HTMLImportLoader* parentLoader, PassOwnPtrWillBeRawPtr<CustomEl
ementMicrotaskStep>, bool importIsSync); | 24 void enqueue(HTMLImportLoader* parentLoader, PassOwnPtrWillBeRawPtr<CustomEl
ementMicrotaskStep>, bool importIsSync); |
25 void requestDispatchIfNeeded(); | 25 void requestDispatchIfNeeded(); |
26 bool isEmpty() const; | 26 bool isEmpty() const; |
27 | 27 |
| 28 // Must be promptly finalized to prevent unsafe dispatching. |
| 29 EAGERLY_FINALIZE(); |
28 DECLARE_TRACE(); | 30 DECLARE_TRACE(); |
29 | 31 |
30 private: | 32 private: |
31 static void dispatchIfAlive(WeakPtr<CustomElementMicrotaskRunQueue> self); | 33 static void dispatchIfAlive(WeakPtr<CustomElementMicrotaskRunQueue> self); |
32 | 34 |
33 CustomElementMicrotaskRunQueue(); | 35 CustomElementMicrotaskRunQueue(); |
34 | 36 |
35 void dispatch(); | 37 void dispatch(); |
36 | 38 |
37 WeakPtrFactory<CustomElementMicrotaskRunQueue> m_weakFactory; | 39 WeakPtrFactory<CustomElementMicrotaskRunQueue> m_weakFactory; |
38 RefPtrWillBeMember<CustomElementSyncMicrotaskQueue> m_syncQueue; | 40 RefPtrWillBeMember<CustomElementSyncMicrotaskQueue> m_syncQueue; |
39 RefPtrWillBeMember<CustomElementAsyncImportMicrotaskQueue> m_asyncQueue; | 41 RefPtrWillBeMember<CustomElementAsyncImportMicrotaskQueue> m_asyncQueue; |
40 bool m_dispatchIsPending; | 42 bool m_dispatchIsPending; |
41 }; | 43 }; |
42 | 44 |
43 } // namespace blink | 45 } // namespace blink |
44 | 46 |
45 #endif // CustomElementMicrotaskRunQueue_h | 47 #endif // CustomElementMicrotaskRunQueue_h |
OLD | NEW |