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

Unified Diff: Source/bindings/core/v8/V8DOMWrapper.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
« no previous file with comments | « Source/bindings/core/v8/ScriptProfiler.cpp ('k') | Source/bindings/core/v8/V8DOMWrapper.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/core/v8/V8DOMWrapper.h
diff --git a/Source/bindings/core/v8/V8DOMWrapper.h b/Source/bindings/core/v8/V8DOMWrapper.h
index dc1a361ff528c46c69feb94990f8a8b083470168..725da587e19782fd9e5dc69e27c9ba67d96b6598 100644
--- a/Source/bindings/core/v8/V8DOMWrapper.h
+++ b/Source/bindings/core/v8/V8DOMWrapper.h
@@ -59,8 +59,6 @@ public:
static v8::Handle<v8::Object> associateObjectWithWrapperNonTemplate(ScriptWrappable*, const WrapperTypeInfo*, v8::Handle<v8::Object>, v8::Isolate*);
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,53 +69,8 @@ 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));
-}
-
-inline void V8DOMWrapper::setNativeInfoForHiddenWrapper(v8::Handle<v8::Object> wrapper, const WrapperTypeInfo* wrapperTypeInfo, ScriptWrappableBase* internalPointer)
-{
- // see WindowProxy::installDOMWindow() comment for why this version is needed and safe.
- 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)
@@ -142,7 +95,7 @@ inline v8::Handle<v8::Object> V8DOMWrapper::associateObjectWithWrapper(PassRefPt
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), WrapperPersistent<T>::create(object));
+ setNativeInfo(wrapper, wrapperTypeInfo, V8T::toScriptWrappableBase(object));
ASSERT(isDOMWrapper(wrapper));
DOMDataStore::setWrapper<V8T>(object, wrapper, isolate, wrapperTypeInfo);
return wrapper;
@@ -151,17 +104,7 @@ inline v8::Handle<v8::Object> V8DOMWrapper::associateObjectWithWrapper(T* object
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 +113,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 | « Source/bindings/core/v8/ScriptProfiler.cpp ('k') | Source/bindings/core/v8/V8DOMWrapper.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698