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

Side by Side Diff: Source/core/dom/custom/CustomElementMicrotaskDispatcher.cpp

Issue 144023016: Separate Custom Element resolution and upgrade/createdCallback. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 10 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "config.h"
6 #include "core/dom/custom/CustomElementMicrotaskDispatcher.h"
7
8 #include "core/dom/custom/CustomElementCallbackDispatcher.h"
9 #include "core/dom/custom/CustomElementCallbackQueue.h"
10 #include "core/dom/custom/CustomElementMicrotaskImportStep.h"
11 #include "core/html/HTMLImport.h"
12
13 namespace WebCore {
14
15 static const CustomElementCallbackQueue::ElementQueueId kMicrotaskQueueId = 0;
16
17 void CustomElementMicrotaskDispatcher::enqueue(HTMLImport* import, PassOwnPtr<Cu stomElementMicrotaskStep> step)
18 {
19 ASSERT(m_phase == Quiescent || m_phase == DispatchingCallbacks);
20 if (import && import->customElementMicrotaskStep())
21 import->customElementMicrotaskStep()->enqueue(step);
22 else
23 m_resolutionAndImports.enqueue(step);
24 }
25
26 void CustomElementMicrotaskDispatcher::enqueue(CustomElementCallbackQueue* queue )
27 {
28 ASSERT(m_phase == Quiescent || m_phase == Resolving);
29 queue->setOwner(kMicrotaskQueueId);
30 m_elements.append(queue);
31 }
32
33 bool CustomElementMicrotaskDispatcher::dispatch()
34 {
35 ASSERT(m_phase == Quiescent);
36
37 bool didWork = false;
38
39 m_phase = Resolving;
40 m_resolutionAndImports.dispatch();
41
42 m_phase = DispatchingCallbacks;
43 for (Vector<CustomElementCallbackQueue*>::iterator it = m_elements.begin();i t != m_elements.end(); ++it) {
44 // Created callback may enqueue an attached callback.
45 CustomElementCallbackDispatcher::CallbackDeliveryScope scope;
46 (*it)->processInElementQueue(kMicrotaskQueueId);
47
48 didWork = true;
49 }
50
51 m_elements.clear();
52 m_phase = Quiescent;
53
54 return didWork;
55 }
56
57 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/dom/custom/CustomElementMicrotaskDispatcher.h ('k') | Source/core/dom/custom/CustomElementMicrotaskElementStep.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698