This source file includes following definitions.
- instance
- processElementQueueAndPop
- processElementQueueAndPop
- enqueue
#include "config.h"
#include "core/dom/custom/CustomElementCallbackDispatcher.h"
#include "core/dom/custom/CustomElementCallbackQueue.h"
#include "core/dom/custom/CustomElementScheduler.h"
#include "wtf/MainThread.h"
namespace WebCore {
size_t CustomElementCallbackDispatcher::s_elementQueueStart = 0;
size_t CustomElementCallbackDispatcher::s_elementQueueEnd = kNumSentinels;
CustomElementCallbackDispatcher& CustomElementCallbackDispatcher::instance()
{
DEFINE_STATIC_LOCAL(CustomElementCallbackDispatcher, instance, ());
return instance;
}
void CustomElementCallbackDispatcher::processElementQueueAndPop()
{
instance().processElementQueueAndPop(s_elementQueueStart, s_elementQueueEnd);
}
void CustomElementCallbackDispatcher::processElementQueueAndPop(size_t start, size_t end)
{
ASSERT(isMainThread());
CustomElementCallbackQueue::ElementQueueId thisQueue = currentElementQueue();
for (size_t i = start; i < end; i++) {
{
CallbackDeliveryScope deliveryScope;
m_flattenedProcessingStack[i]->processInElementQueue(thisQueue);
}
ASSERT(start == s_elementQueueStart);
ASSERT(end == s_elementQueueEnd);
}
m_flattenedProcessingStack.resize(start);
s_elementQueueEnd = start;
if (s_elementQueueStart == kNumSentinels)
CustomElementScheduler::callbackDispatcherDidFinish();
}
void CustomElementCallbackDispatcher::enqueue(CustomElementCallbackQueue* callbackQueue)
{
ASSERT(inCallbackDeliveryScope());
if (callbackQueue->owner() == currentElementQueue())
return;
callbackQueue->setOwner(currentElementQueue());
m_flattenedProcessingStack.append(callbackQueue);
++s_elementQueueEnd;
}
}