Index: Source/bindings/core/v8/WrapperTypeInfo.h |
diff --git a/Source/bindings/core/v8/WrapperTypeInfo.h b/Source/bindings/core/v8/WrapperTypeInfo.h |
index 95a1f9f58c44f40e35467986a4f1577a5100104b..41099ee67b6d8bfb216d870a7bc036217a84a834 100644 |
--- a/Source/bindings/core/v8/WrapperTypeInfo.h |
+++ b/Source/bindings/core/v8/WrapperTypeInfo.h |
@@ -126,30 +126,33 @@ struct WrapperTypeInfo { |
return domTemplateFunction(isolate); |
} |
- void refObject(ScriptWrappable* scriptWrappable) const |
+ bool isGarbageCollected() const |
{ |
- if (gcType == GarbageCollectedObject) { |
- ThreadState::current()->persistentAllocated(); |
- } else if (gcType == WillBeGarbageCollectedObject) { |
+ return (gcType == GarbageCollectedObject |
#if ENABLE(OILPAN) |
- ThreadState::current()->persistentAllocated(); |
+ || gcType == WillBeGarbageCollectedObject |
#endif |
+ ); |
+ } |
+ |
+ void refObject(ScriptWrappable* scriptWrappable) const |
+ { |
+ if (isGarbageCollected()) { |
+ ThreadState::current()->persistentAllocated(); |
+ } else { |
+ ASSERT(refObjectFunction); |
+ refObjectFunction(scriptWrappable); |
} |
- ASSERT(refObjectFunction); |
- refObjectFunction(scriptWrappable); |
} |
void derefObject(ScriptWrappable* scriptWrappable) const |
{ |
- if (gcType == GarbageCollectedObject) { |
+ if (isGarbageCollected()) { |
ThreadState::current()->persistentFreed(); |
- } else if (gcType == WillBeGarbageCollectedObject) { |
-#if ENABLE(OILPAN) |
- ThreadState::current()->persistentFreed(); |
-#endif |
+ } else { |
+ ASSERT(derefObjectFunction); |
+ derefObjectFunction(scriptWrappable); |
} |
- ASSERT(derefObjectFunction); |
- derefObjectFunction(scriptWrappable); |
} |
void trace(Visitor* visitor, ScriptWrappable* scriptWrappable) const |