Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(902)

Unified Diff: Source/core/dom/custom/CustomElementMicrotaskDispatcher.cpp

Issue 334253005: Custom Elements: Encapsulates Async and Sync Queues into one class. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Updated Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/dom/custom/CustomElementMicrotaskDispatcher.cpp
diff --git a/Source/core/dom/custom/CustomElementMicrotaskDispatcher.cpp b/Source/core/dom/custom/CustomElementMicrotaskDispatcher.cpp
index 31c14b69e6a4b7894107edf1088b29023e3b9d6a..2adc2d15469b1c60ce7f39dec82b78d39e19ee80 100644
--- a/Source/core/dom/custom/CustomElementMicrotaskDispatcher.cpp
+++ b/Source/core/dom/custom/CustomElementMicrotaskDispatcher.cpp
@@ -6,13 +6,11 @@
#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"
-#include "core/dom/custom/CustomElementMicrotaskQueue.h"
+#include "core/dom/custom/CustomElementMicrotaskStepDispatcher.h"
#include "core/dom/custom/CustomElementScheduler.h"
-#include "core/html/imports/HTMLImportLoader.h"
#include "wtf/MainThread.h"
namespace WebCore {
@@ -22,8 +20,7 @@ static const CustomElementCallbackQueue::ElementQueueId kMicrotaskQueueId = 0;
CustomElementMicrotaskDispatcher::CustomElementMicrotaskDispatcher()
: m_hasScheduledMicrotask(false)
, m_phase(Quiescent)
- , m_resolutionAndImports(CustomElementMicrotaskQueue::create())
- , m_asyncImports(CustomElementAsyncImportMicrotaskQueue::create())
+ , m_steps(CustomElementMicrotaskStepDispatcher::create())
{
}
@@ -38,19 +35,13 @@ CustomElementMicrotaskDispatcher& CustomElementMicrotaskDispatcher::instance()
void CustomElementMicrotaskDispatcher::enqueue(HTMLImportLoader* parentLoader, PassOwnPtrWillBeRawPtr<CustomElementMicrotaskStep> step)
{
ensureMicrotaskScheduledForMicrotaskSteps();
- if (parentLoader)
- parentLoader->microtaskQueue()->enqueue(step);
- else
- m_resolutionAndImports->enqueue(step);
+ m_steps->enqueue(parentLoader, step);
}
void CustomElementMicrotaskDispatcher::enqueue(HTMLImportLoader* parentLoader, PassOwnPtrWillBeRawPtr<CustomElementMicrotaskImportStep> step, bool importIsSync)
{
ensureMicrotaskScheduledForMicrotaskSteps();
- if (importIsSync)
- enqueue(parentLoader, PassOwnPtrWillBeRawPtr<CustomElementMicrotaskStep>(step));
- else
- m_asyncImports->enqueue(step);
+ m_steps->enqueue(parentLoader, step, importIsSync);
}
void CustomElementMicrotaskDispatcher::enqueue(CustomElementCallbackQueue* queue)
@@ -103,9 +94,7 @@ void CustomElementMicrotaskDispatcher::doDispatch()
ASSERT_WITH_SECURITY_IMPLICATION(!CustomElementCallbackDispatcher::inCallbackDeliveryScope());
m_phase = Resolving;
- m_resolutionAndImports->dispatch();
- if (m_resolutionAndImports->isEmpty())
- m_asyncImports->dispatch();
+ m_steps->dispatch();
m_phase = DispatchingCallbacks;
for (WillBeHeapVector<RawPtrWillBeMember<CustomElementCallbackQueue> >::iterator it = m_elements.begin(); it != m_elements.end(); ++it) {
@@ -121,8 +110,7 @@ void CustomElementMicrotaskDispatcher::doDispatch()
void CustomElementMicrotaskDispatcher::trace(Visitor* visitor)
{
- visitor->trace(m_resolutionAndImports);
- visitor->trace(m_asyncImports);
+ visitor->trace(m_steps);
#if ENABLE(OILPAN)
visitor->trace(m_elements);
#endif
@@ -131,11 +119,7 @@ void CustomElementMicrotaskDispatcher::trace(Visitor* visitor)
#if !defined(NDEBUG)
void CustomElementMicrotaskDispatcher::show()
{
- fprintf(stderr, "Dispatcher:\n");
- fprintf(stderr, " Sync:\n");
- m_resolutionAndImports->show(3);
- fprintf(stderr, " Async:\n");
- m_asyncImports->show(3);
+ m_steps->show(2);
}
#endif
« no previous file with comments | « Source/core/dom/custom/CustomElementMicrotaskDispatcher.h ('k') | Source/core/dom/custom/CustomElementMicrotaskImportStep.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698