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

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

Issue 106903007: Let unresolved custom element go through CustomElementCallbackQueue. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years 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
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 15 matching lines...) Expand all
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #include "config.h" 31 #include "config.h"
32 #include "core/dom/custom/CustomElementCallbackScheduler.h" 32 #include "core/dom/custom/CustomElementCallbackScheduler.h"
33 33
34 #include "core/dom/Element.h" 34 #include "core/dom/Element.h"
35 #include "core/dom/custom/CustomElementCallbackDispatcher.h" 35 #include "core/dom/custom/CustomElementCallbackDispatcher.h"
36 #include "core/dom/custom/CustomElementCallbackInvocation.h"
36 #include "core/dom/custom/CustomElementLifecycleCallbacks.h" 37 #include "core/dom/custom/CustomElementLifecycleCallbacks.h"
38 #include "core/dom/custom/CustomElementResolutionInvocation.h"
37 39
38 namespace WebCore { 40 namespace WebCore {
39 41
40 void CustomElementCallbackScheduler::scheduleAttributeChangedCallback(PassRefPtr <CustomElementLifecycleCallbacks> callbacks, PassRefPtr<Element> element, const AtomicString& name, const AtomicString& oldValue, const AtomicString& newValue) 42 void CustomElementCallbackScheduler::scheduleAttributeChangedCallback(PassRefPtr <CustomElementLifecycleCallbacks> callbacks, PassRefPtr<Element> element, const AtomicString& name, const AtomicString& oldValue, const AtomicString& newValue)
41 { 43 {
42 if (!callbacks->hasAttributeChangedCallback()) 44 if (!callbacks->hasAttributeChangedCallback())
43 return; 45 return;
44 46
45 CustomElementCallbackQueue* queue = instance().schedule(element); 47 CustomElementCallbackQueue* queue = instance().schedule(element);
46 queue->append(CustomElementCallbackInvocation::createAttributeChangedInvocat ion(callbacks, name, oldValue, newValue)); 48 queue->append(CustomElementCallbackInvocation::createAttributeChangedInvocat ion(callbacks, name, oldValue, newValue));
(...skipping 19 matching lines...) Expand all
66 68
67 void CustomElementCallbackScheduler::scheduleLeftViewCallback(PassRefPtr<CustomE lementLifecycleCallbacks> callbacks, PassRefPtr<Element> element) 69 void CustomElementCallbackScheduler::scheduleLeftViewCallback(PassRefPtr<CustomE lementLifecycleCallbacks> callbacks, PassRefPtr<Element> element)
68 { 70 {
69 if (!callbacks->hasLeftViewCallback()) 71 if (!callbacks->hasLeftViewCallback())
70 return; 72 return;
71 73
72 CustomElementCallbackQueue* queue = instance().schedule(element); 74 CustomElementCallbackQueue* queue = instance().schedule(element);
73 queue->append(CustomElementCallbackInvocation::createInvocation(callbacks, C ustomElementLifecycleCallbacks::LeftView)); 75 queue->append(CustomElementCallbackInvocation::createInvocation(callbacks, C ustomElementLifecycleCallbacks::LeftView));
74 } 76 }
75 77
78 void CustomElementCallbackScheduler::scheduleResolutionCallback(const CustomElem entDescriptor& descriptor, PassRefPtr<Element> element)
79 {
80 CustomElementCallbackQueue* queue = instance().schedule(element);
81 queue->append(CustomElementResolutionInvocation::createInvocation(descriptor ));
82 }
83
76 CustomElementCallbackScheduler& CustomElementCallbackScheduler::instance() 84 CustomElementCallbackScheduler& CustomElementCallbackScheduler::instance()
77 { 85 {
78 DEFINE_STATIC_LOCAL(CustomElementCallbackScheduler, instance, ()); 86 DEFINE_STATIC_LOCAL(CustomElementCallbackScheduler, instance, ());
79 return instance; 87 return instance;
80 } 88 }
81 89
82 CustomElementCallbackQueue* CustomElementCallbackScheduler::ensureCallbackQueue( PassRefPtr<Element> element) 90 CustomElementCallbackQueue* CustomElementCallbackScheduler::ensureCallbackQueue( PassRefPtr<Element> element)
83 { 91 {
84 Element* key = element.get(); 92 Element* key = element.get();
85 ElementCallbackQueueMap::iterator it = m_elementCallbackQueueMap.find(key); 93 ElementCallbackQueueMap::iterator it = m_elementCallbackQueueMap.find(key);
(...skipping 26 matching lines...) Expand all
112 // stack. Because callback queues are processed exhaustively, this 120 // stack. Because callback queues are processed exhaustively, this
113 // effectively moves the callback queue to the top of the stack. 121 // effectively moves the callback queue to the top of the stack.
114 CustomElementCallbackQueue* CustomElementCallbackScheduler::scheduleInCurrentEle mentQueue(PassRefPtr<Element> element) 122 CustomElementCallbackQueue* CustomElementCallbackScheduler::scheduleInCurrentEle mentQueue(PassRefPtr<Element> element)
115 { 123 {
116 CustomElementCallbackQueue* callbackQueue = ensureCallbackQueue(element); 124 CustomElementCallbackQueue* callbackQueue = ensureCallbackQueue(element);
117 CustomElementCallbackDispatcher::instance().enqueue(callbackQueue); 125 CustomElementCallbackDispatcher::instance().enqueue(callbackQueue);
118 return callbackQueue; 126 return callbackQueue;
119 } 127 }
120 128
121 } // namespace WebCore 129 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698