| 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 CustomElementCallbackQueue_h | 31 #ifndef CustomElementCallbackQueue_h |
| 32 #define CustomElementCallbackQueue_h | 32 #define CustomElementCallbackQueue_h |
| 33 | 33 |
| 34 #include "core/dom/Element.h" | 34 #include "core/dom/Element.h" |
| 35 #include "core/dom/custom/CustomElementProcessingStep.h" | 35 #include "core/dom/custom/CustomElementProcessingStep.h" |
| 36 #include "platform/heap/Handle.h" |
| 36 #include "wtf/OwnPtr.h" | 37 #include "wtf/OwnPtr.h" |
| 37 #include "wtf/PassOwnPtr.h" | 38 #include "wtf/PassOwnPtr.h" |
| 38 #include "wtf/PassRefPtr.h" | 39 #include "wtf/PassRefPtr.h" |
| 39 #include "wtf/RefPtr.h" | 40 #include "wtf/RefPtr.h" |
| 40 #include "wtf/Vector.h" | 41 #include "wtf/Vector.h" |
| 41 | 42 |
| 42 namespace WebCore { | 43 namespace WebCore { |
| 43 | 44 |
| 44 // FIXME: Rename this because it contains resolution and upgrade as | 45 // FIXME: Rename this because it contains resolution and upgrade as |
| 45 // well as callbacks. | 46 // well as callbacks. |
| 46 class CustomElementCallbackQueue { | 47 class CustomElementCallbackQueue : public NoBaseWillBeGarbageCollectedFinalized<
CustomElementCallbackQueue> { |
| 47 WTF_MAKE_NONCOPYABLE(CustomElementCallbackQueue); | 48 WTF_MAKE_NONCOPYABLE(CustomElementCallbackQueue); |
| 48 public: | 49 public: |
| 49 static PassOwnPtr<CustomElementCallbackQueue> create(PassRefPtr<Element>); | 50 static PassOwnPtrWillBeRawPtr<CustomElementCallbackQueue> create(PassRefPtrW
illBeRawPtr<Element>); |
| 50 | 51 |
| 51 typedef int ElementQueueId; | 52 typedef int ElementQueueId; |
| 52 ElementQueueId owner() const { return m_owner; } | 53 ElementQueueId owner() const { return m_owner; } |
| 53 | 54 |
| 54 void setOwner(ElementQueueId newOwner) | 55 void setOwner(ElementQueueId newOwner) |
| 55 { | 56 { |
| 56 // ElementCallbackQueues only migrate towards the top of the | 57 // ElementCallbackQueues only migrate towards the top of the |
| 57 // processing stack. | 58 // processing stack. |
| 58 ASSERT(newOwner >= m_owner); | 59 ASSERT(newOwner >= m_owner); |
| 59 m_owner = newOwner; | 60 m_owner = newOwner; |
| 60 } | 61 } |
| 61 | 62 |
| 62 bool processInElementQueue(ElementQueueId); | 63 bool processInElementQueue(ElementQueueId); |
| 63 | 64 |
| 64 void append(PassOwnPtr<CustomElementProcessingStep> invocation) { m_queue.ap
pend(invocation); } | 65 void append(PassOwnPtr<CustomElementProcessingStep> invocation) { m_queue.ap
pend(invocation); } |
| 65 bool inCreatedCallback() const { return m_inCreatedCallback; } | 66 bool inCreatedCallback() const { return m_inCreatedCallback; } |
| 66 | 67 |
| 68 void trace(Visitor*); |
| 69 |
| 67 private: | 70 private: |
| 68 CustomElementCallbackQueue(PassRefPtr<Element>); | 71 explicit CustomElementCallbackQueue(PassRefPtrWillBeRawPtr<Element>); |
| 69 | 72 |
| 70 RefPtr<Element> m_element; | 73 RefPtrWillBeMember<Element> m_element; |
| 71 Vector<OwnPtr<CustomElementProcessingStep> > m_queue; | 74 Vector<OwnPtr<CustomElementProcessingStep> > m_queue; |
| 72 ElementQueueId m_owner; | 75 ElementQueueId m_owner; |
| 73 size_t m_index; | 76 size_t m_index; |
| 74 bool m_inCreatedCallback; | 77 bool m_inCreatedCallback; |
| 75 }; | 78 }; |
| 76 | 79 |
| 77 } | 80 } |
| 78 | 81 |
| 79 #endif // CustomElementCallbackQueue_h | 82 #endif // CustomElementCallbackQueue_h |
| OLD | NEW |