OLD | NEW |
(Empty) | |
| 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. |
| 4 |
| 5 #include "config.h" |
| 6 #include "core/dom/custom/CustomElementMicrotaskStepDispatcher.h" |
| 7 |
| 8 #include "core/dom/custom/CustomElementMicrotaskImportStep.h" |
| 9 #include "core/html/imports/HTMLImportLoader.h" |
| 10 |
| 11 namespace WebCore { |
| 12 |
| 13 CustomElementMicrotaskStepDispatcher::CustomElementMicrotaskStepDispatcher() |
| 14 : m_syncQueue(CustomElementSyncMicrotaskQueue::create()) |
| 15 , m_asyncQueue(CustomElementAsyncImportMicrotaskQueue::create()) |
| 16 { |
| 17 } |
| 18 |
| 19 void CustomElementMicrotaskStepDispatcher::enqueue(HTMLImportLoader* parentLoade
r, PassOwnPtrWillBeRawPtr<CustomElementMicrotaskStep> step) |
| 20 { |
| 21 if (parentLoader) |
| 22 parentLoader->microtaskQueue()->enqueue(step); |
| 23 else |
| 24 m_syncQueue->enqueue(step); |
| 25 } |
| 26 |
| 27 void CustomElementMicrotaskStepDispatcher::enqueue(HTMLImportLoader* parentLoade
r, PassOwnPtrWillBeRawPtr<CustomElementMicrotaskImportStep> step, bool importIsS
ync) |
| 28 { |
| 29 if (importIsSync) |
| 30 enqueue(parentLoader, PassOwnPtrWillBeRawPtr<CustomElementMicrotaskStep>
(step)); |
| 31 else |
| 32 m_asyncQueue->enqueue(step); |
| 33 } |
| 34 |
| 35 void CustomElementMicrotaskStepDispatcher::dispatch() |
| 36 { |
| 37 m_syncQueue->dispatch(); |
| 38 if (m_syncQueue->isEmpty()) |
| 39 m_asyncQueue->dispatch(); |
| 40 } |
| 41 |
| 42 void CustomElementMicrotaskStepDispatcher::trace(Visitor* visitor) |
| 43 { |
| 44 visitor->trace(m_syncQueue); |
| 45 visitor->trace(m_asyncQueue); |
| 46 } |
| 47 |
| 48 #if !defined(NDEBUG) |
| 49 void CustomElementMicrotaskStepDispatcher::show(unsigned indent) |
| 50 { |
| 51 fprintf(stderr, "%*sSync:\n", indent, ""); |
| 52 m_syncQueue->show(indent + 1); |
| 53 fprintf(stderr, "%*sAsync:\n", indent, ""); |
| 54 m_asyncQueue->show(indent + 1); |
| 55 } |
| 56 #endif |
| 57 |
| 58 } // namespace WebCore |
OLD | NEW |