| 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/V0CustomElementMicrotaskRunQueue.h" | 5 #include "core/dom/custom/V0CustomElementMicrotaskRunQueue.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/Microtask.h" | 7 #include "bindings/core/v8/Microtask.h" |
| 8 #include "core/dom/custom/V0CustomElementAsyncImportMicrotaskQueue.h" | 8 #include "core/dom/custom/V0CustomElementAsyncImportMicrotaskQueue.h" |
| 9 #include "core/dom/custom/V0CustomElementSyncMicrotaskQueue.h" | 9 #include "core/dom/custom/V0CustomElementSyncMicrotaskQueue.h" |
| 10 #include "core/html/imports/HTMLImportLoader.h" | 10 #include "core/html/imports/HTMLImportLoader.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 m_asyncQueue->enqueue(step); | 29 m_asyncQueue->enqueue(step); |
| 30 } | 30 } |
| 31 | 31 |
| 32 requestDispatchIfNeeded(); | 32 requestDispatchIfNeeded(); |
| 33 } | 33 } |
| 34 | 34 |
| 35 void V0CustomElementMicrotaskRunQueue::requestDispatchIfNeeded() | 35 void V0CustomElementMicrotaskRunQueue::requestDispatchIfNeeded() |
| 36 { | 36 { |
| 37 if (m_dispatchIsPending || isEmpty()) | 37 if (m_dispatchIsPending || isEmpty()) |
| 38 return; | 38 return; |
| 39 Microtask::enqueueMicrotask(WTF::bind(&V0CustomElementMicrotaskRunQueue::dis
patch, WeakPersistentThisPointer<V0CustomElementMicrotaskRunQueue>(this))); | 39 Microtask::enqueueMicrotask(WTF::bind(&V0CustomElementMicrotaskRunQueue::dis
patch, wrapWeakPersistent(this))); |
| 40 m_dispatchIsPending = true; | 40 m_dispatchIsPending = true; |
| 41 } | 41 } |
| 42 | 42 |
| 43 DEFINE_TRACE(V0CustomElementMicrotaskRunQueue) | 43 DEFINE_TRACE(V0CustomElementMicrotaskRunQueue) |
| 44 { | 44 { |
| 45 visitor->trace(m_syncQueue); | 45 visitor->trace(m_syncQueue); |
| 46 visitor->trace(m_asyncQueue); | 46 visitor->trace(m_asyncQueue); |
| 47 } | 47 } |
| 48 | 48 |
| 49 void V0CustomElementMicrotaskRunQueue::dispatch() | 49 void V0CustomElementMicrotaskRunQueue::dispatch() |
| 50 { | 50 { |
| 51 m_dispatchIsPending = false; | 51 m_dispatchIsPending = false; |
| 52 m_syncQueue->dispatch(); | 52 m_syncQueue->dispatch(); |
| 53 if (m_syncQueue->isEmpty()) | 53 if (m_syncQueue->isEmpty()) |
| 54 m_asyncQueue->dispatch(); | 54 m_asyncQueue->dispatch(); |
| 55 } | 55 } |
| 56 | 56 |
| 57 bool V0CustomElementMicrotaskRunQueue::isEmpty() const | 57 bool V0CustomElementMicrotaskRunQueue::isEmpty() const |
| 58 { | 58 { |
| 59 return m_syncQueue->isEmpty() && m_asyncQueue->isEmpty(); | 59 return m_syncQueue->isEmpty() && m_asyncQueue->isEmpty(); |
| 60 } | 60 } |
| 61 | 61 |
| 62 } // namespace blink | 62 } // namespace blink |
| OLD | NEW |