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 // This file defines the names used by GC infrastructure. | 5 // This file defines the names used by GC infrastructure. |
6 | 6 |
7 // TODO: Restructure the name determination to use fully qualified names (ala, | 7 // TODO: Restructure the name determination to use fully qualified names (ala, |
8 // blink::Foo) so that the plugin can be enabled for all of chromium. Doing so | 8 // blink::Foo) so that the plugin can be enabled for all of chromium. Doing so |
9 // would allow us to catch errors with structures outside of blink that might | 9 // would allow us to catch errors with structures outside of blink that might |
10 // have unsafe pointers to GC allocated blink structures. | 10 // have unsafe pointers to GC allocated blink structures. |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 static bool IsGCMixinBase(const std::string& name) { | 131 static bool IsGCMixinBase(const std::string& name) { |
132 return name == "GarbageCollectedMixin"; | 132 return name == "GarbageCollectedMixin"; |
133 } | 133 } |
134 | 134 |
135 static bool IsGCFinalizedBase(const std::string& name) { | 135 static bool IsGCFinalizedBase(const std::string& name) { |
136 return name == "GarbageCollectedFinalized" || | 136 return name == "GarbageCollectedFinalized" || |
137 name == "RefCountedGarbageCollected" || | 137 name == "RefCountedGarbageCollected" || |
138 name == "ThreadSafeRefCountedGarbageCollected"; | 138 name == "ThreadSafeRefCountedGarbageCollected"; |
139 } | 139 } |
140 | 140 |
| 141 static bool IsGCRefCountedBase(const std::string& name) { |
| 142 return name == "RefCountedGarbageCollected" || |
| 143 name == "ThreadSafeRefCountedGarbageCollected"; |
| 144 } |
| 145 |
141 static bool IsGCBase(const std::string& name) { | 146 static bool IsGCBase(const std::string& name) { |
142 return name == "GarbageCollected" || | 147 return name == "GarbageCollected" || |
143 IsGCFinalizedBase(name) || | 148 IsGCFinalizedBase(name) || |
144 IsGCMixinBase(name); | 149 IsGCMixinBase(name); |
145 } | 150 } |
146 | 151 |
147 // Returns true of the base classes that do not need a vtable entry for trace | 152 // Returns true of the base classes that do not need a vtable entry for trace |
148 // because they cannot possibly initiate a GC during construction. | 153 // because they cannot possibly initiate a GC during construction. |
149 static bool IsSafePolymorphicBase(const std::string& name) { | 154 static bool IsSafePolymorphicBase(const std::string& name) { |
150 return IsGCBase(name) || IsDummyBase(name) || IsRefCountedBase(name); | 155 return IsGCBase(name) || IsDummyBase(name) || IsRefCountedBase(name); |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 if (suffix.size() > str.size()) | 268 if (suffix.size() > str.size()) |
264 return false; | 269 return false; |
265 return str.compare(str.size() - suffix.size(), suffix.size(), suffix) == 0; | 270 return str.compare(str.size() - suffix.size(), suffix.size(), suffix) == 0; |
266 } | 271 } |
267 | 272 |
268 // Test if a template specialization is an instantiation. | 273 // Test if a template specialization is an instantiation. |
269 static bool IsTemplateInstantiation(clang::CXXRecordDecl* record); | 274 static bool IsTemplateInstantiation(clang::CXXRecordDecl* record); |
270 }; | 275 }; |
271 | 276 |
272 #endif // TOOLS_BLINK_GC_PLUGIN_CONFIG_H_ | 277 #endif // TOOLS_BLINK_GC_PLUGIN_CONFIG_H_ |
OLD | NEW |