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/BlinkGC.h" | 8 #include "platform/heap/BlinkGC.h" |
9 #include "wtf/Allocator.h" | 9 #include "wtf/Allocator.h" |
10 #include "wtf/Assertions.h" | 10 #include "wtf/Assertions.h" |
11 #include "wtf/Threading.h" | 11 #include "wtf/Threading.h" |
12 #include "wtf/ThreadingPrimitives.h" | 12 #include "wtf/ThreadingPrimitives.h" |
13 | 13 |
14 namespace blink { | 14 namespace blink { |
15 | 15 |
16 // The CallbackStack contains all the visitor callbacks used to trace and mark | 16 // The CallbackStack contains all the visitor callbacks used to trace and mark |
17 // objects. A specific CallbackStack instance contains at most bufferSize elemen
ts. | 17 // objects. A specific CallbackStack instance contains at most bufferSize |
| 18 // elements. |
18 // If more space is needed a new CallbackStack instance is created and chained | 19 // If more space is needed a new CallbackStack instance is created and chained |
19 // together with the former instance. I.e. a logical CallbackStack can be made o
f | 20 // together with the former instance. I.e. a logical CallbackStack can be made |
20 // multiple chained CallbackStack object instances. | 21 // of multiple chained CallbackStack object instances. |
21 class CallbackStack final { | 22 class CallbackStack final { |
22 USING_FAST_MALLOC(CallbackStack); | 23 USING_FAST_MALLOC(CallbackStack); |
23 | 24 |
24 public: | 25 public: |
25 class Item { | 26 class Item { |
26 DISALLOW_NEW(); | 27 DISALLOW_NEW(); |
27 | 28 |
28 public: | 29 public: |
29 Item() {} | 30 Item() {} |
30 Item(void* object, VisitorCallback callback) | 31 Item(void* object, VisitorCallback callback) |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 Item* item = m_first->pop(); | 151 Item* item = m_first->pop(); |
151 if (LIKELY(!!item)) | 152 if (LIKELY(!!item)) |
152 return item; | 153 return item; |
153 | 154 |
154 return popSlow(); | 155 return popSlow(); |
155 } | 156 } |
156 | 157 |
157 } // namespace blink | 158 } // namespace blink |
158 | 159 |
159 #endif // CallbackStack_h | 160 #endif // CallbackStack_h |
OLD | NEW |