#include "core/dom/custom/CustomElementCallbackDispatcher.h"
#include "core/dom/custom/CustomElementCallbackQueue.h"
-#include "core/dom/custom/CustomElementCallbackScheduler.h"
+#include "core/dom/custom/CustomElementScheduler.h"
#include "wtf/MainThread.h"
-namespace WebCore {
+namespace blink {
size_t CustomElementCallbackDispatcher::s_elementQueueStart = 0;
return instance;
}
-bool CustomElementCallbackDispatcher::dispatch()
-{
- ASSERT(isMainThread());
- if (inCallbackDeliveryScope())
- return false;
-
- bool didWork = m_baseElementQueue.dispatch(baseElementQueue());
- CustomElementCallbackScheduler::clearElementCallbackQueueMap();
- return didWork;
-}
-
// Dispatches callbacks when popping the processing stack.
void CustomElementCallbackDispatcher::processElementQueueAndPop()
{
void CustomElementCallbackDispatcher::processElementQueueAndPop(size_t start, size_t end)
{
ASSERT(isMainThread());
- ElementQueue thisQueue = currentElementQueue();
+ CustomElementCallbackQueue::ElementQueueId thisQueue = currentElementQueue();
for (size_t i = start; i < end; i++) {
{
m_flattenedProcessingStack.resize(start);
s_elementQueueEnd = start;
- if (start == kNumSentinels && m_baseElementQueue.isEmpty())
- CustomElementCallbackScheduler::clearElementCallbackQueueMap();
+ if (s_elementQueueStart == kNumSentinels)
+ CustomElementScheduler::callbackDispatcherDidFinish();
}
void CustomElementCallbackDispatcher::enqueue(CustomElementCallbackQueue* callbackQueue)
{
+ ASSERT(inCallbackDeliveryScope());
+
if (callbackQueue->owner() == currentElementQueue())
return;
callbackQueue->setOwner(currentElementQueue());
- if (inCallbackDeliveryScope()) {
- m_flattenedProcessingStack.append(callbackQueue);
- ++s_elementQueueEnd;
- } else {
- m_baseElementQueue.enqueue(callbackQueue);
- }
+ m_flattenedProcessingStack.append(callbackQueue);
+ ++s_elementQueueEnd;
}
-} // namespace WebCore
+} // namespace blink