Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(261)

Unified Diff: Source/bindings/core/v8/WrapperTypeInfo.h

Issue 1340513002: bindings/oilpan: Stops using ScriptWrappable pointers already collected by GC. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/bindings/core/v8/ScriptWrappable.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « Source/bindings/core/v8/ScriptWrappable.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698