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

Unified Diff: Source/bindings/tests/results/V8TestSVG.cpp

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/tests/results/V8TestSVG.cpp
diff --git a/Source/bindings/tests/results/V8TestSVG.cpp b/Source/bindings/tests/results/V8TestSVG.cpp
index 0604dd33105d08d6266a9d13ba9428aabe78ac86..4c265a3761933b74b7752e72be8753752b821bf8 100644
--- a/Source/bindings/tests/results/V8TestSVG.cpp
+++ b/Source/bindings/tests/results/V8TestSVG.cpp
@@ -91,7 +91,7 @@ static void animatedReflectedAttributeAttributeGetterCallback(v8::Local<v8::Stri
static void animatedReflectedAttributeAttributeSetter(v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info)
{
TestSVG* imp = V8TestSVG::toNative(info.Holder());
- V8TRYCATCH_VOID(SVGAnimatedString*, cppValue, V8SVGAnimatedString::hasInstance(jsValue, info.GetIsolate()) ? V8SVGAnimatedString::toNative(v8::Handle<v8::Object>::Cast(jsValue)) : 0);
+ V8TRYCATCH_VOID(SVGAnimatedString*, cppValue, V8SVGAnimatedString::toNativeWithTypeCheck(info.GetIsolate(), jsValue));
CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope;
imp->setAttribute(HTMLNames::animatedreflectedattributeAttr, WTF::getPtr(cppValue));
}
@@ -120,7 +120,7 @@ static void mutablePointAttributeGetterCallback(v8::Local<v8::String>, const v8:
static void mutablePointAttributeSetter(v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info)
{
TestSVG* imp = V8TestSVG::toNative(info.Holder());
- V8TRYCATCH_VOID(SVGPointTearOff*, cppValue, V8SVGPoint::hasInstance(jsValue, info.GetIsolate()) ? V8SVGPoint::toNative(v8::Handle<v8::Object>::Cast(jsValue)) : 0);
+ V8TRYCATCH_VOID(SVGPointTearOff*, cppValue, V8SVGPoint::toNativeWithTypeCheck(info.GetIsolate(), jsValue));
imp->setMutablePoint(WTF::getPtr(cppValue));
}
@@ -147,7 +147,7 @@ static void immutablePointAttributeGetterCallback(v8::Local<v8::String>, const v
static void immutablePointAttributeSetter(v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info)
{
TestSVG* imp = V8TestSVG::toNative(info.Holder());
- V8TRYCATCH_VOID(SVGPointTearOff*, cppValue, V8SVGPoint::hasInstance(jsValue, info.GetIsolate()) ? V8SVGPoint::toNative(v8::Handle<v8::Object>::Cast(jsValue)) : 0);
+ V8TRYCATCH_VOID(SVGPointTearOff*, cppValue, V8SVGPoint::toNativeWithTypeCheck(info.GetIsolate(), jsValue));
imp->setImmutablePoint(WTF::getPtr(cppValue));
}
@@ -206,7 +206,7 @@ static void svgPointMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info
return;
}
TestSVG* imp = V8TestSVG::toNative(info.Holder());
- V8TRYCATCH_VOID(SVGPointTearOff*, item, V8SVGPoint::hasInstance(info[0], info.GetIsolate()) ? V8SVGPoint::toNative(v8::Handle<v8::Object>::Cast(info[0])) : 0);
+ V8TRYCATCH_VOID(SVGPointTearOff*, item, V8SVGPoint::toNativeWithTypeCheck(info.GetIsolate(), info[0]));
V8TRYCATCH_EXCEPTION_VOID(unsigned, index, toUInt32(info[1], exceptionState), exceptionState);
v8SetReturnValue(info, imp->svgPointMethod(item, index));
}
@@ -232,7 +232,7 @@ static void strictSVGPointMethodMethod(const v8::FunctionCallbackInfo<v8::Value>
exceptionState.throwIfNeeded();
return;
}
- V8TRYCATCH_VOID(SVGPointTearOff*, item, V8SVGPoint::hasInstance(info[0], info.GetIsolate()) ? V8SVGPoint::toNative(v8::Handle<v8::Object>::Cast(info[0])) : 0);
+ V8TRYCATCH_VOID(SVGPointTearOff*, item, V8SVGPoint::toNativeWithTypeCheck(info.GetIsolate(), info[0]));
V8TRYCATCH_EXCEPTION_VOID(unsigned, index, toUInt32(info[1], exceptionState), exceptionState);
RefPtr<SVGPointTearOff> result = imp->strictSVGPointMethod(item, index, exceptionState);
if (exceptionState.throwIfNeeded())
@@ -301,6 +301,11 @@ bool V8TestSVG::hasInstance(v8::Handle<v8::Value> jsValue, v8::Isolate* isolate)
|| V8PerIsolateData::from(isolate)->hasInstanceInNonMainWorld(&wrapperTypeInfo, jsValue);
}
+TestSVG* V8TestSVG::toNativeWithTypeCheck(v8::Isolate* isolate, v8::Handle<v8::Value> value)
+{
+ return hasInstance(value, isolate) ? fromInternalPointer(v8::Handle<v8::Object>::Cast(value)->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex)) : 0;
+}
+
v8::Handle<v8::Object> V8TestSVG::createWrapper(PassRefPtr<TestSVG> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
{
ASSERT(impl);
« no previous file with comments | « Source/bindings/tests/results/V8TestSVG.h ('k') | Source/bindings/tests/results/V8TestSpecialOperationsAnonymous.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698