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

Side by Side Diff: Source/bindings/tests/results/V8TestInterface.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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 static void implementsNodeAttributeAttributeGetterCallback(v8::Local<v8::String> , const v8::PropertyCallbackInfo<v8::Value>& info) 167 static void implementsNodeAttributeAttributeGetterCallback(v8::Local<v8::String> , const v8::PropertyCallbackInfo<v8::Value>& info)
168 { 168 {
169 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 169 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
170 TestInterfaceV8Internal::implementsNodeAttributeAttributeGetter(info); 170 TestInterfaceV8Internal::implementsNodeAttributeAttributeGetter(info);
171 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 171 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
172 } 172 }
173 173
174 static void implementsNodeAttributeAttributeSetter(v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info) 174 static void implementsNodeAttributeAttributeSetter(v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info)
175 { 175 {
176 TestInterface* imp = V8TestInterface::toNative(info.Holder()); 176 TestInterface* imp = V8TestInterface::toNative(info.Holder());
177 V8TRYCATCH_VOID(Node*, cppValue, V8Node::hasInstance(jsValue, info.GetIsolat e()) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(jsValue)) : 0); 177 V8TRYCATCH_VOID(Node*, cppValue, V8Node::toNativeWithTypeCheck(info.GetIsola te(), jsValue));
178 TestImplements::setImplementsNodeAttribute(imp, WTF::getPtr(cppValue)); 178 TestImplements::setImplementsNodeAttribute(imp, WTF::getPtr(cppValue));
179 } 179 }
180 180
181 static void implementsNodeAttributeAttributeSetterCallback(v8::Local<v8::String> , v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info) 181 static void implementsNodeAttributeAttributeSetterCallback(v8::Local<v8::String> , v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info)
182 { 182 {
183 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); 183 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
184 TestInterfaceV8Internal::implementsNodeAttributeAttributeSetter(jsValue, inf o); 184 TestInterfaceV8Internal::implementsNodeAttributeAttributeSetter(jsValue, inf o);
185 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 185 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
186 } 186 }
187 187
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 static void implementsRuntimeEnabledNodeAttributeAttributeGetterCallback(v8::Loc al<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) 222 static void implementsRuntimeEnabledNodeAttributeAttributeGetterCallback(v8::Loc al<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
223 { 223 {
224 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 224 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
225 TestInterfaceV8Internal::implementsRuntimeEnabledNodeAttributeAttributeGette r(info); 225 TestInterfaceV8Internal::implementsRuntimeEnabledNodeAttributeAttributeGette r(info);
226 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 226 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
227 } 227 }
228 228
229 static void implementsRuntimeEnabledNodeAttributeAttributeSetter(v8::Local<v8::V alue> jsValue, const v8::PropertyCallbackInfo<void>& info) 229 static void implementsRuntimeEnabledNodeAttributeAttributeSetter(v8::Local<v8::V alue> jsValue, const v8::PropertyCallbackInfo<void>& info)
230 { 230 {
231 TestInterface* imp = V8TestInterface::toNative(info.Holder()); 231 TestInterface* imp = V8TestInterface::toNative(info.Holder());
232 V8TRYCATCH_VOID(Node*, cppValue, V8Node::hasInstance(jsValue, info.GetIsolat e()) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(jsValue)) : 0); 232 V8TRYCATCH_VOID(Node*, cppValue, V8Node::toNativeWithTypeCheck(info.GetIsola te(), jsValue));
233 TestImplements::setImplementsRuntimeEnabledNodeAttribute(imp, WTF::getPtr(cp pValue)); 233 TestImplements::setImplementsRuntimeEnabledNodeAttribute(imp, WTF::getPtr(cp pValue));
234 } 234 }
235 235
236 static void implementsRuntimeEnabledNodeAttributeAttributeSetterCallback(v8::Loc al<v8::String>, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<voi d>& info) 236 static void implementsRuntimeEnabledNodeAttributeAttributeSetterCallback(v8::Loc al<v8::String>, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<voi d>& info)
237 { 237 {
238 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); 238 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
239 TestInterfaceV8Internal::implementsRuntimeEnabledNodeAttributeAttributeSette r(jsValue, info); 239 TestInterfaceV8Internal::implementsRuntimeEnabledNodeAttributeAttributeSette r(jsValue, info);
240 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 240 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
241 } 241 }
242 242
243 static void implementsPerContextEnabledNodeAttributeAttributeGetter(const v8::Pr opertyCallbackInfo<v8::Value>& info) 243 static void implementsPerContextEnabledNodeAttributeAttributeGetter(const v8::Pr opertyCallbackInfo<v8::Value>& info)
244 { 244 {
245 TestInterface* imp = V8TestInterface::toNative(info.Holder()); 245 TestInterface* imp = V8TestInterface::toNative(info.Holder());
246 v8SetReturnValueFast(info, TestImplements::implementsPerContextEnabledNodeAt tribute(imp), imp); 246 v8SetReturnValueFast(info, TestImplements::implementsPerContextEnabledNodeAt tribute(imp), imp);
247 } 247 }
248 248
249 static void implementsPerContextEnabledNodeAttributeAttributeGetterCallback(v8:: Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) 249 static void implementsPerContextEnabledNodeAttributeAttributeGetterCallback(v8:: Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
250 { 250 {
251 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 251 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
252 TestInterfaceV8Internal::implementsPerContextEnabledNodeAttributeAttributeGe tter(info); 252 TestInterfaceV8Internal::implementsPerContextEnabledNodeAttributeAttributeGe tter(info);
253 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 253 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
254 } 254 }
255 255
256 static void implementsPerContextEnabledNodeAttributeAttributeSetter(v8::Local<v8 ::Value> jsValue, const v8::PropertyCallbackInfo<void>& info) 256 static void implementsPerContextEnabledNodeAttributeAttributeSetter(v8::Local<v8 ::Value> jsValue, const v8::PropertyCallbackInfo<void>& info)
257 { 257 {
258 TestInterface* imp = V8TestInterface::toNative(info.Holder()); 258 TestInterface* imp = V8TestInterface::toNative(info.Holder());
259 V8TRYCATCH_VOID(Node*, cppValue, V8Node::hasInstance(jsValue, info.GetIsolat e()) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(jsValue)) : 0); 259 V8TRYCATCH_VOID(Node*, cppValue, V8Node::toNativeWithTypeCheck(info.GetIsola te(), jsValue));
260 TestImplements::setImplementsPerContextEnabledNodeAttribute(imp, WTF::getPtr (cppValue)); 260 TestImplements::setImplementsPerContextEnabledNodeAttribute(imp, WTF::getPtr (cppValue));
261 } 261 }
262 262
263 static void implementsPerContextEnabledNodeAttributeAttributeSetterCallback(v8:: Local<v8::String>, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo< void>& info) 263 static void implementsPerContextEnabledNodeAttributeAttributeSetterCallback(v8:: Local<v8::String>, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo< void>& info)
264 { 264 {
265 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); 265 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
266 TestInterfaceV8Internal::implementsPerContextEnabledNodeAttributeAttributeSe tter(jsValue, info); 266 TestInterfaceV8Internal::implementsPerContextEnabledNodeAttributeAttributeSe tter(jsValue, info);
267 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 267 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
268 } 268 }
269 269
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 382 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
383 TestInterfaceV8Internal::supplementalNodeAttributeGetter(info); 383 TestInterfaceV8Internal::supplementalNodeAttributeGetter(info);
384 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 384 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
385 } 385 }
386 #endif // ENABLE(CONDITION_PARTIAL) 386 #endif // ENABLE(CONDITION_PARTIAL)
387 387
388 #if ENABLE(CONDITION_PARTIAL) 388 #if ENABLE(CONDITION_PARTIAL)
389 static void supplementalNodeAttributeSetter(v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info) 389 static void supplementalNodeAttributeSetter(v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info)
390 { 390 {
391 TestInterface* imp = V8TestInterface::toNative(info.Holder()); 391 TestInterface* imp = V8TestInterface::toNative(info.Holder());
392 V8TRYCATCH_VOID(Node*, cppValue, V8Node::hasInstance(jsValue, info.GetIsolat e()) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(jsValue)) : 0); 392 V8TRYCATCH_VOID(Node*, cppValue, V8Node::toNativeWithTypeCheck(info.GetIsola te(), jsValue));
393 TestPartialInterface::setSupplementalNode(imp, WTF::getPtr(cppValue)); 393 TestPartialInterface::setSupplementalNode(imp, WTF::getPtr(cppValue));
394 } 394 }
395 #endif // ENABLE(CONDITION_PARTIAL) 395 #endif // ENABLE(CONDITION_PARTIAL)
396 396
397 #if ENABLE(CONDITION_PARTIAL) 397 #if ENABLE(CONDITION_PARTIAL)
398 static void supplementalNodeAttributeSetterCallback(v8::Local<v8::String>, v8::L ocal<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info) 398 static void supplementalNodeAttributeSetterCallback(v8::Local<v8::String>, v8::L ocal<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info)
399 { 399 {
400 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); 400 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
401 TestInterfaceV8Internal::supplementalNodeAttributeSetter(jsValue, info); 401 TestInterfaceV8Internal::supplementalNodeAttributeSetter(jsValue, info);
402 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 402 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
(...skipping 14 matching lines...) Expand all
417 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 417 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
418 TestInterfaceV8Internal::Node13AttributeGetter(info); 418 TestInterfaceV8Internal::Node13AttributeGetter(info);
419 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 419 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
420 } 420 }
421 #endif // ENABLE(CONDITION_PARTIAL) 421 #endif // ENABLE(CONDITION_PARTIAL)
422 422
423 #if ENABLE(CONDITION_PARTIAL) 423 #if ENABLE(CONDITION_PARTIAL)
424 static void Node13AttributeSetter(v8::Local<v8::Value> jsValue, const v8::Proper tyCallbackInfo<void>& info) 424 static void Node13AttributeSetter(v8::Local<v8::Value> jsValue, const v8::Proper tyCallbackInfo<void>& info)
425 { 425 {
426 TestInterface* imp = V8TestInterface::toNative(info.Holder()); 426 TestInterface* imp = V8TestInterface::toNative(info.Holder());
427 V8TRYCATCH_VOID(Node*, cppValue, V8Node::hasInstance(jsValue, info.GetIsolat e()) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(jsValue)) : 0); 427 V8TRYCATCH_VOID(Node*, cppValue, V8Node::toNativeWithTypeCheck(info.GetIsola te(), jsValue));
428 TestPartialInterface::setNode13(imp, WTF::getPtr(cppValue)); 428 TestPartialInterface::setNode13(imp, WTF::getPtr(cppValue));
429 } 429 }
430 #endif // ENABLE(CONDITION_PARTIAL) 430 #endif // ENABLE(CONDITION_PARTIAL)
431 431
432 #if ENABLE(CONDITION_PARTIAL) 432 #if ENABLE(CONDITION_PARTIAL)
433 static void Node13AttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::V alue> jsValue, const v8::PropertyCallbackInfo<void>& info) 433 static void Node13AttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::V alue> jsValue, const v8::PropertyCallbackInfo<void>& info)
434 { 434 {
435 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); 435 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
436 TestInterfaceV8Internal::Node13AttributeSetter(jsValue, info); 436 TestInterfaceV8Internal::Node13AttributeSetter(jsValue, info);
437 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 437 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
485 static void implementsComplexMethodMethod(const v8::FunctionCallbackInfo<v8::Val ue>& info) 485 static void implementsComplexMethodMethod(const v8::FunctionCallbackInfo<v8::Val ue>& info)
486 { 486 {
487 ExceptionState exceptionState(ExceptionState::ExecutionContext, "implementsC omplexMethod", "TestInterface", info.Holder(), info.GetIsolate()); 487 ExceptionState exceptionState(ExceptionState::ExecutionContext, "implementsC omplexMethod", "TestInterface", info.Holder(), info.GetIsolate());
488 if (UNLIKELY(info.Length() < 2)) { 488 if (UNLIKELY(info.Length() < 2)) {
489 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(2, i nfo.Length())); 489 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(2, i nfo.Length()));
490 exceptionState.throwIfNeeded(); 490 exceptionState.throwIfNeeded();
491 return; 491 return;
492 } 492 }
493 TestInterface* imp = V8TestInterface::toNative(info.Holder()); 493 TestInterface* imp = V8TestInterface::toNative(info.Holder());
494 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, strArg, info[0]); 494 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, strArg, info[0]);
495 V8TRYCATCH_VOID(TestInterfaceEmpty*, testInterfaceEmptyArg, V8TestInterfaceE mpty::hasInstance(info[1], info.GetIsolate()) ? V8TestInterfaceEmpty::toNative(v 8::Handle<v8::Object>::Cast(info[1])) : 0); 495 V8TRYCATCH_VOID(TestInterfaceEmpty*, testInterfaceEmptyArg, V8TestInterfaceE mpty::toNativeWithTypeCheck(info.GetIsolate(), info[1]));
496 ExecutionContext* scriptContext = currentExecutionContext(info.GetIsolate()) ; 496 ExecutionContext* scriptContext = currentExecutionContext(info.GetIsolate()) ;
497 RefPtr<TestInterfaceEmpty> result = TestImplements::implementsComplexMethod( scriptContext, imp, strArg, testInterfaceEmptyArg, exceptionState); 497 RefPtr<TestInterfaceEmpty> result = TestImplements::implementsComplexMethod( scriptContext, imp, strArg, testInterfaceEmptyArg, exceptionState);
498 if (exceptionState.throwIfNeeded()) 498 if (exceptionState.throwIfNeeded())
499 return; 499 return;
500 v8SetReturnValue(info, result.release()); 500 v8SetReturnValue(info, result.release());
501 } 501 }
502 502
503 static void implementsComplexMethodMethodCallback(const v8::FunctionCallbackInfo <v8::Value>& info) 503 static void implementsComplexMethodMethodCallback(const v8::FunctionCallbackInfo <v8::Value>& info)
504 { 504 {
505 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 505 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
547 static void supplementalMethod2Method(const v8::FunctionCallbackInfo<v8::Value>& info) 547 static void supplementalMethod2Method(const v8::FunctionCallbackInfo<v8::Value>& info)
548 { 548 {
549 ExceptionState exceptionState(ExceptionState::ExecutionContext, "supplementa lMethod2", "TestInterface", info.Holder(), info.GetIsolate()); 549 ExceptionState exceptionState(ExceptionState::ExecutionContext, "supplementa lMethod2", "TestInterface", info.Holder(), info.GetIsolate());
550 if (UNLIKELY(info.Length() < 2)) { 550 if (UNLIKELY(info.Length() < 2)) {
551 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(2, i nfo.Length())); 551 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(2, i nfo.Length()));
552 exceptionState.throwIfNeeded(); 552 exceptionState.throwIfNeeded();
553 return; 553 return;
554 } 554 }
555 TestInterface* imp = V8TestInterface::toNative(info.Holder()); 555 TestInterface* imp = V8TestInterface::toNative(info.Holder());
556 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, strArg, info[0]); 556 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, strArg, info[0]);
557 V8TRYCATCH_VOID(TestObj*, objArg, V8TestObject::hasInstance(info[1], info.Ge tIsolate()) ? V8TestObject::toNative(v8::Handle<v8::Object>::Cast(info[1])) : 0) ; 557 V8TRYCATCH_VOID(TestObj*, objArg, V8TestObject::toNativeWithTypeCheck(info.G etIsolate(), info[1]));
558 ExecutionContext* scriptContext = currentExecutionContext(info.GetIsolate()) ; 558 ExecutionContext* scriptContext = currentExecutionContext(info.GetIsolate()) ;
559 RefPtr<TestObj> result = TestPartialInterface::supplementalMethod2(scriptCon text, imp, strArg, objArg, exceptionState); 559 RefPtr<TestObj> result = TestPartialInterface::supplementalMethod2(scriptCon text, imp, strArg, objArg, exceptionState);
560 if (exceptionState.throwIfNeeded()) 560 if (exceptionState.throwIfNeeded())
561 return; 561 return;
562 v8SetReturnValue(info, result.release()); 562 v8SetReturnValue(info, result.release());
563 } 563 }
564 #endif // ENABLE(CONDITION_PARTIAL) 564 #endif // ENABLE(CONDITION_PARTIAL)
565 565
566 #if ENABLE(CONDITION_PARTIAL) 566 #if ENABLE(CONDITION_PARTIAL)
567 static void supplementalMethod2MethodCallback(const v8::FunctionCallbackInfo<v8: :Value>& info) 567 static void supplementalMethod2MethodCallback(const v8::FunctionCallbackInfo<v8: :Value>& info)
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
832 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v 8::FunctionTemplate>(isolate, templ)); 832 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v 8::FunctionTemplate>(isolate, templ));
833 return handleScope.Escape(templ); 833 return handleScope.Escape(templ);
834 } 834 }
835 835
836 bool V8TestInterface::hasInstance(v8::Handle<v8::Value> jsValue, v8::Isolate* is olate) 836 bool V8TestInterface::hasInstance(v8::Handle<v8::Value> jsValue, v8::Isolate* is olate)
837 { 837 {
838 return V8PerIsolateData::from(isolate)->hasInstanceInMainWorld(&wrapperTypeI nfo, jsValue) 838 return V8PerIsolateData::from(isolate)->hasInstanceInMainWorld(&wrapperTypeI nfo, jsValue)
839 || V8PerIsolateData::from(isolate)->hasInstanceInNonMainWorld(&wrapperTy peInfo, jsValue); 839 || V8PerIsolateData::from(isolate)->hasInstanceInNonMainWorld(&wrapperTy peInfo, jsValue);
840 } 840 }
841 841
842 TestInterface* V8TestInterface::toNativeWithTypeCheck(v8::Isolate* isolate, v8:: Handle<v8::Value> value)
843 {
844 return hasInstance(value, isolate) ? fromInternalPointer(v8::Handle<v8::Obje ct>::Cast(value)->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex)) : 0;
845 }
846
842 void V8TestInterface::installPerContextEnabledProperties(v8::Handle<v8::Object> instanceTemplate, TestInterface* impl, v8::Isolate* isolate) 847 void V8TestInterface::installPerContextEnabledProperties(v8::Handle<v8::Object> instanceTemplate, TestInterface* impl, v8::Isolate* isolate)
843 { 848 {
844 v8::Local<v8::Object> prototypeTemplate = v8::Local<v8::Object>::Cast(instan ceTemplate->GetPrototype()); 849 v8::Local<v8::Object> prototypeTemplate = v8::Local<v8::Object>::Cast(instan ceTemplate->GetPrototype());
845 if (ContextFeatures::implementsContextNameEnabled(impl->document())) { 850 if (ContextFeatures::implementsContextNameEnabled(impl->document())) {
846 static const V8DOMConfiguration::AttributeConfiguration attributeConfigu ration =\ 851 static const V8DOMConfiguration::AttributeConfiguration attributeConfigu ration =\
847 {"implementsPerContextEnabledNodeAttribute", TestInterfaceV8Internal::im plementsPerContextEnabledNodeAttributeAttributeGetterCallback, TestInterfaceV8In ternal::implementsPerContextEnabledNodeAttributeAttributeSetterCallback, 0, 0, 0 , static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute >(v8::None), 0 /* on instance */}; 852 {"implementsPerContextEnabledNodeAttribute", TestInterfaceV8Internal::im plementsPerContextEnabledNodeAttributeAttributeGetterCallback, TestInterfaceV8In ternal::implementsPerContextEnabledNodeAttributeAttributeSetterCallback, 0, 0, 0 , static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute >(v8::None), 0 /* on instance */};
848 V8DOMConfiguration::installAttribute(instanceTemplate, prototypeTemplate , attributeConfiguration, isolate); 853 V8DOMConfiguration::installAttribute(instanceTemplate, prototypeTemplate , attributeConfiguration, isolate);
849 } 854 }
850 } 855 }
851 856
(...skipping 28 matching lines...) Expand all
880 } 885 }
881 886
882 template<> 887 template<>
883 v8::Handle<v8::Value> toV8NoInline(TestInterface* impl, v8::Handle<v8::Object> c reationContext, v8::Isolate* isolate) 888 v8::Handle<v8::Value> toV8NoInline(TestInterface* impl, v8::Handle<v8::Object> c reationContext, v8::Isolate* isolate)
884 { 889 {
885 return toV8(impl, creationContext, isolate); 890 return toV8(impl, creationContext, isolate);
886 } 891 }
887 892
888 } // namespace WebCore 893 } // namespace WebCore
889 #endif // ENABLE(Condition1) || ENABLE(Condition2) 894 #endif // ENABLE(Condition1) || ENABLE(Condition2)
OLDNEW
« no previous file with comments | « Source/bindings/tests/results/V8TestInterface.h ('k') | Source/bindings/tests/results/V8TestInterfaceCheckSecurity.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698