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

Unified Diff: sky/engine/bindings/core/v8/V8DOMWrapper.h

Issue 683593002: Remove GarbageCollected support from the bindings (Closed) Base URL: git@github.com:domokit/mojo.git@master
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
« no previous file with comments | « sky/engine/bindings/IDLExtendedAttributes.txt ('k') | sky/engine/bindings/core/v8/WrapperTypeInfo.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/engine/bindings/core/v8/V8DOMWrapper.h
diff --git a/sky/engine/bindings/core/v8/V8DOMWrapper.h b/sky/engine/bindings/core/v8/V8DOMWrapper.h
index 63f2370caee82f06720403cefce82ea3c70fdb09..91492ba72c27d76a9013890944f68e51ddfafa63 100644
--- a/sky/engine/bindings/core/v8/V8DOMWrapper.h
+++ b/sky/engine/bindings/core/v8/V8DOMWrapper.h
@@ -60,7 +60,6 @@ public:
static v8::Handle<v8::Object> associateObjectWithWrapperNonTemplate(Node*, const WrapperTypeInfo*, v8::Handle<v8::Object>, v8::Isolate*);
static void setNativeInfo(v8::Handle<v8::Object>, const WrapperTypeInfo*, ScriptWrappableBase* internalPointer);
static void setNativeInfoForHiddenWrapper(v8::Handle<v8::Object>, const WrapperTypeInfo*, ScriptWrappableBase* internalPointer);
- static void setNativeInfoWithPersistentHandle(v8::Handle<v8::Object>, const WrapperTypeInfo*, ScriptWrappableBase* internalPointer, WrapperPersistentNode*);
static void clearNativeInfo(v8::Handle<v8::Object>, const WrapperTypeInfo*);
static bool isDOMWrapper(v8::Handle<v8::Value>);
@@ -71,11 +70,6 @@ inline void V8DOMWrapper::setNativeInfo(v8::Handle<v8::Object> wrapper, const Wr
ASSERT(wrapper->InternalFieldCount() >= 2);
ASSERT(internalPointer);
ASSERT(wrapperTypeInfo);
-#if ENABLE(OILPAN)
- ASSERT(wrapperTypeInfo->gcType == WrapperTypeInfo::RefCountedObject);
-#else
- ASSERT(wrapperTypeInfo->gcType == WrapperTypeInfo::RefCountedObject || wrapperTypeInfo->gcType == WrapperTypeInfo::WillBeGarbageCollectedObject);
-#endif
wrapper->SetAlignedPointerInInternalField(v8DOMWrapperObjectIndex, internalPointer);
wrapper->SetAlignedPointerInInternalField(v8DOMWrapperTypeIndex, const_cast<WrapperTypeInfo*>(wrapperTypeInfo));
}
@@ -86,38 +80,8 @@ inline void V8DOMWrapper::setNativeInfoForHiddenWrapper(v8::Handle<v8::Object> w
ASSERT(wrapper->InternalFieldCount() >= 2);
ASSERT(internalPointer);
ASSERT(wrapperTypeInfo);
-#if ENABLE(OILPAN)
- ASSERT(wrapperTypeInfo->gcType != WrapperTypeInfo::RefCountedObject);
-#else
- ASSERT(wrapperTypeInfo->gcType == WrapperTypeInfo::RefCountedObject || wrapperTypeInfo->gcType == WrapperTypeInfo::WillBeGarbageCollectedObject);
-#endif
-
- // Clear out the last internal field, which is assumed to contain a valid persistent pointer value.
- if (wrapperTypeInfo->gcType == WrapperTypeInfo::GarbageCollectedObject) {
- wrapper->SetAlignedPointerInInternalField(wrapper->InternalFieldCount() - 1, 0);
- } else if (wrapperTypeInfo->gcType == WrapperTypeInfo::WillBeGarbageCollectedObject) {
-#if ENABLE(OILPAN)
- wrapper->SetAlignedPointerInInternalField(wrapper->InternalFieldCount() - 1, 0);
-#endif
- }
- wrapper->SetAlignedPointerInInternalField(v8DOMWrapperObjectIndex, internalPointer);
- wrapper->SetAlignedPointerInInternalField(v8DOMWrapperTypeIndex, const_cast<WrapperTypeInfo*>(wrapperTypeInfo));
-}
-
-inline void V8DOMWrapper::setNativeInfoWithPersistentHandle(v8::Handle<v8::Object> wrapper, const WrapperTypeInfo* wrapperTypeInfo, ScriptWrappableBase* internalPointer, WrapperPersistentNode* handle)
-{
- ASSERT(wrapper->InternalFieldCount() >= 3);
- ASSERT(internalPointer);
- ASSERT(wrapperTypeInfo);
-#if ENABLE(OILPAN)
- ASSERT(wrapperTypeInfo->gcType == WrapperTypeInfo::WillBeGarbageCollectedObject || wrapperTypeInfo->gcType == WrapperTypeInfo::GarbageCollectedObject);
-#else
- ASSERT(wrapperTypeInfo->gcType == WrapperTypeInfo::GarbageCollectedObject);
-#endif
wrapper->SetAlignedPointerInInternalField(v8DOMWrapperObjectIndex, internalPointer);
wrapper->SetAlignedPointerInInternalField(v8DOMWrapperTypeIndex, const_cast<WrapperTypeInfo*>(wrapperTypeInfo));
- // Persistent handle is stored in the last internal field.
- wrapper->SetAlignedPointerInInternalField(wrapper->InternalFieldCount() - 1, handle);
}
inline void V8DOMWrapper::clearNativeInfo(v8::Handle<v8::Object> wrapper, const WrapperTypeInfo* wrapperTypeInfo)
@@ -125,7 +89,6 @@ inline void V8DOMWrapper::clearNativeInfo(v8::Handle<v8::Object> wrapper, const
ASSERT(wrapper->InternalFieldCount() >= 2);
ASSERT(wrapperTypeInfo);
// clearNativeInfo() is used only by NP objects, which are not garbage collected.
- ASSERT(wrapperTypeInfo->gcType == WrapperTypeInfo::RefCountedObject);
wrapper->SetAlignedPointerInInternalField(v8DOMWrapperTypeIndex, const_cast<WrapperTypeInfo*>(wrapperTypeInfo));
wrapper->SetAlignedPointerInInternalField(v8DOMWrapperObjectIndex, 0);
}
@@ -139,29 +102,10 @@ inline v8::Handle<v8::Object> V8DOMWrapper::associateObjectWithWrapper(PassRefPt
return wrapper;
}
-template<typename V8T, typename T>
-inline v8::Handle<v8::Object> V8DOMWrapper::associateObjectWithWrapper(T* object, const WrapperTypeInfo* wrapperTypeInfo, v8::Handle<v8::Object> wrapper, v8::Isolate* isolate)
-{
- setNativeInfoWithPersistentHandle(wrapper, wrapperTypeInfo, V8T::toScriptWrappableBase(object), new WrapperPersistent<T>(object));
- ASSERT(isDOMWrapper(wrapper));
- DOMDataStore::setWrapper<V8T>(object, wrapper, isolate, wrapperTypeInfo);
- return wrapper;
-}
-
inline v8::Handle<v8::Object> V8DOMWrapper::associateObjectWithWrapperNonTemplate(ScriptWrappable* impl, const WrapperTypeInfo* wrapperTypeInfo, v8::Handle<v8::Object> wrapper, v8::Isolate* isolate)
{
wrapperTypeInfo->refObject(impl->toScriptWrappableBase());
-#if ENABLE(OILPAN)
- if (wrapperTypeInfo->gcType == WrapperTypeInfo::RefCountedObject)
- setNativeInfo(wrapper, wrapperTypeInfo, impl->toScriptWrappableBase());
- else
- setNativeInfoWithPersistentHandle(wrapper, wrapperTypeInfo, impl->toScriptWrappableBase(), wrapperTypeInfo->createPersistentHandle(impl));
-#else
- if (wrapperTypeInfo->gcType != WrapperTypeInfo::GarbageCollectedObject)
- setNativeInfo(wrapper, wrapperTypeInfo, impl->toScriptWrappableBase());
- else
- setNativeInfoWithPersistentHandle(wrapper, wrapperTypeInfo, impl->toScriptWrappableBase(), wrapperTypeInfo->createPersistentHandle(impl));
-#endif
+ setNativeInfo(wrapper, wrapperTypeInfo, impl->toScriptWrappableBase());
ASSERT(isDOMWrapper(wrapper));
DOMDataStore::setWrapperNonTemplate(impl, wrapper, isolate, wrapperTypeInfo);
return wrapper;
@@ -170,17 +114,7 @@ inline v8::Handle<v8::Object> V8DOMWrapper::associateObjectWithWrapperNonTemplat
inline v8::Handle<v8::Object> V8DOMWrapper::associateObjectWithWrapperNonTemplate(Node* node, const WrapperTypeInfo* wrapperTypeInfo, v8::Handle<v8::Object> wrapper, v8::Isolate* isolate)
{
wrapperTypeInfo->refObject(ScriptWrappable::fromObject(node)->toScriptWrappableBase());
-#if ENABLE(OILPAN)
- if (wrapperTypeInfo->gcType == WrapperTypeInfo::RefCountedObject)
- setNativeInfo(wrapper, wrapperTypeInfo, ScriptWrappable::fromObject(node)->toScriptWrappableBase());
- else
- setNativeInfoWithPersistentHandle(wrapper, wrapperTypeInfo, ScriptWrappable::fromObject(node)->toScriptWrappableBase(), wrapperTypeInfo->createPersistentHandle(ScriptWrappable::fromObject(node)));
-#else
- if (wrapperTypeInfo->gcType != WrapperTypeInfo::GarbageCollectedObject)
- setNativeInfo(wrapper, wrapperTypeInfo, ScriptWrappable::fromObject(node)->toScriptWrappableBase());
- else
- setNativeInfoWithPersistentHandle(wrapper, wrapperTypeInfo, ScriptWrappable::fromObject(node)->toScriptWrappableBase(), wrapperTypeInfo->createPersistentHandle(ScriptWrappable::fromObject(node)));
-#endif
+ setNativeInfo(wrapper, wrapperTypeInfo, ScriptWrappable::fromObject(node)->toScriptWrappableBase());
ASSERT(isDOMWrapper(wrapper));
DOMDataStore::setWrapperNonTemplate(node, wrapper, isolate, wrapperTypeInfo);
return wrapper;
« no previous file with comments | « sky/engine/bindings/IDLExtendedAttributes.txt ('k') | sky/engine/bindings/core/v8/WrapperTypeInfo.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698