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

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

Issue 456683002: bindings: Introduces type-check for the internal pointers. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Synced. Created 6 years, 4 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') | 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 b5c6cc97ebea2f0dcc69caa85d480c882595bebf..f442818795ef60d3a7cb9ba351016edccaabffc3 100644
--- a/Source/bindings/core/v8/V8DOMWrapper.h
+++ b/Source/bindings/core/v8/V8DOMWrapper.h
@@ -39,11 +39,12 @@
namespace blink {
+class ScriptWrappableBase;
struct WrapperTypeInfo;
class V8DOMWrapper {
public:
- static v8::Local<v8::Object> createWrapper(v8::Handle<v8::Object> creationContext, const WrapperTypeInfo*, void*, v8::Isolate*);
+ static v8::Local<v8::Object> createWrapper(v8::Handle<v8::Object> creationContext, const WrapperTypeInfo*, ScriptWrappableBase* internalPointer, v8::Isolate*);
template<typename V8T, typename T>
static inline v8::Handle<v8::Object> associateObjectWithWrapper(PassRefPtr<T>, const WrapperTypeInfo*, v8::Handle<v8::Object>, v8::Isolate*, WrapperConfiguration::Lifetime);
@@ -54,33 +55,33 @@ public:
}
template<typename V8T, typename T>
static inline v8::Handle<v8::Object> associateObjectWithWrapper(T*, const WrapperTypeInfo*, v8::Handle<v8::Object>, v8::Isolate*, WrapperConfiguration::Lifetime);
- static inline void setNativeInfo(v8::Handle<v8::Object>, const WrapperTypeInfo*, void*);
- static inline void setNativeInfoForHiddenWrapper(v8::Handle<v8::Object>, const WrapperTypeInfo*, void*);
- static inline void setNativeInfoWithPersistentHandle(v8::Handle<v8::Object>, const WrapperTypeInfo*, void*, PersistentNode*);
+ static inline void setNativeInfo(v8::Handle<v8::Object>, const WrapperTypeInfo*, ScriptWrappableBase* internalPointer);
+ static inline void setNativeInfoForHiddenWrapper(v8::Handle<v8::Object>, const WrapperTypeInfo*, ScriptWrappableBase* internalPointer);
+ static inline void setNativeInfoWithPersistentHandle(v8::Handle<v8::Object>, const WrapperTypeInfo*, ScriptWrappableBase* internalPointer, PersistentNode*);
static inline void clearNativeInfo(v8::Handle<v8::Object>, const WrapperTypeInfo*);
static bool isDOMWrapper(v8::Handle<v8::Value>);
};
-inline void V8DOMWrapper::setNativeInfo(v8::Handle<v8::Object> wrapper, const WrapperTypeInfo* wrapperTypeInfo, void* object)
+inline void V8DOMWrapper::setNativeInfo(v8::Handle<v8::Object> wrapper, const WrapperTypeInfo* wrapperTypeInfo, ScriptWrappableBase* internalPointer)
{
ASSERT(wrapper->InternalFieldCount() >= 2);
- ASSERT(object);
+ ASSERT(internalPointer);
ASSERT(wrapperTypeInfo);
#if ENABLE(OILPAN)
ASSERT(wrapperTypeInfo->gcType == RefCountedObject);
#else
ASSERT(wrapperTypeInfo->gcType == RefCountedObject || wrapperTypeInfo->gcType == WillBeGarbageCollectedObject);
#endif
- wrapper->SetAlignedPointerInInternalField(v8DOMWrapperObjectIndex, object);
+ wrapper->SetAlignedPointerInInternalField(v8DOMWrapperObjectIndex, internalPointer);
wrapper->SetAlignedPointerInInternalField(v8DOMWrapperTypeIndex, const_cast<WrapperTypeInfo*>(wrapperTypeInfo));
}
-inline void V8DOMWrapper::setNativeInfoForHiddenWrapper(v8::Handle<v8::Object> wrapper, const WrapperTypeInfo* wrapperTypeInfo, void* object)
+inline void V8DOMWrapper::setNativeInfoForHiddenWrapper(v8::Handle<v8::Object> wrapper, const WrapperTypeInfo* wrapperTypeInfo, ScriptWrappableBase* internalPointer)
{
// see V8WindowShell::installDOMWindow() comment for why this version is needed and safe.
ASSERT(wrapper->InternalFieldCount() >= 2);
- ASSERT(object);
+ ASSERT(internalPointer);
ASSERT(wrapperTypeInfo);
#if ENABLE(OILPAN)
ASSERT(wrapperTypeInfo->gcType != RefCountedObject);
@@ -96,17 +97,17 @@ inline void V8DOMWrapper::setNativeInfoForHiddenWrapper(v8::Handle<v8::Object> w
wrapper->SetAlignedPointerInInternalField(wrapper->InternalFieldCount() - 1, 0);
#endif
}
- wrapper->SetAlignedPointerInInternalField(v8DOMWrapperObjectIndex, object);
+ wrapper->SetAlignedPointerInInternalField(v8DOMWrapperObjectIndex, internalPointer);
wrapper->SetAlignedPointerInInternalField(v8DOMWrapperTypeIndex, const_cast<WrapperTypeInfo*>(wrapperTypeInfo));
}
-inline void V8DOMWrapper::setNativeInfoWithPersistentHandle(v8::Handle<v8::Object> wrapper, const WrapperTypeInfo* wrapperTypeInfo, void* object, PersistentNode* handle)
+inline void V8DOMWrapper::setNativeInfoWithPersistentHandle(v8::Handle<v8::Object> wrapper, const WrapperTypeInfo* wrapperTypeInfo, ScriptWrappableBase* internalPointer, PersistentNode* handle)
{
ASSERT(wrapper->InternalFieldCount() >= 3);
- ASSERT(object);
+ ASSERT(internalPointer);
ASSERT(wrapperTypeInfo);
ASSERT(wrapperTypeInfo->gcType != RefCountedObject);
- wrapper->SetAlignedPointerInInternalField(v8DOMWrapperObjectIndex, object);
+ 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);
« no previous file with comments | « Source/bindings/core/v8/ScriptWrappable.h ('k') | Source/bindings/core/v8/V8DOMWrapper.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698