| 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/CustomElementMicrotaskRunQueue.h" | 5 #include "core/dom/custom/CustomElementMicrotaskRunQueue.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/Microtask.h" | 7 #include "bindings/core/v8/Microtask.h" |
| 8 #include "core/dom/custom/CustomElementAsyncImportMicrotaskQueue.h" | 8 #include "core/dom/custom/CustomElementAsyncImportMicrotaskQueue.h" |
| 9 #include "core/dom/custom/CustomElementSyncMicrotaskQueue.h" | 9 #include "core/dom/custom/CustomElementSyncMicrotaskQueue.h" |
| 10 #include "core/html/imports/HTMLImportLoader.h" | 10 #include "core/html/imports/HTMLImportLoader.h" |
| 11 | 11 |
| 12 namespace blink { | 12 namespace blink { |
| 13 | 13 |
| 14 DEFINE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(CustomElementMicrotaskRunQueue) | |
| 15 | |
| 16 CustomElementMicrotaskRunQueue::CustomElementMicrotaskRunQueue() | 14 CustomElementMicrotaskRunQueue::CustomElementMicrotaskRunQueue() |
| 17 : m_syncQueue(CustomElementSyncMicrotaskQueue::create()) | 15 : m_syncQueue(CustomElementSyncMicrotaskQueue::create()) |
| 18 , m_asyncQueue(CustomElementAsyncImportMicrotaskQueue::create()) | 16 , m_asyncQueue(CustomElementAsyncImportMicrotaskQueue::create()) |
| 19 , m_dispatchIsPending(false) | 17 , m_dispatchIsPending(false) |
| 20 #if !ENABLE(OILPAN) | 18 #if !ENABLE(OILPAN) |
| 21 , m_weakFactory(this) | 19 , m_weakFactory(this) |
| 22 #endif | 20 #endif |
| 23 { | 21 { |
| 24 } | 22 } |
| 25 | 23 |
| 26 void CustomElementMicrotaskRunQueue::enqueue(HTMLImportLoader* parentLoader, Pas
sOwnPtrWillBeRawPtr<CustomElementMicrotaskStep> step, bool importIsSync) | 24 void CustomElementMicrotaskRunQueue::enqueue(HTMLImportLoader* parentLoader, Raw
Ptr<CustomElementMicrotaskStep> step, bool importIsSync) |
| 27 { | 25 { |
| 28 if (importIsSync) { | 26 if (importIsSync) { |
| 29 if (parentLoader) | 27 if (parentLoader) |
| 30 parentLoader->microtaskQueue()->enqueue(step); | 28 parentLoader->microtaskQueue()->enqueue(step); |
| 31 else | 29 else |
| 32 m_syncQueue->enqueue(step); | 30 m_syncQueue->enqueue(step); |
| 33 } else { | 31 } else { |
| 34 m_asyncQueue->enqueue(step); | 32 m_asyncQueue->enqueue(step); |
| 35 } | 33 } |
| 36 | 34 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 50 } | 48 } |
| 51 | 49 |
| 52 DEFINE_TRACE(CustomElementMicrotaskRunQueue) | 50 DEFINE_TRACE(CustomElementMicrotaskRunQueue) |
| 53 { | 51 { |
| 54 visitor->trace(m_syncQueue); | 52 visitor->trace(m_syncQueue); |
| 55 visitor->trace(m_asyncQueue); | 53 visitor->trace(m_asyncQueue); |
| 56 } | 54 } |
| 57 | 55 |
| 58 void CustomElementMicrotaskRunQueue::dispatch() | 56 void CustomElementMicrotaskRunQueue::dispatch() |
| 59 { | 57 { |
| 60 RefPtrWillBeRawPtr<CustomElementMicrotaskRunQueue> protect(this); | 58 RawPtr<CustomElementMicrotaskRunQueue> protect(this); |
| 61 m_dispatchIsPending = false; | 59 m_dispatchIsPending = false; |
| 62 m_syncQueue->dispatch(); | 60 m_syncQueue->dispatch(); |
| 63 if (m_syncQueue->isEmpty()) | 61 if (m_syncQueue->isEmpty()) |
| 64 m_asyncQueue->dispatch(); | 62 m_asyncQueue->dispatch(); |
| 65 } | 63 } |
| 66 | 64 |
| 67 bool CustomElementMicrotaskRunQueue::isEmpty() const | 65 bool CustomElementMicrotaskRunQueue::isEmpty() const |
| 68 { | 66 { |
| 69 return m_syncQueue->isEmpty() && m_asyncQueue->isEmpty(); | 67 return m_syncQueue->isEmpty() && m_asyncQueue->isEmpty(); |
| 70 } | 68 } |
| 71 | 69 |
| 72 } // namespace blink | 70 } // namespace blink |
| OLD | NEW |