OLD | NEW |
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 14 matching lines...) Expand all Loading... |
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
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 #ifndef CustomElementScheduler_h | 31 #ifndef CustomElementScheduler_h |
32 #define CustomElementScheduler_h | 32 #define CustomElementScheduler_h |
33 | 33 |
34 #include "core/dom/custom/CustomElementCallbackQueue.h" | 34 #include "core/dom/custom/CustomElementCallbackQueue.h" |
| 35 #include "core/dom/custom/CustomElementLifecycleCallbacks.h" |
35 #include "wtf/HashMap.h" | 36 #include "wtf/HashMap.h" |
36 #include "wtf/OwnPtr.h" | 37 #include "wtf/OwnPtr.h" |
37 #include "wtf/PassRefPtr.h" | 38 #include "wtf/PassRefPtr.h" |
38 #include "wtf/text/AtomicString.h" | 39 #include "wtf/text/AtomicString.h" |
39 | 40 |
40 namespace WebCore { | 41 namespace WebCore { |
41 | 42 |
42 class CustomElementDescriptor; | 43 class CustomElementDescriptor; |
43 class CustomElementLifecycleCallbacks; | |
44 class CustomElementMicrotaskImportStep; | 44 class CustomElementMicrotaskImportStep; |
45 class Element; | 45 class Element; |
46 class HTMLImportChild; | 46 class HTMLImportChild; |
47 | 47 |
48 class CustomElementScheduler { | 48 class CustomElementScheduler { |
49 public: | 49 public: |
50 static void scheduleCreatedCallback(PassRefPtr<CustomElementLifecycleCallbac
ks>, PassRefPtr<Element>); | 50 static void scheduleCallback(PassRefPtr<CustomElementLifecycleCallbacks>, Pa
ssRefPtr<Element>, CustomElementLifecycleCallbacks::CallbackType); |
51 static void scheduleAttributeChangedCallback(PassRefPtr<CustomElementLifecyc
leCallbacks>, PassRefPtr<Element>, const AtomicString& name, const AtomicString&
oldValue, const AtomicString& newValue); | 51 static void scheduleAttributeChangedCallback(PassRefPtr<CustomElementLifecyc
leCallbacks>, PassRefPtr<Element>, const AtomicString& name, const AtomicString&
oldValue, const AtomicString& newValue); |
52 static void scheduleAttachedCallback(PassRefPtr<CustomElementLifecycleCallba
cks>, PassRefPtr<Element>); | |
53 static void scheduleDetachedCallback(PassRefPtr<CustomElementLifecycleCallba
cks>, PassRefPtr<Element>); | |
54 | 52 |
55 static void resolveOrScheduleResolution(PassRefPtr<CustomElementRegistration
Context>, PassRefPtr<Element>, const CustomElementDescriptor&); | 53 static void resolveOrScheduleResolution(PassRefPtr<CustomElementRegistration
Context>, PassRefPtr<Element>, const CustomElementDescriptor&); |
56 static CustomElementMicrotaskImportStep* scheduleImport(HTMLImportChild*); | 54 static CustomElementMicrotaskImportStep* scheduleImport(HTMLImportChild*); |
57 | 55 |
58 static void microtaskDispatcherDidFinish(); | 56 static void microtaskDispatcherDidFinish(); |
59 static void callbackDispatcherDidFinish(); | 57 static void callbackDispatcherDidFinish(); |
60 | 58 |
61 private: | 59 private: |
62 CustomElementScheduler() { } | 60 CustomElementScheduler() { } |
63 | 61 |
64 static CustomElementScheduler& instance(); | 62 static CustomElementScheduler& instance(); |
65 | 63 |
66 CustomElementCallbackQueue& ensureCallbackQueue(PassRefPtr<Element>); | 64 CustomElementCallbackQueue& ensureCallbackQueue(PassRefPtr<Element>); |
67 CustomElementCallbackQueue& schedule(PassRefPtr<Element>); | 65 CustomElementCallbackQueue& schedule(PassRefPtr<Element>); |
68 | 66 |
69 // FIXME: Consider moving the element's callback queue to | 67 // FIXME: Consider moving the element's callback queue to |
70 // ElementRareData. Then the scheduler can become completely | 68 // ElementRareData. Then the scheduler can become completely |
71 // static. | 69 // static. |
72 void clearElementCallbackQueueMap(); | 70 void clearElementCallbackQueueMap(); |
73 | 71 |
74 // The element -> callback queue map is populated by the scheduler | 72 // The element -> callback queue map is populated by the scheduler |
75 // and owns the lifetimes of the CustomElementCallbackQueues. | 73 // and owns the lifetimes of the CustomElementCallbackQueues. |
76 typedef HashMap<Element*, OwnPtr<CustomElementCallbackQueue> > ElementCallba
ckQueueMap; | 74 typedef HashMap<Element*, OwnPtr<CustomElementCallbackQueue> > ElementCallba
ckQueueMap; |
77 ElementCallbackQueueMap m_elementCallbackQueueMap; | 75 ElementCallbackQueueMap m_elementCallbackQueueMap; |
78 }; | 76 }; |
79 | 77 |
80 } | 78 } |
81 | 79 |
82 #endif // CustomElementScheduler_h | 80 #endif // CustomElementScheduler_h |
OLD | NEW |