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/BlinkGC.h" |
9 #include "wtf/Allocator.h" | 9 #include "wtf/Allocator.h" |
10 #include "wtf/Assertions.h" | 10 #include "wtf/Assertions.h" |
11 | 11 |
12 namespace blink { | 12 namespace blink { |
13 | 13 |
14 // The CallbackStack contains all the visitor callbacks used to trace and mark | 14 // The CallbackStack contains all the visitor callbacks used to trace and mark |
15 // objects. A specific CallbackStack instance contains at most bufferSize elemen
ts. | 15 // objects. A specific CallbackStack instance contains at most bufferSize elemen
ts. |
16 // If more space is needed a new CallbackStack instance is created and chained | 16 // If more space is needed a new CallbackStack instance is created and chained |
17 // together with the former instance. I.e. a logical CallbackStack can be made o
f | 17 // together with the former instance. I.e. a logical CallbackStack can be made o
f |
18 // multiple chained CallbackStack object instances. | 18 // multiple chained CallbackStack object instances. |
(...skipping 28 matching lines...) Expand all Loading... |
47 Item* pop(); | 47 Item* pop(); |
48 | 48 |
49 bool isEmpty() const; | 49 bool isEmpty() const; |
50 | 50 |
51 void invokeEphemeronCallbacks(Visitor*); | 51 void invokeEphemeronCallbacks(Visitor*); |
52 | 52 |
53 #if ENABLE(ASSERT) | 53 #if ENABLE(ASSERT) |
54 bool hasCallbackForObject(const void*); | 54 bool hasCallbackForObject(const void*); |
55 #endif | 55 #endif |
56 | 56 |
| 57 static const size_t kMinimalBlockSize; |
| 58 |
57 private: | 59 private: |
58 static const size_t defaultBlockSize = (1 << 13); | 60 static const size_t defaultBlockSize = (1 << 13); |
59 | 61 |
60 class Block { | 62 class Block { |
61 USING_FAST_MALLOC(Block); | 63 USING_FAST_MALLOC(Block); |
62 public: | 64 public: |
63 Block(Block* next, size_t blockSize); | 65 Block(Block* next, size_t blockSize); |
64 ~Block(); | 66 ~Block(); |
65 | 67 |
66 #if ENABLE(ASSERT) | 68 #if ENABLE(ASSERT) |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 Item* item = m_first->pop(); | 132 Item* item = m_first->pop(); |
131 if (LIKELY(!!item)) | 133 if (LIKELY(!!item)) |
132 return item; | 134 return item; |
133 | 135 |
134 return popSlow(); | 136 return popSlow(); |
135 } | 137 } |
136 | 138 |
137 } // namespace blink | 139 } // namespace blink |
138 | 140 |
139 #endif // CallbackStack_h | 141 #endif // CallbackStack_h |
OLD | NEW |