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

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

Issue 651713002: Oilpan: DOM wrappers don't need to keep persistent handles (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 2 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
Index: Source/bindings/core/v8/WrapperTypeInfo.h
diff --git a/Source/bindings/core/v8/WrapperTypeInfo.h b/Source/bindings/core/v8/WrapperTypeInfo.h
index 864f0f7c63398929fe9cb56e0e86fc84d6581121..49715ac4b9f6e93833ae9d0e9f6b8a1a536561e3 100644
--- a/Source/bindings/core/v8/WrapperTypeInfo.h
+++ b/Source/bindings/core/v8/WrapperTypeInfo.h
@@ -51,7 +51,7 @@ static const int v8PrototypeInternalFieldcount = 1;
typedef v8::Handle<v8::FunctionTemplate> (*DomTemplateFunction)(v8::Isolate*);
typedef void (*RefObjectFunction)(ScriptWrappableBase* internalPointer);
typedef void (*DerefObjectFunction)(ScriptWrappableBase* internalPointer);
-typedef WrapperPersistentNode* (*CreatePersistentHandleFunction)(ScriptWrappableBase* internalPointer);
+typedef void (*TraceFunction)(Visitor*, ScriptWrappableBase* internalPointer);
typedef ActiveDOMObject* (*ToActiveDOMObjectFunction)(v8::Handle<v8::Object>);
typedef EventTarget* (*ToEventTargetFunction)(v8::Handle<v8::Object>);
typedef void (*ResolveWrapperReachabilityFunction)(ScriptWrappableBase* internalPointer, const v8::Persistent<v8::Object>&, v8::Isolate*);
@@ -133,10 +133,10 @@ struct WrapperTypeInfo {
derefObjectFunction(internalPointer);
}
- WrapperPersistentNode* createPersistentHandle(ScriptWrappableBase* internalPointer) const
+ void trace(Visitor* visitor, ScriptWrappableBase* internalPointer) const
{
- ASSERT(createPersistentHandleFunction);
- return createPersistentHandleFunction(internalPointer);
+ ASSERT(traceFunction);
+ return traceFunction(visitor, internalPointer);
}
void installConditionallyEnabledMethods(v8::Handle<v8::Object> prototypeTemplate, v8::Isolate* isolate) const
@@ -179,7 +179,7 @@ struct WrapperTypeInfo {
const DomTemplateFunction domTemplateFunction;
const RefObjectFunction refObjectFunction;
const DerefObjectFunction derefObjectFunction;
- const CreatePersistentHandleFunction createPersistentHandleFunction;
+ const TraceFunction traceFunction;
const ToActiveDOMObjectFunction toActiveDOMObjectFunction;
const ToEventTargetFunction toEventTargetFunction;
const ResolveWrapperReachabilityFunction visitDOMWrapperFunction;
@@ -223,32 +223,9 @@ inline const WrapperTypeInfo* toWrapperTypeInfo(v8::Handle<v8::Object> wrapper)
return getInternalField<WrapperTypeInfo, v8DOMWrapperTypeIndex>(wrapper);
}
-inline const WrapperPersistentNode* toPersistentHandle(const v8::Handle<v8::Object>& wrapper)
-{
- // Persistent handle is stored in the last internal field.
- return static_cast<WrapperPersistentNode*>(wrapper->GetAlignedPointerFromInternalField(wrapper->InternalFieldCount() - 1));
-}
-
inline void releaseObject(v8::Handle<v8::Object> wrapper)
{
- const WrapperTypeInfo* typeInfo = toWrapperTypeInfo(wrapper);
- if (typeInfo->gcType == WrapperTypeInfo::GarbageCollectedObject) {
- const WrapperPersistentNode* handle = toPersistentHandle(wrapper);
- // This will be null iff a wrapper for a hidden wrapper object,
- // see V8DOMWrapper::setNativeInfoForHiddenWrapper().
- WrapperPersistentNode::destroy(handle);
- } else if (typeInfo->gcType == WrapperTypeInfo::WillBeGarbageCollectedObject) {
-#if ENABLE(OILPAN)
- const WrapperPersistentNode* handle = toPersistentHandle(wrapper);
- // This will be null iff a wrapper for a hidden wrapper object,
- // see V8DOMWrapper::setNativeInfoForHiddenWrapper().
- WrapperPersistentNode::destroy(handle);
-#else
- typeInfo->derefObject(toScriptWrappableBase(wrapper));
-#endif
- } else {
- typeInfo->derefObject(toScriptWrappableBase(wrapper));
- }
+ toWrapperTypeInfo(wrapper)->derefObject(toScriptWrappableBase(wrapper));
}
} // namespace blink
« no previous file with comments | « Source/bindings/core/v8/WorkerScriptController.cpp ('k') | Source/bindings/core/v8/custom/V8ArrayBufferCustom.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698