| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CallbackStack_h | 5 #ifndef CallbackStack_h |
| 6 #define CallbackStack_h | 6 #define CallbackStack_h |
| 7 | 7 |
| 8 #include "platform/heap/ThreadState.h" | 8 #include "platform/heap/ThreadState.h" |
| 9 #include "wtf/Assertions.h" | 9 #include "wtf/Assertions.h" |
| 10 | 10 |
| 11 namespace blink { | 11 namespace blink { |
| 12 | 12 |
| 13 // The CallbackStack contains all the visitor callbacks used to trace and mark | 13 // The CallbackStack contains all the visitor callbacks used to trace and mark |
| 14 // objects. A specific CallbackStack instance contains at most bufferSize elemen
ts. | 14 // objects. A specific CallbackStack instance contains at most bufferSize elemen
ts. |
| 15 // If more space is needed a new CallbackStack instance is created and chained | 15 // If more space is needed a new CallbackStack instance is created and chained |
| 16 // together with the former instance. I.e. a logical CallbackStack can be made o
f | 16 // together with the former instance. I.e. a logical CallbackStack can be made o
f |
| 17 // multiple chained CallbackStack object instances. | 17 // multiple chained CallbackStack object instances. |
| 18 class CallbackStack { | 18 class PLATFORM_EXPORT CallbackStack { |
| 19 public: | 19 public: |
| 20 class Item { | 20 class Item { |
| 21 public: | 21 public: |
| 22 Item() { } | 22 Item() { } |
| 23 Item(void* object, VisitorCallback callback) | 23 Item(void* object, VisitorCallback callback) |
| 24 : m_object(object) | 24 : m_object(object) |
| 25 , m_callback(callback) | 25 , m_callback(callback) |
| 26 { | 26 { |
| 27 } | 27 } |
| 28 void* object() { return m_object; } | 28 void* object() { return m_object; } |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 Item* item = m_first->pop(); | 134 Item* item = m_first->pop(); |
| 135 if (LIKELY(!!item)) | 135 if (LIKELY(!!item)) |
| 136 return item; | 136 return item; |
| 137 | 137 |
| 138 return popSlow(); | 138 return popSlow(); |
| 139 } | 139 } |
| 140 | 140 |
| 141 } // namespace blink | 141 } // namespace blink |
| 142 | 142 |
| 143 #endif // CallbackStack_h | 143 #endif // CallbackStack_h |
| OLD | NEW |