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 "core/dom/custom/V0CustomElementMicrotaskDispatcher.h" | 5 #include "core/dom/custom/V0CustomElementMicrotaskDispatcher.h" |
6 | 6 |
7 #include "bindings/core/v8/Microtask.h" | 7 #include "bindings/core/v8/Microtask.h" |
8 #include "core/dom/custom/V0CustomElementCallbackQueue.h" | 8 #include "core/dom/custom/V0CustomElementCallbackQueue.h" |
9 #include "core/dom/custom/V0CustomElementMicrotaskImportStep.h" | 9 #include "core/dom/custom/V0CustomElementMicrotaskImportStep.h" |
10 #include "core/dom/custom/V0CustomElementProcessingStack.h" | 10 #include "core/dom/custom/V0CustomElementProcessingStack.h" |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 void V0CustomElementMicrotaskDispatcher::doDispatch() { | 51 void V0CustomElementMicrotaskDispatcher::doDispatch() { |
52 DCHECK(isMainThread()); | 52 DCHECK(isMainThread()); |
53 | 53 |
54 DCHECK(m_phase == Quiescent); | 54 DCHECK(m_phase == Quiescent); |
55 DCHECK(m_hasScheduledMicrotask); | 55 DCHECK(m_hasScheduledMicrotask); |
56 m_hasScheduledMicrotask = false; | 56 m_hasScheduledMicrotask = false; |
57 | 57 |
58 // Finishing microtask work deletes all | 58 // Finishing microtask work deletes all |
59 // V0CustomElementCallbackQueues. Being in a callback delivery scope | 59 // V0CustomElementCallbackQueues. Being in a callback delivery scope |
60 // implies those queues could still be in use. | 60 // implies those queues could still be in use. |
61 ASSERT_WITH_SECURITY_IMPLICATION( | 61 SECURITY_DCHECK(!V0CustomElementProcessingStack::inCallbackDeliveryScope()); |
62 !V0CustomElementProcessingStack::inCallbackDeliveryScope()); | |
63 | 62 |
64 m_phase = Resolving; | 63 m_phase = Resolving; |
65 | 64 |
66 m_phase = DispatchingCallbacks; | 65 m_phase = DispatchingCallbacks; |
67 for (const auto& element : m_elements) { | 66 for (const auto& element : m_elements) { |
68 // Created callback may enqueue an attached callback. | 67 // Created callback may enqueue an attached callback. |
69 V0CustomElementProcessingStack::CallbackDeliveryScope scope; | 68 V0CustomElementProcessingStack::CallbackDeliveryScope scope; |
70 element->processInElementQueue(kMicrotaskQueueId); | 69 element->processInElementQueue(kMicrotaskQueueId); |
71 } | 70 } |
72 | 71 |
73 m_elements.clear(); | 72 m_elements.clear(); |
74 V0CustomElementScheduler::microtaskDispatcherDidFinish(); | 73 V0CustomElementScheduler::microtaskDispatcherDidFinish(); |
75 m_phase = Quiescent; | 74 m_phase = Quiescent; |
76 } | 75 } |
77 | 76 |
78 DEFINE_TRACE(V0CustomElementMicrotaskDispatcher) { | 77 DEFINE_TRACE(V0CustomElementMicrotaskDispatcher) { |
79 visitor->trace(m_elements); | 78 visitor->trace(m_elements); |
80 } | 79 } |
81 | 80 |
82 } // namespace blink | 81 } // namespace blink |
OLD | NEW |