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

Unified Diff: Source/bindings/core/v8/custom/V8TypedArrayCustom.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
Index: Source/bindings/core/v8/custom/V8TypedArrayCustom.h
diff --git a/Source/bindings/core/v8/custom/V8TypedArrayCustom.h b/Source/bindings/core/v8/custom/V8TypedArrayCustom.h
index e350629398d3a82fc2922ae2c44500a746bcae72..eeb35ee10ac1aa66e21356d048be695a43cf3171 100644
--- a/Source/bindings/core/v8/custom/V8TypedArrayCustom.h
+++ b/Source/bindings/core/v8/custom/V8TypedArrayCustom.h
@@ -54,7 +54,7 @@ public:
static TypedArray* toNative(v8::Handle<v8::Object>);
static TypedArray* toNativeWithTypeCheck(v8::Isolate*, v8::Handle<v8::Value>);
- static void derefObject(void*);
+ static void derefObject(ScriptWrappableBase* internalPointer);
static const WrapperTypeInfo wrapperTypeInfo;
static const int internalFieldCount = v8DefaultWrapperInternalFieldCount;
@@ -115,9 +115,14 @@ public:
info.GetReturnValue().Set(wrapper);
}
- static inline void* toInternalPointer(TypedArray* impl)
+ static inline ScriptWrappableBase* toInternalPointer(TypedArray* impl)
{
- return impl;
+ return reinterpret_cast<ScriptWrappableBase*>(static_cast<void*>(impl));
+ }
+
+ static inline TypedArray* fromInternalPointer(ScriptWrappableBase* internalPointer)
+ {
+ return reinterpret_cast<TypedArray*>(static_cast<void*>(internalPointer));
}
private:
typedef TypedArrayTraits<TypedArray> Traits;
@@ -184,9 +189,9 @@ const WrapperTypeInfo V8TypedArray<TypedArray>::wrapperTypeInfo = {
};
template <typename TypedArray>
-void V8TypedArray<TypedArray>::derefObject(void* object)
+void V8TypedArray<TypedArray>::derefObject(ScriptWrappableBase* internalPointer)
{
- static_cast<TypedArray*>(object)->deref();
+ fromInternalPointer(internalPointer)->deref();
}
« no previous file with comments | « Source/bindings/core/v8/custom/V8MutationObserverCustom.cpp ('k') | Source/bindings/scripts/v8_interface.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698