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.
5 #ifndef CustomElementMicrotaskRunQueue_h
6 #define CustomElementMicrotaskRunQueue_h
8 #include "platform/heap/Handle.h"
9 #include "wtf/RefCounted.h"
10 #include "wtf/WeakPtr.h"
14 class CustomElementSyncMicrotaskQueue
;
15 class CustomElementAsyncImportMicrotaskQueue
;
16 class CustomElementMicrotaskStep
;
17 class HTMLImportLoader
;
19 class CustomElementMicrotaskRunQueue
: public RefCountedWillBeGarbageCollectedFinalized
<CustomElementMicrotaskRunQueue
> {
20 DECLARE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(CustomElementMicrotaskRunQueue
)
22 static PassRefPtrWillBeRawPtr
<CustomElementMicrotaskRunQueue
> create() { return adoptRefWillBeNoop(new CustomElementMicrotaskRunQueue()); }
24 void enqueue(HTMLImportLoader
* parentLoader
, PassOwnPtrWillBeRawPtr
<CustomElementMicrotaskStep
>, bool importIsSync
);
25 void requestDispatchIfNeeded();
28 // Must be promptly finalized to prevent unsafe dispatching.
33 static void dispatchIfAlive(WeakPtr
<CustomElementMicrotaskRunQueue
> self
);
35 CustomElementMicrotaskRunQueue();
39 WeakPtrFactory
<CustomElementMicrotaskRunQueue
> m_weakFactory
;
40 RefPtrWillBeMember
<CustomElementSyncMicrotaskQueue
> m_syncQueue
;
41 RefPtrWillBeMember
<CustomElementAsyncImportMicrotaskQueue
> m_asyncQueue
;
42 bool m_dispatchIsPending
;
47 #endif // CustomElementMicrotaskRunQueue_h