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 15 matching lines...) Expand all Loading... |
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 "core/dom/custom/CustomElementLifecycleCallbacks.h" |
| 36 #include "platform/heap/Handle.h" |
36 #include "wtf/HashMap.h" | 37 #include "wtf/HashMap.h" |
37 #include "wtf/OwnPtr.h" | 38 #include "wtf/OwnPtr.h" |
38 #include "wtf/PassRefPtr.h" | 39 #include "wtf/PassRefPtr.h" |
39 #include "wtf/text/AtomicString.h" | 40 #include "wtf/text/AtomicString.h" |
40 | 41 |
41 namespace WebCore { | 42 namespace WebCore { |
42 | 43 |
43 class CustomElementDescriptor; | 44 class CustomElementDescriptor; |
44 class CustomElementMicrotaskImportStep; | 45 class CustomElementMicrotaskImportStep; |
45 class Element; | 46 class Element; |
46 class HTMLImportChild; | 47 class HTMLImportChild; |
47 | 48 |
48 class CustomElementScheduler { | 49 class CustomElementScheduler FINAL : public NoBaseWillBeGarbageCollectedFinalize
d<CustomElementScheduler> { |
49 public: | 50 public: |
50 static void scheduleCallback(PassRefPtr<CustomElementLifecycleCallbacks>, Pa
ssRefPtr<Element>, CustomElementLifecycleCallbacks::CallbackType); | 51 static void scheduleCallback(PassRefPtr<CustomElementLifecycleCallbacks>, Pa
ssRefPtrWillBeRawPtr<Element>, CustomElementLifecycleCallbacks::CallbackType); |
51 static void scheduleAttributeChangedCallback(PassRefPtr<CustomElementLifecyc
leCallbacks>, PassRefPtr<Element>, const AtomicString& name, const AtomicString&
oldValue, const AtomicString& newValue); | 52 static void scheduleAttributeChangedCallback(PassRefPtr<CustomElementLifecyc
leCallbacks>, PassRefPtrWillBeRawPtr<Element>, const AtomicString& name, const A
tomicString& oldValue, const AtomicString& newValue); |
52 | 53 |
53 static void resolveOrScheduleResolution(PassRefPtr<CustomElementRegistration
Context>, PassRefPtr<Element>, const CustomElementDescriptor&); | 54 static void resolveOrScheduleResolution(PassRefPtrWillBeRawPtr<CustomElement
RegistrationContext>, PassRefPtrWillBeRawPtr<Element>, const CustomElementDescri
ptor&); |
54 static CustomElementMicrotaskImportStep* scheduleImport(HTMLImportChild*); | 55 static CustomElementMicrotaskImportStep* scheduleImport(HTMLImportChild*); |
55 | 56 |
56 static void microtaskDispatcherDidFinish(); | 57 static void microtaskDispatcherDidFinish(); |
57 static void callbackDispatcherDidFinish(); | 58 static void callbackDispatcherDidFinish(); |
58 | 59 |
| 60 void trace(Visitor*); |
| 61 |
59 private: | 62 private: |
60 CustomElementScheduler() { } | 63 CustomElementScheduler() { } |
61 | 64 |
62 static CustomElementScheduler& instance(); | 65 static CustomElementScheduler& instance(); |
63 | 66 |
64 CustomElementCallbackQueue& ensureCallbackQueue(PassRefPtr<Element>); | 67 CustomElementCallbackQueue& ensureCallbackQueue(PassRefPtrWillBeRawPtr<Eleme
nt>); |
65 CustomElementCallbackQueue& schedule(PassRefPtr<Element>); | 68 CustomElementCallbackQueue& schedule(PassRefPtrWillBeRawPtr<Element>); |
66 | 69 |
67 // FIXME: Consider moving the element's callback queue to | 70 // FIXME: Consider moving the element's callback queue to |
68 // ElementRareData. Then the scheduler can become completely | 71 // ElementRareData. Then the scheduler can become completely |
69 // static. | 72 // static. |
70 void clearElementCallbackQueueMap(); | 73 void clearElementCallbackQueueMap(); |
71 | 74 |
72 // The element -> callback queue map is populated by the scheduler | 75 // The element -> callback queue map is populated by the scheduler |
73 // and owns the lifetimes of the CustomElementCallbackQueues. | 76 // and owns the lifetimes of the CustomElementCallbackQueues. |
74 typedef HashMap<Element*, OwnPtr<CustomElementCallbackQueue> > ElementCallba
ckQueueMap; | 77 typedef WillBeHeapHashMap<RawPtrWillBeMember<Element>, OwnPtrWillBeMember<Cu
stomElementCallbackQueue> > ElementCallbackQueueMap; |
75 ElementCallbackQueueMap m_elementCallbackQueueMap; | 78 ElementCallbackQueueMap m_elementCallbackQueueMap; |
76 }; | 79 }; |
77 | 80 |
78 } | 81 } |
79 | 82 |
80 #endif // CustomElementScheduler_h | 83 #endif // CustomElementScheduler_h |
OLD | NEW |