| 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 static bool IsWeakMember(const std::string& name) { | 42 static bool IsWeakMember(const std::string& name) { |
| 43 return name == "WeakMember"; | 43 return name == "WeakMember"; |
| 44 } | 44 } |
| 45 | 45 |
| 46 static bool IsMemberHandle(const std::string& name) { | 46 static bool IsMemberHandle(const std::string& name) { |
| 47 return IsMember(name) || | 47 return IsMember(name) || |
| 48 IsWeakMember(name); | 48 IsWeakMember(name); |
| 49 } | 49 } |
| 50 | 50 |
| 51 static bool IsPersistent(const std::string& name) { | 51 static bool IsPersistent(const std::string& name) { |
| 52 return name == "Persistent" || | 52 return name == "Persistent"; |
| 53 name == "WeakPersistent" ; | |
| 54 } | 53 } |
| 55 | 54 |
| 56 static bool IsCrossThreadPersistent(const std::string& name) { | 55 static bool IsPersistentHandle(const std::string& name) { |
| 57 return name == "CrossThreadPersistent" || | 56 return IsPersistent(name) || |
| 58 name == "CrossThreadWeakPersistent" ; | 57 IsPersistentGCCollection(name); |
| 59 } | 58 } |
| 60 | 59 |
| 61 static bool IsRefPtr(const std::string& name) { | 60 static bool IsRefPtr(const std::string& name) { |
| 62 return name == "RefPtr"; | 61 return name == "RefPtr"; |
| 63 } | 62 } |
| 64 | 63 |
| 65 static bool IsOwnPtr(const std::string& name) { | 64 static bool IsOwnPtr(const std::string& name) { |
| 66 return name == "OwnPtr"; | 65 return name == "OwnPtr"; |
| 67 } | 66 } |
| 68 | 67 |
| 69 static bool IsUniquePtr(const std::string& name) { | |
| 70 return name == "unique_ptr"; | |
| 71 } | |
| 72 | |
| 73 static bool IsWTFCollection(const std::string& name) { | 68 static bool IsWTFCollection(const std::string& name) { |
| 74 return name == "Vector" || | 69 return name == "Vector" || |
| 75 name == "Deque" || | 70 name == "Deque" || |
| 76 name == "HashSet" || | 71 name == "HashSet" || |
| 77 name == "ListHashSet" || | 72 name == "ListHashSet" || |
| 78 name == "LinkedHashSet" || | 73 name == "LinkedHashSet" || |
| 79 name == "HashCountedSet" || | 74 name == "HashCountedSet" || |
| 80 name == "HashMap"; | 75 name == "HashMap"; |
| 81 } | 76 } |
| 82 | 77 |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 if (suffix.size() > str.size()) | 245 if (suffix.size() > str.size()) |
| 251 return false; | 246 return false; |
| 252 return str.compare(str.size() - suffix.size(), suffix.size(), suffix) == 0; | 247 return str.compare(str.size() - suffix.size(), suffix.size(), suffix) == 0; |
| 253 } | 248 } |
| 254 | 249 |
| 255 // Test if a template specialization is an instantiation. | 250 // Test if a template specialization is an instantiation. |
| 256 static bool IsTemplateInstantiation(clang::CXXRecordDecl* record); | 251 static bool IsTemplateInstantiation(clang::CXXRecordDecl* record); |
| 257 }; | 252 }; |
| 258 | 253 |
| 259 #endif // TOOLS_BLINK_GC_PLUGIN_CONFIG_H_ | 254 #endif // TOOLS_BLINK_GC_PLUGIN_CONFIG_H_ |
| OLD | NEW |