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 TOOLS_BLINK_GC_PLUGIN_EDGE_H_ | 5 #ifndef TOOLS_BLINK_GC_PLUGIN_EDGE_H_ |
6 #define TOOLS_BLINK_GC_PLUGIN_EDGE_H_ | 6 #define TOOLS_BLINK_GC_PLUGIN_EDGE_H_ |
7 | 7 |
| 8 #include <cassert> |
8 #include <deque> | 9 #include <deque> |
| 10 #include <vector> |
9 | 11 |
10 #include "TracingStatus.h" | 12 #include "TracingStatus.h" |
11 | 13 |
12 class RecordInfo; | 14 class RecordInfo; |
13 | 15 |
14 class Edge; | 16 class Edge; |
15 class Value; | 17 class Value; |
16 class RawPtr; | 18 class RawPtr; |
17 class RefPtr; | 19 class RefPtr; |
18 class OwnPtr; | 20 class OwnPtr; |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 protected: | 119 protected: |
118 PtrEdge(Edge* ptr) : ptr_(ptr) { | 120 PtrEdge(Edge* ptr) : ptr_(ptr) { |
119 assert(ptr && "EdgePtr pointer must be non-null"); | 121 assert(ptr && "EdgePtr pointer must be non-null"); |
120 } | 122 } |
121 private: | 123 private: |
122 Edge* ptr_; | 124 Edge* ptr_; |
123 }; | 125 }; |
124 | 126 |
125 class RawPtr : public PtrEdge { | 127 class RawPtr : public PtrEdge { |
126 public: | 128 public: |
127 explicit RawPtr(Edge* ptr, bool is_ptr_class) | 129 RawPtr(Edge* ptr, bool is_ptr_class, bool is_ref_type) |
128 : PtrEdge(ptr), is_ptr_class_(is_ptr_class) { } | 130 : PtrEdge(ptr) |
| 131 , is_ptr_class_(is_ptr_class) |
| 132 , is_ref_type_(is_ref_type) |
| 133 { |
| 134 assert(!(is_ptr_class_ && is_ref_type_)); |
| 135 } |
| 136 |
129 bool IsRawPtr() { return true; } | 137 bool IsRawPtr() { return true; } |
130 bool IsRawPtrClass() { return is_ptr_class_; } | 138 bool IsRawPtrClass() { return is_ptr_class_; } |
131 LivenessKind Kind() { return kWeak; } | 139 LivenessKind Kind() { return kWeak; } |
132 bool NeedsFinalization() { return false; } | 140 bool NeedsFinalization() { return false; } |
133 TracingStatus NeedsTracing(NeedsTracingOption) { | 141 TracingStatus NeedsTracing(NeedsTracingOption) { |
134 return TracingStatus::Unneeded(); | 142 return TracingStatus::Unneeded(); |
135 } | 143 } |
136 void Accept(EdgeVisitor* visitor) { visitor->VisitRawPtr(this); } | 144 void Accept(EdgeVisitor* visitor) { visitor->VisitRawPtr(this); } |
| 145 |
| 146 bool HasReferenceType() { return is_ref_type_; } |
137 private: | 147 private: |
138 bool is_ptr_class_; | 148 bool is_ptr_class_; |
| 149 bool is_ref_type_; |
139 }; | 150 }; |
140 | 151 |
141 class RefPtr : public PtrEdge { | 152 class RefPtr : public PtrEdge { |
142 public: | 153 public: |
143 explicit RefPtr(Edge* ptr) : PtrEdge(ptr) { } | 154 explicit RefPtr(Edge* ptr) : PtrEdge(ptr) { } |
144 bool IsRefPtr() { return true; } | 155 bool IsRefPtr() { return true; } |
145 LivenessKind Kind() { return kStrong; } | 156 LivenessKind Kind() { return kStrong; } |
146 bool NeedsFinalization() { return true; } | 157 bool NeedsFinalization() { return true; } |
147 TracingStatus NeedsTracing(NeedsTracingOption) { | 158 TracingStatus NeedsTracing(NeedsTracingOption) { |
148 return TracingStatus::Unneeded(); | 159 return TracingStatus::Unneeded(); |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 } | 248 } |
238 | 249 |
239 private: | 250 private: |
240 RecordInfo* info_; | 251 RecordInfo* info_; |
241 Members members_; | 252 Members members_; |
242 bool on_heap_; | 253 bool on_heap_; |
243 bool is_root_; | 254 bool is_root_; |
244 }; | 255 }; |
245 | 256 |
246 #endif // TOOLS_BLINK_GC_PLUGIN_EDGE_H_ | 257 #endif // TOOLS_BLINK_GC_PLUGIN_EDGE_H_ |
OLD | NEW |