| 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 | 70 |
| 71 private: | 71 private: |
| 72 V0CustomElementProcessingStack() { | 72 V0CustomElementProcessingStack() { |
| 73 // Add a null element as a sentinel. This makes it possible to | 73 // Add a null element as a sentinel. This makes it possible to |
| 74 // identify elements queued when there is no | 74 // identify elements queued when there is no |
| 75 // CallbackDeliveryScope active. Also, if the processing stack | 75 // CallbackDeliveryScope active. Also, if the processing stack |
| 76 // is popped when empty, this sentinel will cause a null deref | 76 // is popped when empty, this sentinel will cause a null deref |
| 77 // crash. | 77 // crash. |
| 78 V0CustomElementCallbackQueue* sentinel = 0; | 78 V0CustomElementCallbackQueue* sentinel = 0; |
| 79 for (size_t i = 0; i < kNumSentinels; i++) | 79 for (size_t i = 0; i < kNumSentinels; i++) |
| 80 m_flattenedProcessingStack.append(sentinel); | 80 m_flattenedProcessingStack.push_back(sentinel); |
| 81 DCHECK_EQ(s_elementQueueEnd, m_flattenedProcessingStack.size()); | 81 DCHECK_EQ(s_elementQueueEnd, m_flattenedProcessingStack.size()); |
| 82 } | 82 } |
| 83 | 83 |
| 84 // The start of the element queue on the top of the processing | 84 // The start of the element queue on the top of the processing |
| 85 // stack. An offset into instance().m_flattenedProcessingStack. | 85 // stack. An offset into instance().m_flattenedProcessingStack. |
| 86 static size_t s_elementQueueStart; | 86 static size_t s_elementQueueStart; |
| 87 | 87 |
| 88 // The end of the element queue on the top of the processing | 88 // The end of the element queue on the top of the processing |
| 89 // stack. A cache of instance().m_flattenedProcessingStack.size(). | 89 // stack. A cache of instance().m_flattenedProcessingStack.size(). |
| 90 static size_t s_elementQueueEnd; | 90 static size_t s_elementQueueEnd; |
| 91 | 91 |
| 92 static V0CustomElementCallbackQueue::ElementQueueId currentElementQueue() { | 92 static V0CustomElementCallbackQueue::ElementQueueId currentElementQueue() { |
| 93 return V0CustomElementCallbackQueue::ElementQueueId(s_elementQueueStart); | 93 return V0CustomElementCallbackQueue::ElementQueueId(s_elementQueueStart); |
| 94 } | 94 } |
| 95 | 95 |
| 96 static void processElementQueueAndPop(); | 96 static void processElementQueueAndPop(); |
| 97 void processElementQueueAndPop(size_t start, size_t end); | 97 void processElementQueueAndPop(size_t start, size_t end); |
| 98 | 98 |
| 99 // The processing stack, flattened. Element queues lower in the | 99 // The processing stack, flattened. Element queues lower in the |
| 100 // stack appear toward the head of the vector. The first element | 100 // stack appear toward the head of the vector. The first element |
| 101 // is a null sentinel value. | 101 // is a null sentinel value. |
| 102 static const size_t kNumSentinels = 1; | 102 static const size_t kNumSentinels = 1; |
| 103 HeapVector<Member<V0CustomElementCallbackQueue>> m_flattenedProcessingStack; | 103 HeapVector<Member<V0CustomElementCallbackQueue>> m_flattenedProcessingStack; |
| 104 }; | 104 }; |
| 105 | 105 |
| 106 } // namespace blink | 106 } // namespace blink |
| 107 | 107 |
| 108 #endif // V0CustomElementProcessingStack_h | 108 #endif // V0CustomElementProcessingStack_h |
| OLD | NEW |