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

Unified Diff: Source/bindings/tests/results/V8TestInterfacePython.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/V8TestInterfacePython.cpp
diff --git a/Source/bindings/tests/results/V8TestInterfacePython.cpp b/Source/bindings/tests/results/V8TestInterfacePython.cpp
index d00193c7c720aed0f223adec580435e57cda5ca3..4c3e79d47490476e7e314fdfadbc3a005545849f 100644
--- a/Source/bindings/tests/results/V8TestInterfacePython.cpp
+++ b/Source/bindings/tests/results/V8TestInterfacePython.cpp
@@ -105,7 +105,7 @@ static void testInterfacePythonAttributeAttributeSetter(v8::Local<v8::Value> jsV
return;
}
TestInterfacePythonImplementation* imp = V8TestInterfacePython::toNative(info.Holder());
- V8TRYCATCH_VOID(TestInterfacePythonImplementation*, cppValue, V8TestInterfacePython::hasInstance(jsValue, info.GetIsolate()) ? V8TestInterfacePython::toNative(v8::Handle<v8::Object>::Cast(jsValue)) : 0);
+ V8TRYCATCH_VOID(TestInterfacePythonImplementation*, cppValue, V8TestInterfacePython::toNativeWithTypeCheck(info.GetIsolate(), jsValue));
imp->setTestInterfacePythonAttribute(WTF::getPtr(cppValue));
}
@@ -294,7 +294,7 @@ static void implementsNodeAttributeAttributeSetter(v8::Local<v8::Value> jsValue,
return;
}
TestInterfacePythonImplementation* imp = V8TestInterfacePython::toNative(info.Holder());
- V8TRYCATCH_VOID(Node*, cppValue, V8Node::hasInstance(jsValue, info.GetIsolate()) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(jsValue)) : 0);
+ V8TRYCATCH_VOID(Node*, cppValue, V8Node::toNativeWithTypeCheck(info.GetIsolate(), jsValue));
TestImplements::setImplementsNodeAttribute(imp, WTF::getPtr(cppValue));
}
@@ -355,7 +355,7 @@ static void implementsRuntimeEnabledNodeAttributeAttributeSetter(v8::Local<v8::V
return;
}
TestInterfacePythonImplementation* imp = V8TestInterfacePython::toNative(info.Holder());
- V8TRYCATCH_VOID(Node*, cppValue, V8Node::hasInstance(jsValue, info.GetIsolate()) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(jsValue)) : 0);
+ V8TRYCATCH_VOID(Node*, cppValue, V8Node::toNativeWithTypeCheck(info.GetIsolate(), jsValue));
TestImplements::setImplementsRuntimeEnabledNodeAttribute(imp, WTF::getPtr(cppValue));
}
@@ -388,7 +388,7 @@ static void implementsPerContextEnabledNodeAttributeAttributeSetter(v8::Local<v8
return;
}
TestInterfacePythonImplementation* imp = V8TestInterfacePython::toNative(info.Holder());
- V8TRYCATCH_VOID(Node*, cppValue, V8Node::hasInstance(jsValue, info.GetIsolate()) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(jsValue)) : 0);
+ V8TRYCATCH_VOID(Node*, cppValue, V8Node::toNativeWithTypeCheck(info.GetIsolate(), jsValue));
TestImplements::setImplementsPerContextEnabledNodeAttribute(imp, WTF::getPtr(cppValue));
}
@@ -696,7 +696,7 @@ static void voidMethodTestInterfaceEmptyArgMethod(const v8::FunctionCallbackInfo
throwTypeError(ExceptionMessages::failedToExecute("voidMethodTestInterfaceEmptyArg", "TestInterfacePython", "parameter 1 is not of type 'TestInterfaceEmpty'."), info.GetIsolate());
return;
}
- V8TRYCATCH_VOID(TestInterfaceEmpty*, testInterfaceEmptyArg, V8TestInterfaceEmpty::hasInstance(info[0], info.GetIsolate()) ? V8TestInterfaceEmpty::toNative(v8::Handle<v8::Object>::Cast(info[0])) : 0);
+ V8TRYCATCH_VOID(TestInterfaceEmpty*, testInterfaceEmptyArg, V8TestInterfaceEmpty::toNativeWithTypeCheck(info.GetIsolate(), info[0]));
imp->voidMethodTestInterfaceEmptyArg(testInterfaceEmptyArg);
}
@@ -761,7 +761,7 @@ static void implementsComplexMethodMethod(const v8::FunctionCallbackInfo<v8::Val
exceptionState.throwIfNeeded();
return;
}
- V8TRYCATCH_VOID(TestInterfaceEmpty*, testInterfaceEmptyArg, V8TestInterfaceEmpty::hasInstance(info[1], info.GetIsolate()) ? V8TestInterfaceEmpty::toNative(v8::Handle<v8::Object>::Cast(info[1])) : 0);
+ V8TRYCATCH_VOID(TestInterfaceEmpty*, testInterfaceEmptyArg, V8TestInterfaceEmpty::toNativeWithTypeCheck(info.GetIsolate(), info[1]));
ExecutionContext* scriptContext = currentExecutionContext(info.GetIsolate());
RefPtr<TestInterfaceEmpty> result = TestImplements::implementsComplexMethod(scriptContext, imp, strArg, testInterfaceEmptyArg, exceptionState);
if (exceptionState.throwIfNeeded())
@@ -1086,6 +1086,11 @@ bool V8TestInterfacePython::hasInstance(v8::Handle<v8::Value> jsValue, v8::Isola
|| V8PerIsolateData::from(isolate)->hasInstanceInNonMainWorld(&wrapperTypeInfo, jsValue);
}
+TestInterfacePythonImplementation* V8TestInterfacePython::toNativeWithTypeCheck(v8::Isolate* isolate, v8::Handle<v8::Value> value)
+{
+ return hasInstance(value, isolate) ? fromInternalPointer(v8::Handle<v8::Object>::Cast(value)->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex)) : 0;
+}
+
void V8TestInterfacePython::installPerContextEnabledProperties(v8::Handle<v8::Object> instanceTemplate, TestInterfacePythonImplementation* impl, v8::Isolate* isolate)
{
v8::Local<v8::Object> prototypeTemplate = v8::Local<v8::Object>::Cast(instanceTemplate->GetPrototype());
« no previous file with comments | « Source/bindings/tests/results/V8TestInterfacePython.h ('k') | Source/bindings/tests/results/V8TestInterfacePython2.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698