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

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

Issue 249563003: REGRESSION(r171966): Custom elements in async imports don't get upgrade. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 8 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/CustomElementMicrotaskQueue.cpp
diff --git a/Source/core/dom/custom/CustomElementMicrotaskQueue.cpp b/Source/core/dom/custom/CustomElementMicrotaskQueue.cpp
index 9afa0e00922d1116dd18f6d5d0879b99c07df2a7..d0abbc34e5efad963f5c89e3ef437aed5e6885da 100644
--- a/Source/core/dom/custom/CustomElementMicrotaskQueue.cpp
+++ b/Source/core/dom/custom/CustomElementMicrotaskQueue.cpp
@@ -83,23 +83,42 @@ void CustomElementMicrotaskQueue::enqueue(PassOwnPtr<CustomElementMicrotaskStep>
CustomElementMicrotaskStep::Result CustomElementMicrotaskQueue::dispatch()
{
MicrotaskQueueInvocationScope scope(this);
- Result result = Result(0);
+ Vector<OwnPtr<CustomElementMicrotaskStep> > remaining;
dominicc (has gone to gerrit) 2014/04/30 23:57:20 I think you should avoid this "remain" thing. It j
+ Result accumulatedResult = Result(CustomElementMicrotaskStep::Continue);
unsigned i;
for (i = 0; i < m_queue.size(); ++i) {
- result = Result(result | m_queue[i]->process());
-
- if (result & CustomElementMicrotaskStep::ShouldStop)
+ Result result = m_queue[i]->process();
+ accumulatedResult = Result(result | accumulatedResult);
+
+ bool shouldStop = result & CustomElementMicrotaskStep::ShouldStop;
+ bool shouldRemain = result & CustomElementMicrotaskStep::ShouldRemain;
+ ASSERT(!shouldStop || shouldStop == shouldRemain);
+ if (shouldRemain)
+ remaining.append(m_queue[i].release());
+ if (shouldStop)
break;
}
- bool wasStopped = i < m_queue.size();
- if (wasStopped)
- m_queue.remove(0, i);
- else
- m_queue.resize(0);
+ for (++i; i < m_queue.size(); ++i)
+ remaining.append(m_queue[i].release());
+ m_queue.swap(remaining);
+ return accumulatedResult;
+}
- return result;
+#if !defined(NDEBUG)
+void CustomElementMicrotaskQueue::show(unsigned indent)
+{
+ for (unsigned i = 0; i < m_queue.size(); ++i) {
+ if (m_queue[i]) {
+ m_queue[i]->show(indent);
+ } else {
+ for (unsigned j = 0; j < indent; ++j)
+ fprintf(stderr, " ");
+ fprintf(stderr, "null\n");
+ }
+ }
}
+#endif
} // namespace WebCore

Powered by Google App Engine
This is Rietveld 408576698