| 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 NoBaseWillBeGarbageCollected<CustomE
    lementScheduler> { | 
|  | 50     DECLARE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(CustomElementScheduler); | 
| 49 public: | 51 public: | 
| 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); |  | 
| 52 | 52 | 
| 53     static void resolveOrScheduleResolution(PassRefPtr<CustomElementRegistration
    Context>, PassRefPtr<Element>, const CustomElementDescriptor&); | 53     static void scheduleCallback(PassRefPtr<CustomElementLifecycleCallbacks>, Pa
    ssRefPtrWillBeRawPtr<Element>, CustomElementLifecycleCallbacks::CallbackType); | 
|  | 54     static void scheduleAttributeChangedCallback(PassRefPtr<CustomElementLifecyc
    leCallbacks>, PassRefPtrWillBeRawPtr<Element>, const AtomicString& name, const A
    tomicString& oldValue, const AtomicString& newValue); | 
|  | 55 | 
|  | 56     static void resolveOrScheduleResolution(PassRefPtrWillBeRawPtr<CustomElement
    RegistrationContext>, PassRefPtrWillBeRawPtr<Element>, const CustomElementDescri
    ptor&); | 
| 54     static CustomElementMicrotaskImportStep* scheduleImport(HTMLImportChild*); | 57     static CustomElementMicrotaskImportStep* scheduleImport(HTMLImportChild*); | 
| 55 | 58 | 
| 56     static void microtaskDispatcherDidFinish(); | 59     static void microtaskDispatcherDidFinish(); | 
| 57     static void callbackDispatcherDidFinish(); | 60     static void callbackDispatcherDidFinish(); | 
| 58 | 61 | 
|  | 62     void trace(Visitor*); | 
|  | 63 | 
| 59 private: | 64 private: | 
| 60     CustomElementScheduler() { } | 65     CustomElementScheduler() { } | 
| 61 | 66 | 
| 62     static CustomElementScheduler& instance(); | 67     static CustomElementScheduler& instance(); | 
| 63 | 68 | 
| 64     CustomElementCallbackQueue& ensureCallbackQueue(PassRefPtr<Element>); | 69     CustomElementCallbackQueue& ensureCallbackQueue(PassRefPtrWillBeRawPtr<Eleme
    nt>); | 
| 65     CustomElementCallbackQueue& schedule(PassRefPtr<Element>); | 70     CustomElementCallbackQueue& schedule(PassRefPtrWillBeRawPtr<Element>); | 
| 66 | 71 | 
| 67     // FIXME: Consider moving the element's callback queue to | 72     // FIXME: Consider moving the element's callback queue to | 
| 68     // ElementRareData. Then the scheduler can become completely | 73     // ElementRareData. Then the scheduler can become completely | 
| 69     // static. | 74     // static. | 
| 70     void clearElementCallbackQueueMap(); | 75     void clearElementCallbackQueueMap(); | 
| 71 | 76 | 
| 72     // The element -> callback queue map is populated by the scheduler | 77     // The element -> callback queue map is populated by the scheduler | 
| 73     // and owns the lifetimes of the CustomElementCallbackQueues. | 78     // and owns the lifetimes of the CustomElementCallbackQueues. | 
| 74     typedef HashMap<Element*, OwnPtr<CustomElementCallbackQueue> > ElementCallba
    ckQueueMap; | 79     typedef WillBeHeapHashMap<RawPtrWillBeMember<Element>, OwnPtrWillBeMember<Cu
    stomElementCallbackQueue> > ElementCallbackQueueMap; | 
| 75     ElementCallbackQueueMap m_elementCallbackQueueMap; | 80     ElementCallbackQueueMap m_elementCallbackQueueMap; | 
| 76 }; | 81 }; | 
| 77 | 82 | 
| 78 } | 83 } | 
| 79 | 84 | 
| 80 #endif // CustomElementScheduler_h | 85 #endif // CustomElementScheduler_h | 
| OLD | NEW | 
|---|