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 #include "config.h" | 5 #include "config.h" |
6 #include "core/dom/custom/CustomElementMicrotaskDispatcher.h" | 6 #include "core/dom/custom/CustomElementMicrotaskDispatcher.h" |
7 | 7 |
8 #include "core/dom/Microtask.h" | 8 #include "core/dom/Microtask.h" |
9 #include "core/dom/custom/CustomElementCallbackDispatcher.h" | 9 #include "core/dom/custom/CustomElementCallbackDispatcher.h" |
10 #include "core/dom/custom/CustomElementCallbackQueue.h" | 10 #include "core/dom/custom/CustomElementCallbackQueue.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 CustomElementMicrotaskDispatcher& CustomElementMicrotaskDispatcher::instance() | 28 CustomElementMicrotaskDispatcher& CustomElementMicrotaskDispatcher::instance() |
29 { | 29 { |
30 DEFINE_STATIC_LOCAL(CustomElementMicrotaskDispatcher, instance, ()); | 30 DEFINE_STATIC_LOCAL(CustomElementMicrotaskDispatcher, instance, ()); |
31 return instance; | 31 return instance; |
32 } | 32 } |
33 | 33 |
34 void CustomElementMicrotaskDispatcher::enqueue(HTMLImportLoader* importLoader, P
assOwnPtr<CustomElementMicrotaskStep> step) | 34 void CustomElementMicrotaskDispatcher::enqueue(HTMLImportLoader* importLoader, P
assOwnPtr<CustomElementMicrotaskStep> step) |
35 { | 35 { |
36 ASSERT(m_phase == Quiescent || m_phase == DispatchingCallbacks); | 36 ASSERT(m_phase == Quiescent || m_phase == DispatchingCallbacks); |
37 ensureMicrotaskScheduled(); | 37 ensureMicrotaskScheduled(); |
38 if (importLoader) | 38 if (importLoader && importLoader->microtaskQueue()) |
39 importLoader->microtaskQueue()->enqueue(step); | 39 importLoader->microtaskQueue()->enqueue(step); |
40 else | 40 else |
41 m_resolutionAndImports->enqueue(step); | 41 m_resolutionAndImports->enqueue(step); |
42 } | 42 } |
43 | 43 |
44 void CustomElementMicrotaskDispatcher::enqueue(CustomElementCallbackQueue* queue
) | 44 void CustomElementMicrotaskDispatcher::enqueue(CustomElementCallbackQueue* queue
) |
45 { | 45 { |
46 ASSERT(m_phase == Quiescent || m_phase == Resolving); | 46 ASSERT(m_phase == Quiescent || m_phase == Resolving); |
47 ensureMicrotaskScheduled(); | 47 ensureMicrotaskScheduled(); |
48 queue->setOwner(kMicrotaskQueueId); | 48 queue->setOwner(kMicrotaskQueueId); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 CustomElementCallbackDispatcher::CallbackDeliveryScope scope; | 89 CustomElementCallbackDispatcher::CallbackDeliveryScope scope; |
90 (*it)->processInElementQueue(kMicrotaskQueueId); | 90 (*it)->processInElementQueue(kMicrotaskQueueId); |
91 } | 91 } |
92 | 92 |
93 m_elements.clear(); | 93 m_elements.clear(); |
94 CustomElementScheduler::microtaskDispatcherDidFinish(); | 94 CustomElementScheduler::microtaskDispatcherDidFinish(); |
95 m_phase = Quiescent; | 95 m_phase = Quiescent; |
96 } | 96 } |
97 | 97 |
98 } // namespace WebCore | 98 } // namespace WebCore |
OLD | NEW |