OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 BlinkGC_h | 5 #ifndef BlinkGC_h |
6 #define BlinkGC_h | 6 #define BlinkGC_h |
7 | 7 |
8 // BlinkGC.h is a file that defines common things used by Blink GC. | 8 // BlinkGC.h is a file that defines common things used by Blink GC. |
9 | 9 |
10 #include "platform/PlatformExport.h" | 10 #include "platform/PlatformExport.h" |
11 #include "wtf/Allocator.h" | 11 #include "wtf/Allocator.h" |
12 | 12 |
13 namespace blink { | 13 namespace blink { |
14 | 14 |
15 class Visitor; | 15 class Visitor; |
16 | 16 |
17 #define PRINT_HEAP_STATS 0 // Enable this macro to print heap stats to stderr. | 17 #define PRINT_HEAP_STATS 0 // Enable this macro to print heap stats to stderr. |
18 | 18 |
19 using Address = uint8_t*; | 19 using Address = uint8_t*; |
20 | 20 |
21 using FinalizationCallback = void (*)(void*); | 21 using FinalizationCallback = void (*)(void*); |
22 using VisitorCallback = void (*)(Visitor*, void* self); | 22 using VisitorCallback = void (*)(Visitor*, void* self); |
23 using TraceCallback = VisitorCallback; | 23 using TraceCallback = VisitorCallback; |
24 using WeakCallback = VisitorCallback; | 24 using WeakCallback = VisitorCallback; |
25 using EphemeronCallback = VisitorCallback; | 25 using EphemeronCallback = VisitorCallback; |
26 using PreFinalizerCallback = bool (*)(void*); | 26 using PreFinalizerCallback = bool (*)(void*); |
27 | 27 |
| 28 // Simple alias to avoid heap compaction type signatures turning into |
| 29 // a sea of generic |void*|s. |
| 30 using MovableReference = void*; |
| 31 |
| 32 // Heap compaction supports registering callbacks that are to be invoked |
| 33 // when an object is moved during compaction. This is to support internal |
| 34 // location fixups that need to happen as a result. |
| 35 // |
| 36 // i.e., when the object residing at |from| is moved to |to| by the compaction |
| 37 // pass, invoke the callback to adjust any internal references that now need |
| 38 // to be |to|-relative. |
| 39 using MovingObjectCallback = void (*)(void* callbackData, |
| 40 MovableReference from, |
| 41 MovableReference to, |
| 42 size_t); |
| 43 |
28 // List of typed arenas. The list is used to generate the implementation | 44 // List of typed arenas. The list is used to generate the implementation |
29 // of typed arena related methods. | 45 // of typed arena related methods. |
30 // | 46 // |
31 // To create a new typed arena add a H(<ClassName>) to the | 47 // To create a new typed arena add a H(<ClassName>) to the |
32 // FOR_EACH_TYPED_ARENA macro below. | 48 // FOR_EACH_TYPED_ARENA macro below. |
33 #define FOR_EACH_TYPED_ARENA(H) \ | 49 #define FOR_EACH_TYPED_ARENA(H) \ |
34 H(Node) \ | 50 H(Node) \ |
35 H(CSSValue) | 51 H(CSSValue) |
36 | 52 |
37 #define TypedArenaEnumName(Type) Type##ArenaIndex, | 53 #define TypedArenaEnumName(Type) Type##ArenaIndex, |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 | 117 |
102 enum ThreadHeapMode { | 118 enum ThreadHeapMode { |
103 MainThreadHeapMode, | 119 MainThreadHeapMode, |
104 PerThreadHeapMode, | 120 PerThreadHeapMode, |
105 }; | 121 }; |
106 }; | 122 }; |
107 | 123 |
108 } // namespace blink | 124 } // namespace blink |
109 | 125 |
110 #endif | 126 #endif |
OLD | NEW |