OLD | NEW |
1 # Blink GC API reference | 1 # Blink GC API reference |
2 | 2 |
3 This document is work in progress. | 3 This document is work in progress. |
4 | 4 |
5 [TOC] | 5 [TOC] |
6 | 6 |
7 ## Header file | 7 ## Header file |
8 | 8 |
9 Unless otherwise noted, any of the primitives explained in this page requires th
e following `#include` statement: | 9 Unless otherwise noted, any of the primitives explained in this page requires th
e following `#include` statement: |
10 | 10 |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 ``` | 117 ``` |
118 | 118 |
119 Pre-finalizers have some implications on the garbage collector's performance: th
e garbage-collector needs to iterate | 119 Pre-finalizers have some implications on the garbage collector's performance: th
e garbage-collector needs to iterate |
120 all registered pre-finalizers at every GC. Therefore, a pre-finalizer should be
avoided unless it is really necessary. | 120 all registered pre-finalizers at every GC. Therefore, a pre-finalizer should be
avoided unless it is really necessary. |
121 Especially, avoid defining a pre-finalizer in a class that can be allocated a lo
t. | 121 Especially, avoid defining a pre-finalizer in a class that can be allocated a lo
t. |
122 | 122 |
123 ### EAGERLY_FINALIZE | 123 ### EAGERLY_FINALIZE |
124 | 124 |
125 ### USING_GARBAGE_COLLECTED_MIXIN | 125 ### USING_GARBAGE_COLLECTED_MIXIN |
126 | 126 |
127 ### ALLOW_ONLY_INLINE_ALLOCATION | 127 ### DISALLOW_NEW_EXCEPT_PLACEMENT_NEW |
128 | 128 |
129 ### STACK_ALLOCATED | 129 ### STACK_ALLOCATED |
130 | 130 |
131 ## Handles | 131 ## Handles |
132 | 132 |
133 Class templates in this section are smart pointers, each carrying a pointer to a
n on-heap object (think of `RefPtr<T>` | 133 Class templates in this section are smart pointers, each carrying a pointer to a
n on-heap object (think of `RefPtr<T>` |
134 for `RefCounted<T>`). Collectively, they are called *handles*. | 134 for `RefCounted<T>`). Collectively, they are called *handles*. |
135 | 135 |
136 On-heap objects must be retained by any of these, depending on the situation. | 136 On-heap objects must be retained by any of these, depending on the situation. |
137 | 137 |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 DEFINE_TRACE(C) | 304 DEFINE_TRACE(C) |
305 { | 305 { |
306 visitor->trace(m_x); | 306 visitor->trace(m_x); |
307 visitor->trace(m_y); // Weak member needs to be traced. | 307 visitor->trace(m_y); // Weak member needs to be traced. |
308 visitor->trace(m_z); // Heap collection does, too. | 308 visitor->trace(m_z); // Heap collection does, too. |
309 B::trace(visitor); // Delegate to the parent. In this case it's empty, but t
his is required. | 309 B::trace(visitor); // Delegate to the parent. In this case it's empty, but t
his is required. |
310 } | 310 } |
311 ``` | 311 ``` |
312 | 312 |
313 ## Heap collections | 313 ## Heap collections |
OLD | NEW |