| 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/CustomElementMicrotaskQueue.h" | 35 #include "core/dom/custom/CustomElementMicrotaskDispatcher.h" |
| 36 #include "wtf/HashMap.h" | 36 #include "wtf/HashMap.h" |
| 37 #include "wtf/OwnPtr.h" | 37 #include "wtf/OwnPtr.h" |
| 38 #include "wtf/PassOwnPtr.h" | 38 #include "wtf/PassOwnPtr.h" |
| 39 #include "wtf/PassRefPtr.h" | 39 #include "wtf/PassRefPtr.h" |
| 40 #include "wtf/text/AtomicString.h" | 40 #include "wtf/text/AtomicString.h" |
| 41 | 41 |
| 42 namespace WebCore { | 42 namespace WebCore { |
| 43 | 43 |
| 44 class CustomElementDescriptor; | 44 class CustomElementDescriptor; |
| 45 class CustomElementLifecycleCallbacks; | 45 class CustomElementLifecycleCallbacks; |
| 46 class CustomElementMicrotaskImportStep; | 46 class CustomElementMicrotaskImportStep; |
| 47 class Element; | 47 class Element; |
| 48 class HTMLImport; | 48 class HTMLImport; |
| 49 class HTMLImportChild; |
| 49 | 50 |
| 50 class CustomElementScheduler { | 51 class CustomElementScheduler { |
| 51 public: | 52 public: |
| 53 static void scheduleCreatedCallback(PassRefPtr<CustomElementLifecycleCallbac
ks>, PassRefPtr<Element>); |
| 52 static void scheduleAttributeChangedCallback(PassRefPtr<CustomElementLifecyc
leCallbacks>, PassRefPtr<Element>, const AtomicString& name, const AtomicString&
oldValue, const AtomicString& newValue); | 54 static void scheduleAttributeChangedCallback(PassRefPtr<CustomElementLifecyc
leCallbacks>, PassRefPtr<Element>, const AtomicString& name, const AtomicString&
oldValue, const AtomicString& newValue); |
| 53 static void scheduleAttachedCallback(PassRefPtr<CustomElementLifecycleCallba
cks>, PassRefPtr<Element>); | 55 static void scheduleAttachedCallback(PassRefPtr<CustomElementLifecycleCallba
cks>, PassRefPtr<Element>); |
| 54 static void scheduleDetachedCallback(PassRefPtr<CustomElementLifecycleCallba
cks>, PassRefPtr<Element>); | 56 static void scheduleDetachedCallback(PassRefPtr<CustomElementLifecycleCallba
cks>, PassRefPtr<Element>); |
| 55 static void scheduleResolutionStep(const CustomElementDescriptor&, PassRefPt
r<Element>); | 57 |
| 58 static void resolveOrScheduleResolution(PassRefPtr<CustomElementRegistration
Context>, PassRefPtr<Element>, const CustomElementDescriptor&); |
| 56 static CustomElementMicrotaskImportStep* scheduleImport(HTMLImportChild*); | 59 static CustomElementMicrotaskImportStep* scheduleImport(HTMLImportChild*); |
| 57 | 60 |
| 58 static bool dispatchMicrotaskProcessingSteps() { return instance().dispatch(
); } | 61 static bool dispatchMicrotaskProcessingSteps() { return instance().dispatch(
); } |
| 59 | 62 |
| 60 private: | 63 private: |
| 61 CustomElementScheduler() { } | 64 CustomElementScheduler() { } |
| 62 | 65 |
| 63 static CustomElementScheduler& instance(); | 66 static CustomElementScheduler& instance(); |
| 64 | 67 |
| 65 CustomElementCallbackQueue* ensureCallbackQueue(PassRefPtr<Element>); | 68 CustomElementCallbackQueue* ensureCallbackQueue(PassRefPtr<Element>); |
| 66 CustomElementCallbackQueue* schedule(PassRefPtr<Element>); | 69 CustomElementCallbackQueue* schedule(PassRefPtr<Element>); |
| 67 | 70 |
| 68 bool dispatch(); | 71 bool dispatch(); |
| 69 void clearElementCallbackQueueMap(); | 72 void clearElementCallbackQueueMap(); |
| 70 | 73 |
| 71 typedef HashMap<Element*, OwnPtr<CustomElementCallbackQueue> > ElementCallba
ckQueueMap; | 74 typedef HashMap<Element*, OwnPtr<CustomElementCallbackQueue> > ElementCallba
ckQueueMap; |
| 72 ElementCallbackQueueMap m_elementCallbackQueueMap; | 75 ElementCallbackQueueMap m_elementCallbackQueueMap; |
| 73 | 76 |
| 74 CustomElementMicrotaskQueue m_baseMicrotaskQueue; | 77 CustomElementMicrotaskDispatcher m_microtaskDispatcher; |
| 75 }; | 78 }; |
| 76 | 79 |
| 77 } | 80 } |
| 78 | 81 |
| 79 #endif // CustomElementScheduler_h | 82 #endif // CustomElementScheduler_h |
| OLD | NEW |