| 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 { | 59 { |
| 60 if (s_elementQueueStart != s_elementQueueEnd) | 60 if (s_elementQueueStart != s_elementQueueEnd) |
| 61 processElementQueueAndPop(); | 61 processElementQueueAndPop(); |
| 62 s_elementQueueStart = m_savedElementQueueStart; | 62 s_elementQueueStart = m_savedElementQueueStart; |
| 63 } | 63 } |
| 64 | 64 |
| 65 private: | 65 private: |
| 66 size_t m_savedElementQueueStart; | 66 size_t m_savedElementQueueStart; |
| 67 }; | 67 }; |
| 68 | 68 |
| 69 void enqueueAttributeChangedCallback(PassRefPtr<CustomElementLifecycleCallba
cks>, PassRefPtr<Element>, const AtomicString& name, const AtomicString& oldValu
e, const AtomicString& newValue); |
| 69 void enqueueCreatedCallback(PassRefPtr<CustomElementLifecycleCallbacks>, Pas
sRefPtr<Element>); | 70 void enqueueCreatedCallback(PassRefPtr<CustomElementLifecycleCallbacks>, Pas
sRefPtr<Element>); |
| 70 | 71 |
| 71 // Returns true if more work may have to be performed at the | 72 // Returns true if more work may have to be performed at the |
| 72 // checkpoint by this or other workers (for example, this work | 73 // checkpoint by this or other workers (for example, this work |
| 73 // invoked author scripts) | 74 // invoked author scripts) |
| 74 bool dispatch(); | 75 bool dispatch(); |
| 75 | 76 |
| 76 private: | 77 private: |
| 77 CustomElementCallbackDispatcher() | 78 CustomElementCallbackDispatcher() |
| 78 { | 79 { |
| (...skipping 16 matching lines...) Expand all Loading... |
| 95 static size_t s_elementQueueEnd; | 96 static size_t s_elementQueueEnd; |
| 96 | 97 |
| 97 static bool inCallbackDeliveryScope() { return s_elementQueueStart; } | 98 static bool inCallbackDeliveryScope() { return s_elementQueueStart; } |
| 98 | 99 |
| 99 typedef int ElementQueue; | 100 typedef int ElementQueue; |
| 100 static ElementQueue currentElementQueue() { return ElementQueue(s_elementQue
ueStart); } | 101 static ElementQueue currentElementQueue() { return ElementQueue(s_elementQue
ueStart); } |
| 101 | 102 |
| 102 static void processElementQueueAndPop(); | 103 static void processElementQueueAndPop(); |
| 103 void processElementQueueAndPop(size_t start, size_t end); | 104 void processElementQueueAndPop(size_t start, size_t end); |
| 104 | 105 |
| 106 CustomElementCallbackQueue* createCallbackQueue(PassRefPtr<CustomElementLife
cycleCallbacks>, PassRefPtr<Element>); |
| 107 CustomElementCallbackQueue* ensureCallbackQueue(PassRefPtr<CustomElementLife
cycleCallbacks>, PassRefPtr<Element>); |
| 108 |
| 105 // The processing stack, flattened. Element queues lower in the | 109 // The processing stack, flattened. Element queues lower in the |
| 106 // stack appear toward the head of the vector. The first element | 110 // stack appear toward the head of the vector. The first element |
| 107 // is a null sentinel value. | 111 // is a null sentinel value. |
| 108 Vector<CustomElementCallbackQueue*> m_flattenedProcessingStack; | 112 Vector<CustomElementCallbackQueue*> m_flattenedProcessingStack; |
| 109 | 113 |
| 110 typedef HashMap<Element*, OwnPtr<CustomElementCallbackQueue> > ElementCallba
ckQueueMap; | 114 typedef HashMap<Element*, OwnPtr<CustomElementCallbackQueue> > ElementCallba
ckQueueMap; |
| 111 ElementCallbackQueueMap m_elementCallbackQueueMap; | 115 ElementCallbackQueueMap m_elementCallbackQueueMap; |
| 112 }; | 116 }; |
| 113 | 117 |
| 114 } | 118 } |
| 115 | 119 |
| 116 #endif // CustomElementCallbackDispatcher_h | 120 #endif // CustomElementCallbackDispatcher_h |
| OLD | NEW |