Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / tools / clang / blink_gc_plugin / Config.h
index 765e32a..9341306 100644 (file)
@@ -17,6 +17,7 @@ const char kFinalizeName[] = "finalizeGarbageCollectedObject";
 const char kTraceAfterDispatchName[] = "traceAfterDispatch";
 const char kRegisterWeakMembersName[] = "registerWeakMembers";
 const char kHeapAllocatorName[] = "HeapAllocator";
+const char kTraceIfNeededName[] = "TraceIfNeeded";
 
 class Config {
  public:
@@ -91,18 +92,36 @@ class Config {
            name == "PersistentHeapHashMap";
   }
 
+  // Following http://crrev.com/369633033 (Blink r177436),
+  // ignore blink::ScriptWrappable's destructor.
+  // FIXME: remove when its non-Oilpan destructor is removed.
+  static bool HasIgnorableDestructor(const std::string& ns,
+                                     const std::string& name) {
+    return ns == "blink" && name == "ScriptWrappable";
+  }
+
   // Assumes name is a valid collection name.
   static size_t CollectionDimension(const std::string& name) {
     return (IsHashMap(name) || name == "pair") ? 2 : 1;
   }
 
+  static bool IsDummyBase(const std::string& name) {
+    return name == "DummyBase";
+  }
+
+  static bool IsRefCountedBase(const std::string& name) {
+    return name == "RefCounted" ||
+           name == "ThreadSafeRefCounted";
+  }
+
   static bool IsGCMixinBase(const std::string& name) {
     return name == "GarbageCollectedMixin";
   }
 
   static bool IsGCFinalizedBase(const std::string& name) {
     return name == "GarbageCollectedFinalized" ||
-           name == "RefCountedGarbageCollected";
+           name == "RefCountedGarbageCollected" ||
+           name == "ThreadSafeRefCountedGarbageCollected";
   }
 
   static bool IsGCBase(const std::string& name) {
@@ -111,6 +130,12 @@ class Config {
            IsGCMixinBase(name);
   }
 
+  // Returns true of the base classes that do not need a vtable entry for trace
+  // because they cannot possibly initiate a GC during construction.
+  static bool IsSafePolymorphicBase(const std::string& name) {
+    return IsGCBase(name) || IsDummyBase(name) || IsRefCountedBase(name);
+  }
+
   static bool IsAnnotated(clang::Decl* decl, const std::string& anno) {
     clang::AnnotateAttr* attr = decl->getAttr<clang::AnnotateAttr>();
     return attr && (attr->getAnnotation() == anno);
@@ -131,7 +156,7 @@ class Config {
 
   static bool IsVisitor(const std::string& name) { return name == "Visitor"; }
 
-  static bool IsTraceMethod(clang::CXXMethodDecl* method,
+  static bool IsTraceMethod(clang::FunctionDecl* method,
                             bool* isTraceAfterDispatch = 0) {
     if (method->getNumParams() != 1)
       return false;