| 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" |
| 11 #include "core/dom/custom/V0CustomElementScheduler.h" | 11 #include "core/dom/custom/V0CustomElementScheduler.h" |
| 12 | 12 |
| 13 namespace blink { | 13 namespace blink { |
| 14 | 14 |
| 15 static const V0CustomElementCallbackQueue::ElementQueueId kMicrotaskQueueId = 0; | 15 static const V0CustomElementCallbackQueue::ElementQueueId kMicrotaskQueueId = 0; |
| 16 | 16 |
| 17 V0CustomElementMicrotaskDispatcher::V0CustomElementMicrotaskDispatcher() | 17 V0CustomElementMicrotaskDispatcher::V0CustomElementMicrotaskDispatcher() |
| 18 : m_hasScheduledMicrotask(false), m_phase(Quiescent) {} | 18 : m_hasScheduledMicrotask(false), m_phase(Quiescent) {} |
| 19 | 19 |
| 20 V0CustomElementMicrotaskDispatcher& | 20 V0CustomElementMicrotaskDispatcher& |
| 21 V0CustomElementMicrotaskDispatcher::instance() { | 21 V0CustomElementMicrotaskDispatcher::instance() { |
| 22 ALLOW_UNSAFE_SINGLETON() |
| 22 DEFINE_STATIC_LOCAL(V0CustomElementMicrotaskDispatcher, instance, | 23 DEFINE_STATIC_LOCAL(V0CustomElementMicrotaskDispatcher, instance, |
| 23 (new V0CustomElementMicrotaskDispatcher)); | 24 (new V0CustomElementMicrotaskDispatcher)); |
| 24 return instance; | 25 return instance; |
| 25 } | 26 } |
| 26 | 27 |
| 27 void V0CustomElementMicrotaskDispatcher::enqueue( | 28 void V0CustomElementMicrotaskDispatcher::enqueue( |
| 28 V0CustomElementCallbackQueue* queue) { | 29 V0CustomElementCallbackQueue* queue) { |
| 29 ensureMicrotaskScheduledForElementQueue(); | 30 ensureMicrotaskScheduledForElementQueue(); |
| 30 queue->setOwner(kMicrotaskQueueId); | 31 queue->setOwner(kMicrotaskQueueId); |
| 31 m_elements.push_back(queue); | 32 m_elements.push_back(queue); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 m_elements.clear(); | 73 m_elements.clear(); |
| 73 V0CustomElementScheduler::microtaskDispatcherDidFinish(); | 74 V0CustomElementScheduler::microtaskDispatcherDidFinish(); |
| 74 m_phase = Quiescent; | 75 m_phase = Quiescent; |
| 75 } | 76 } |
| 76 | 77 |
| 77 DEFINE_TRACE(V0CustomElementMicrotaskDispatcher) { | 78 DEFINE_TRACE(V0CustomElementMicrotaskDispatcher) { |
| 78 visitor->trace(m_elements); | 79 visitor->trace(m_elements); |
| 79 } | 80 } |
| 80 | 81 |
| 81 } // namespace blink | 82 } // namespace blink |
| OLD | NEW |