Chromium Code Reviews| Index: Source/core/dom/custom/CustomElementMicrotaskDispatcher.cpp |
| diff --git a/Source/core/dom/custom/CustomElementMicrotaskDispatcher.cpp b/Source/core/dom/custom/CustomElementMicrotaskDispatcher.cpp |
| index ca716e61001b11c4b98e170b4aa435a6073a4d09..adc385af362195473a37f5ebfd7f15e2ce46a3a3 100644 |
| --- a/Source/core/dom/custom/CustomElementMicrotaskDispatcher.cpp |
| +++ b/Source/core/dom/custom/CustomElementMicrotaskDispatcher.cpp |
| @@ -6,6 +6,7 @@ |
| #include "core/dom/custom/CustomElementMicrotaskDispatcher.h" |
| #include "core/dom/Microtask.h" |
| +#include "core/dom/custom/CustomElementAsyncImportMicrotaskQueue.h" |
| #include "core/dom/custom/CustomElementCallbackDispatcher.h" |
| #include "core/dom/custom/CustomElementCallbackQueue.h" |
| #include "core/dom/custom/CustomElementMicrotaskImportStep.h" |
| @@ -22,6 +23,11 @@ CustomElementMicrotaskDispatcher::CustomElementMicrotaskDispatcher() |
| : m_hasScheduledMicrotask(false) |
| , m_phase(Quiescent) |
| , m_resolutionAndImports(CustomElementMicrotaskQueue::create()) |
| + , m_asyncImports(CustomElementAsyncImportMicrotaskQueue::create()) |
| +{ |
| +} |
| + |
| +CustomElementMicrotaskDispatcher::~CustomElementMicrotaskDispatcher() |
| { |
| } |
| @@ -49,6 +55,13 @@ void CustomElementMicrotaskDispatcher::enqueue(CustomElementCallbackQueue* queue |
| m_elements.append(queue); |
| } |
| +void CustomElementMicrotaskDispatcher::enqueueAsyncImportStep(PassOwnPtr<CustomElementMicrotaskImportStep> step) |
| +{ |
| + ASSERT(m_phase == Quiescent || m_phase == DispatchingCallbacks); |
|
dominicc (has gone to gerrit)
2014/05/25 23:55:10
Can we refactor to eliminate the duplication of th
Hajime Morrita
2014/05/27 21:12:47
Done. Made some rearrangement around signature and
|
| + ensureMicrotaskScheduled(); |
| + m_asyncImports->enqueue(step); |
| +} |
| + |
| void CustomElementMicrotaskDispatcher::importDidFinish(CustomElementMicrotaskImportStep* step) |
| { |
| ASSERT(m_phase == Quiescent || m_phase == DispatchingCallbacks); |
| @@ -82,6 +95,8 @@ void CustomElementMicrotaskDispatcher::doDispatch() |
| m_phase = Resolving; |
| m_resolutionAndImports->dispatch(); |
| + if (m_resolutionAndImports->isEmpty()) |
| + m_asyncImports->dispatch(); |
|
dominicc (has gone to gerrit)
2014/05/25 23:55:10
Could we dispatch these anyway? WDYT?
Hajime Morrita
2014/05/27 21:12:47
That makes some tests fail.
Async imports don't bl
dominicc (has gone to gerrit)
2014/05/27 23:41:25
I remembered this in the middle of the night last
|
| m_phase = DispatchingCallbacks; |
| for (Vector<CustomElementCallbackQueue*>::iterator it = m_elements.begin();it != m_elements.end(); ++it) { |
| @@ -99,7 +114,11 @@ void CustomElementMicrotaskDispatcher::doDispatch() |
| void CustomElementMicrotaskDispatcher::show() |
| { |
| fprintf(stderr, "Dispatcher:\n"); |
| - m_resolutionAndImports->show(1); |
| + fprintf(stderr, " Sync:\n"); |
| + m_resolutionAndImports->show(3); |
| + fprintf(stderr, " Async:\n"); |
| + m_asyncImports->show(3); |
| + |
| } |
| #endif |