| Index: Source/core/dom/custom/CustomElementMicrotaskQueue.cpp
|
| diff --git a/Source/core/dom/custom/CustomElementMicrotaskQueue.cpp b/Source/core/dom/custom/CustomElementMicrotaskQueue.cpp
|
| index df29d66591525af4cd3722a2125ab77112376179..8417305ccff53d9a7d328bba011673cb65c9eb7e 100644
|
| --- a/Source/core/dom/custom/CustomElementMicrotaskQueue.cpp
|
| +++ b/Source/core/dom/custom/CustomElementMicrotaskQueue.cpp
|
| @@ -38,9 +38,9 @@ namespace WebCore {
|
| class MicrotaskQueueInvocationScope {
|
| public:
|
| #if defined(NDEBUG)
|
| - explicit MicrotaskQueueInvocationScope(CustomElementMicrotaskQueue*) { }
|
| + explicit MicrotaskQueueInvocationScope(CustomElementMicrotaskQueueBase*) { }
|
| #else
|
| - explicit MicrotaskQueueInvocationScope(CustomElementMicrotaskQueue* queue)
|
| + explicit MicrotaskQueueInvocationScope(CustomElementMicrotaskQueueBase* queue)
|
| : m_parent(s_top)
|
| , m_queue(queue)
|
| {
|
| @@ -65,7 +65,7 @@ private:
|
| }
|
|
|
| MicrotaskQueueInvocationScope* m_parent;
|
| - CustomElementMicrotaskQueue* m_queue;
|
| + CustomElementMicrotaskQueueBase* m_queue;
|
|
|
| static MicrotaskQueueInvocationScope* s_top;
|
| #endif
|
| @@ -75,51 +75,19 @@ private:
|
| MicrotaskQueueInvocationScope* MicrotaskQueueInvocationScope::s_top = 0;
|
| #endif
|
|
|
| -void CustomElementMicrotaskQueue::enqueue(PassOwnPtrWillBeRawPtr<CustomElementMicrotaskStep> step)
|
| -{
|
| - m_queue.append(step);
|
| -}
|
| -
|
| -CustomElementMicrotaskStep::Result CustomElementMicrotaskQueue::dispatch()
|
| +void CustomElementMicrotaskQueueBase::dispatch()
|
| {
|
| MicrotaskQueueInvocationScope scope(this);
|
| - WillBeHeapVector<OwnPtrWillBeMember<CustomElementMicrotaskStep> > remaining;
|
| - Result accumulatedResult = CustomElementMicrotaskStep::ContinueWithRemoving;
|
| -
|
| - unsigned i;
|
| - for (i = 0; i < m_queue.size(); ++i) {
|
| - Result result = m_queue[i]->process();
|
| - accumulatedResult = CustomElementMicrotaskStep::Result(result | accumulatedResult);
|
| - if (result & CustomElementMicrotaskStep::ShouldRemain)
|
| - remaining.append(m_queue[i].release());
|
| - if (result & CustomElementMicrotaskStep::ShouldStop)
|
| - break;
|
| - }
|
| -
|
| - for (++i; i < m_queue.size(); ++i)
|
| - remaining.append(m_queue[i].release());
|
| - m_queue.swap(remaining);
|
| -
|
| - return accumulatedResult;
|
| + doDispatch();
|
| }
|
|
|
| -bool CustomElementMicrotaskQueue::needsProcessOrStop() const
|
| -{
|
| - for (size_t i = 0; i < m_queue.size(); ++i) {
|
| - if (m_queue[i]->needsProcessOrStop())
|
| - return true;
|
| - }
|
| -
|
| - return false;
|
| -}
|
| -
|
| -void CustomElementMicrotaskQueue::trace(Visitor* visitor)
|
| +void CustomElementMicrotaskQueueBase::trace(Visitor* visitor)
|
| {
|
| visitor->trace(m_queue);
|
| }
|
|
|
| #if !defined(NDEBUG)
|
| -void CustomElementMicrotaskQueue::show(unsigned indent)
|
| +void CustomElementMicrotaskQueueBase::show(unsigned indent)
|
| {
|
| for (unsigned q = 0; q < m_queue.size(); ++q) {
|
| if (m_queue[q])
|
| @@ -130,4 +98,21 @@ void CustomElementMicrotaskQueue::show(unsigned indent)
|
| }
|
| #endif
|
|
|
| +void CustomElementMicrotaskQueue::enqueue(PassOwnPtr<CustomElementMicrotaskStep> step)
|
| +{
|
| + m_queue.append(step);
|
| +}
|
| +
|
| +void CustomElementMicrotaskQueue::doDispatch()
|
| +{
|
| + unsigned i;
|
| +
|
| + for (i = 0; i < m_queue.size(); ++i) {
|
| + if (CustomElementMicrotaskStep::Processing == m_queue[i]->process())
|
| + break;
|
| + }
|
| +
|
| + m_queue.remove(0, i);
|
| +}
|
| +
|
| } // namespace WebCore
|
|
|