| 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/CustomElementMicrotaskDispatcher.h" | 5 #include "core/dom/custom/CustomElementMicrotaskDispatcher.h" |
| 6 | 6 |
| 7 #include "core/dom/Microtask.h" | 7 #include "core/dom/Microtask.h" |
| 8 #include "core/dom/custom/CustomElementCallbackQueue.h" | 8 #include "core/dom/custom/CustomElementCallbackQueue.h" |
| 9 #include "core/dom/custom/CustomElementMicrotaskImportStep.h" | 9 #include "core/dom/custom/CustomElementMicrotaskImportStep.h" |
| 10 #include "core/dom/custom/CustomElementProcessingStack.h" | 10 #include "core/dom/custom/CustomElementProcessingStack.h" |
| 11 #include "core/dom/custom/CustomElementScheduler.h" | 11 #include "core/dom/custom/CustomElementScheduler.h" |
| 12 #include "wtf/MainThread.h" | 12 #include "wtf/MainThread.h" |
| 13 | 13 |
| 14 namespace blink { | 14 namespace blink { |
| 15 | 15 |
| 16 static const CustomElementCallbackQueue::ElementQueueId kMicrotaskQueueId = 0; | 16 static const CustomElementCallbackQueue::ElementQueueId kMicrotaskQueueId = 0; |
| 17 | 17 |
| 18 CustomElementMicrotaskDispatcher::CustomElementMicrotaskDispatcher() | 18 CustomElementMicrotaskDispatcher::CustomElementMicrotaskDispatcher() |
| 19 : m_hasScheduledMicrotask(false) | 19 : m_hasScheduledMicrotask(false) |
| 20 , m_phase(Quiescent) | 20 , m_phase(Quiescent) |
| 21 { | 21 { |
| 22 } | 22 } |
| 23 | 23 |
| 24 DEFINE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(CustomElementMicrotaskDispatcher) | |
| 25 | |
| 26 CustomElementMicrotaskDispatcher& CustomElementMicrotaskDispatcher::instance() | 24 CustomElementMicrotaskDispatcher& CustomElementMicrotaskDispatcher::instance() |
| 27 { | 25 { |
| 28 DEFINE_STATIC_LOCAL(OwnPtrWillBePersistent<CustomElementMicrotaskDispatcher>
, instance, (adoptPtrWillBeNoop(new CustomElementMicrotaskDispatcher()))); | 26 DEFINE_STATIC_LOCAL(Persistent<CustomElementMicrotaskDispatcher>, instance,
((new CustomElementMicrotaskDispatcher()))); |
| 29 return *instance; | 27 return *instance; |
| 30 } | 28 } |
| 31 | 29 |
| 32 void CustomElementMicrotaskDispatcher::enqueue(CustomElementCallbackQueue* queue
) | 30 void CustomElementMicrotaskDispatcher::enqueue(CustomElementCallbackQueue* queue
) |
| 33 { | 31 { |
| 34 ensureMicrotaskScheduledForElementQueue(); | 32 ensureMicrotaskScheduledForElementQueue(); |
| 35 queue->setOwner(kMicrotaskQueueId); | 33 queue->setOwner(kMicrotaskQueueId); |
| 36 m_elements.append(queue); | 34 m_elements.append(queue); |
| 37 } | 35 } |
| 38 | 36 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 } | 80 } |
| 83 | 81 |
| 84 DEFINE_TRACE(CustomElementMicrotaskDispatcher) | 82 DEFINE_TRACE(CustomElementMicrotaskDispatcher) |
| 85 { | 83 { |
| 86 #if ENABLE(OILPAN) | 84 #if ENABLE(OILPAN) |
| 87 visitor->trace(m_elements); | 85 visitor->trace(m_elements); |
| 88 #endif | 86 #endif |
| 89 } | 87 } |
| 90 | 88 |
| 91 } // namespace blink | 89 } // namespace blink |
| OLD | NEW |