| 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/CustomElementMicrotaskRunQueue.h" | 6 #include "core/dom/custom/CustomElementMicrotaskRunQueue.h" |
| 7 | 7 |
| 8 #include "core/dom/Microtask.h" | 8 #include "core/dom/Microtask.h" |
| 9 #include "core/dom/custom/CustomElementAsyncImportMicrotaskQueue.h" | 9 #include "core/dom/custom/CustomElementAsyncImportMicrotaskQueue.h" |
| 10 #include "core/dom/custom/CustomElementSyncMicrotaskQueue.h" | 10 #include "core/dom/custom/CustomElementSyncMicrotaskQueue.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 } | 45 } |
| 46 | 46 |
| 47 void CustomElementMicrotaskRunQueue::requestDispatchIfNeeded() | 47 void CustomElementMicrotaskRunQueue::requestDispatchIfNeeded() |
| 48 { | 48 { |
| 49 if (m_dispatchIsPending || isEmpty()) | 49 if (m_dispatchIsPending || isEmpty()) |
| 50 return; | 50 return; |
| 51 Microtask::enqueueMicrotask(WTF::bind(&CustomElementMicrotaskRunQueue::dispa
tchIfAlive, m_weakFactory.createWeakPtr())); | 51 Microtask::enqueueMicrotask(WTF::bind(&CustomElementMicrotaskRunQueue::dispa
tchIfAlive, m_weakFactory.createWeakPtr())); |
| 52 m_dispatchIsPending = true; | 52 m_dispatchIsPending = true; |
| 53 } | 53 } |
| 54 | 54 |
| 55 void CustomElementMicrotaskRunQueue::trace(Visitor* visitor) | 55 DEFINE_TRACE(CustomElementMicrotaskRunQueue) |
| 56 { | 56 { |
| 57 visitor->trace(m_syncQueue); | 57 visitor->trace(m_syncQueue); |
| 58 visitor->trace(m_asyncQueue); | 58 visitor->trace(m_asyncQueue); |
| 59 } | 59 } |
| 60 | 60 |
| 61 void CustomElementMicrotaskRunQueue::dispatch() | 61 void CustomElementMicrotaskRunQueue::dispatch() |
| 62 { | 62 { |
| 63 m_dispatchIsPending = false; | 63 m_dispatchIsPending = false; |
| 64 m_syncQueue->dispatch(); | 64 m_syncQueue->dispatch(); |
| 65 if (m_syncQueue->isEmpty()) | 65 if (m_syncQueue->isEmpty()) |
| 66 m_asyncQueue->dispatch(); | 66 m_asyncQueue->dispatch(); |
| 67 } | 67 } |
| 68 | 68 |
| 69 bool CustomElementMicrotaskRunQueue::isEmpty() const | 69 bool CustomElementMicrotaskRunQueue::isEmpty() const |
| 70 { | 70 { |
| 71 return m_syncQueue->isEmpty() && m_asyncQueue->isEmpty(); | 71 return m_syncQueue->isEmpty() && m_asyncQueue->isEmpty(); |
| 72 } | 72 } |
| 73 | 73 |
| 74 } // namespace blink | 74 } // namespace blink |
| OLD | NEW |