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

Unified Diff: Source/bindings/v8/custom/V8TypedArrayCustom.h

Issue 171533006: V8 Binding: Introduce toNativeWithTypeCheck (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 10 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/v8/custom/V8TypedArrayCustom.h
diff --git a/Source/bindings/v8/custom/V8TypedArrayCustom.h b/Source/bindings/v8/custom/V8TypedArrayCustom.h
index 081e03ec6a49223edae71723a583bbe7546dcff2..ca15506f2003d2aee0c8d0a7cd2e4ebbceb68d91 100644
--- a/Source/bindings/v8/custom/V8TypedArrayCustom.h
+++ b/Source/bindings/v8/custom/V8TypedArrayCustom.h
@@ -53,6 +53,7 @@ public:
}
static TypedArray* toNative(v8::Handle<v8::Object>);
+ static TypedArray* toNativeWithTypeCheck(v8::Isolate*, v8::Handle<v8::Value>);
static void derefObject(void*);
static const WrapperTypeInfo wrapperTypeInfo;
static const int internalFieldCount = v8DefaultWrapperInternalFieldCount;
@@ -169,6 +170,11 @@ TypedArray* V8TypedArray<TypedArray>::toNative(v8::Handle<v8::Object> object)
return reinterpret_cast<TypedArray*>(typedarrayPtr);
}
+template <typename TypedArray>
+TypedArray* V8TypedArray<TypedArray>::toNativeWithTypeCheck(v8::Isolate* isolate, v8::Handle<v8::Value> value)
+{
+ return V8TypedArray<TypedArray>::hasInstance(value, isolate) ? V8TypedArray<TypedArray>::toNative(v8::Handle<v8::Object>::Cast(value)) : 0;
+}
template <typename TypedArray>
const WrapperTypeInfo V8TypedArray<TypedArray>::wrapperTypeInfo = {
« no previous file with comments | « Source/bindings/v8/custom/V8NodeCustom.cpp ('k') | Source/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698