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

Side by Side Diff: Source/bindings/tests/results/V8TestInterface.cpp

Issue 15076011: Support union return type for anonymous named/indexed getter (Closed) Base URL: https://chromium.googlesource.com/chromium/blink@master
Patch Set: Created 7 years, 7 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
OLDNEW
1 /* 1 /*
2 This file is part of the Blink open source project. 2 This file is part of the Blink open source project.
3 This file has been auto-generated by CodeGeneratorV8.pm. DO NOT MODIFY! 3 This file has been auto-generated by CodeGeneratorV8.pm. DO NOT MODIFY!
4 4
5 This library is free software; you can redistribute it and/or 5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public 6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either 7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version. 8 version 2 of the License, or (at your option) any later version.
9 9
10 This library is distributed in the hope that it will be useful, 10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details. 13 Library General Public License for more details.
14 14
15 You should have received a copy of the GNU Library General Public License 15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to 16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. 18 Boston, MA 02111-1307, USA.
19 */ 19 */
20 20
21 #include "config.h" 21 #include "config.h"
22 #if ENABLE(Condition1) || ENABLE(Condition2) 22 #if ENABLE(Condition1) || ENABLE(Condition2)
23 #include "V8TestInterface.h" 23 #include "V8TestInterface.h"
24 24
25 #include "RuntimeEnabledFeatures.h" 25 #include "RuntimeEnabledFeatures.h"
26 #include "V8Node.h" 26 #include "V8Node.h"
27 #include "V8NodeList.h"
27 #include "V8TestObject.h" 28 #include "V8TestObject.h"
28 #include "bindings/bindings/tests/idls/TestPartialInterface.h" 29 #include "bindings/bindings/tests/idls/TestPartialInterface.h"
29 #include "bindings/v8/ScriptController.h" 30 #include "bindings/v8/ScriptController.h"
30 #include "bindings/v8/V8Binding.h" 31 #include "bindings/v8/V8Binding.h"
32 #include "bindings/v8/V8Collection.h"
31 #include "bindings/v8/V8DOMConfiguration.h" 33 #include "bindings/v8/V8DOMConfiguration.h"
32 #include "bindings/v8/V8DOMWrapper.h" 34 #include "bindings/v8/V8DOMWrapper.h"
33 #include "bindings/v8/V8ObjectConstructor.h" 35 #include "bindings/v8/V8ObjectConstructor.h"
34 #include "core/dom/ContextFeatures.h" 36 #include "core/dom/ContextFeatures.h"
35 #include "core/dom/Document.h" 37 #include "core/dom/Document.h"
36 #include "core/dom/ExceptionCode.h" 38 #include "core/dom/ExceptionCode.h"
37 #include "core/page/Frame.h" 39 #include "core/page/Frame.h"
38 #include "wtf/GetPtr.h" 40 #include "wtf/GetPtr.h"
39 #include "wtf/RefCounted.h" 41 #include "wtf/RefCounted.h"
40 #include "wtf/RefPtr.h" 42 #include "wtf/RefPtr.h"
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after
512 { 514 {
513 if (!args.IsConstructCall()) 515 if (!args.IsConstructCall())
514 return throwTypeError("DOM object constructor cannot be called as a func tion.", args.GetIsolate()); 516 return throwTypeError("DOM object constructor cannot be called as a func tion.", args.GetIsolate());
515 517
516 if (ConstructorMode::current() == ConstructorMode::WrapExistingObject) 518 if (ConstructorMode::current() == ConstructorMode::WrapExistingObject)
517 return args.Holder(); 519 return args.Holder();
518 520
519 return TestInterfaceV8Internal::constructor(args); 521 return TestInterfaceV8Internal::constructor(args);
520 } 522 }
521 523
524 v8::Handle<v8::Value> V8TestInterface::namedPropertyGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
525 {
526 if (!info.Holder()->GetRealNamedPropertyInPrototypeChain(name).IsEmpty())
527 return v8Undefined();
528 if (info.Holder()->HasRealNamedCallbackProperty(name))
529 return v8Undefined();
530
531 ASSERT(V8DOMWrapper::maybeDOMWrapper(info.Holder()));
532 TestInterface* collection = toNative(info.Holder());
533 AtomicString propertyName = toWebCoreAtomicString(name);
534 RefPtr<Node> elementMember1;
535 RefPtr<NodeList> elementMember2;
536 collection->getItem(propertyName, elementMember1, elementMember2);
537 if (!elementMember1 && !elementMember2)
538 return v8Undefined();
539 if (elementMember1)
540 return toV8Fast(elementMember1.release(), info, collection);
541 if (elementMember2)
542 return toV8Fast(elementMember2.release(), info, collection);
543 ASSERT_NOT_REACHED();
haraken 2013/05/17 05:44:48 Can you write this like: if (elementMember1)
544 return v8Undefined();
545 }
546
522 static v8::Persistent<v8::FunctionTemplate> ConfigureV8TestInterfaceTemplate(v8: :Persistent<v8::FunctionTemplate> desc, v8::Isolate* isolate, WrapperWorldType c urrentWorldType) 547 static v8::Persistent<v8::FunctionTemplate> ConfigureV8TestInterfaceTemplate(v8: :Persistent<v8::FunctionTemplate> desc, v8::Isolate* isolate, WrapperWorldType c urrentWorldType)
523 { 548 {
524 desc->ReadOnlyPrototype(); 549 desc->ReadOnlyPrototype();
525 550
526 v8::Local<v8::Signature> defaultSignature; 551 v8::Local<v8::Signature> defaultSignature;
527 defaultSignature = V8DOMConfiguration::configureTemplate(desc, "TestInterfac e", v8::Persistent<v8::FunctionTemplate>(), V8TestInterface::internalFieldCount, 552 defaultSignature = V8DOMConfiguration::configureTemplate(desc, "TestInterfac e", v8::Persistent<v8::FunctionTemplate>(), V8TestInterface::internalFieldCount,
528 V8TestInterfaceAttrs, WTF_ARRAY_LENGTH(V8TestInterfaceAttrs), 553 V8TestInterfaceAttrs, WTF_ARRAY_LENGTH(V8TestInterfaceAttrs),
529 V8TestInterfaceMethods, WTF_ARRAY_LENGTH(V8TestInterfaceMethods), isolat e, currentWorldType); 554 V8TestInterfaceMethods, WTF_ARRAY_LENGTH(V8TestInterfaceMethods), isolat e, currentWorldType);
530 UNUSED_PARAM(defaultSignature); // In some cases, it will not be used. 555 UNUSED_PARAM(defaultSignature); // In some cases, it will not be used.
531 desc->SetCallHandler(V8TestInterface::constructorCallback); 556 desc->SetCallHandler(V8TestInterface::constructorCallback);
532 desc->SetLength(1); 557 desc->SetLength(1);
533 v8::Local<v8::ObjectTemplate> instance = desc->InstanceTemplate(); 558 v8::Local<v8::ObjectTemplate> instance = desc->InstanceTemplate();
534 v8::Local<v8::ObjectTemplate> proto = desc->PrototypeTemplate(); 559 v8::Local<v8::ObjectTemplate> proto = desc->PrototypeTemplate();
535 UNUSED_PARAM(instance); // In some cases, it will not be used. 560 UNUSED_PARAM(instance); // In some cases, it will not be used.
536 UNUSED_PARAM(proto); // In some cases, it will not be used. 561 UNUSED_PARAM(proto); // In some cases, it will not be used.
537 562
538 #if ENABLE(Condition11) || ENABLE(Condition12) 563 #if ENABLE(Condition11) || ENABLE(Condition12)
539 if (RuntimeEnabledFeatures::condition13Enabled()) { 564 if (RuntimeEnabledFeatures::condition13Enabled()) {
540 static const V8DOMConfiguration::BatchedAttribute attrData =\ 565 static const V8DOMConfiguration::BatchedAttribute attrData =\
541 // Attribute 'Node13' (Type: 'attribute' ExtAttr: 'EnabledAtRuntime Cond itional ImplementedBy') 566 // Attribute 'Node13' (Type: 'attribute' ExtAttr: 'EnabledAtRuntime Cond itional ImplementedBy')
542 {"Node13", TestInterfaceV8Internal::Node13AttrGetterCallback, TestInterf aceV8Internal::Node13AttrSetterCallback, 0, 0, 0 /* no data */, static_cast<v8:: AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}; 567 {"Node13", TestInterfaceV8Internal::Node13AttrGetterCallback, TestInterf aceV8Internal::Node13AttrSetterCallback, 0, 0, 0 /* no data */, static_cast<v8:: AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */};
543 V8DOMConfiguration::configureAttribute(instance, proto, attrData, isolat e, currentWorldType); 568 V8DOMConfiguration::configureAttribute(instance, proto, attrData, isolat e, currentWorldType);
544 } 569 }
545 570
546 #endif // ENABLE(Condition11) || ENABLE(Condition12) 571 #endif // ENABLE(Condition11) || ENABLE(Condition12)
547 desc->InstanceTemplate()->SetNamedPropertyHandler(0, V8TestInterface::namedP ropertySetter, 0, 0, 0); 572 desc->InstanceTemplate()->SetNamedPropertyHandler(V8TestInterface::namedProp ertyGetter, V8TestInterface::namedPropertySetter, 0, 0, 0);
548 573
549 // Custom Signature 'supplementalMethod2' 574 // Custom Signature 'supplementalMethod2'
550 const int supplementalMethod2Argc = 2; 575 const int supplementalMethod2Argc = 2;
551 v8::Handle<v8::FunctionTemplate> supplementalMethod2Argv[supplementalMethod2 Argc] = { v8::Handle<v8::FunctionTemplate>(), V8PerIsolateData::from(isolate)->r awTemplate(&V8TestObject::info, currentWorldType) }; 576 v8::Handle<v8::FunctionTemplate> supplementalMethod2Argv[supplementalMethod2 Argc] = { v8::Handle<v8::FunctionTemplate>(), V8PerIsolateData::from(isolate)->r awTemplate(&V8TestObject::info, currentWorldType) };
552 v8::Handle<v8::Signature> supplementalMethod2Signature = v8::Signature::New( desc, supplementalMethod2Argc, supplementalMethod2Argv); 577 v8::Handle<v8::Signature> supplementalMethod2Signature = v8::Signature::New( desc, supplementalMethod2Argc, supplementalMethod2Argv);
553 #if ENABLE(Condition11) || ENABLE(Condition12) 578 #if ENABLE(Condition11) || ENABLE(Condition12)
554 proto->Set(v8::String::NewSymbol("supplementalMethod2"), v8::FunctionTemplat e::New(TestInterfaceV8Internal::supplementalMethod2MethodCallback, v8Undefined() , supplementalMethod2Signature, 2)); 579 proto->Set(v8::String::NewSymbol("supplementalMethod2"), v8::FunctionTemplat e::New(TestInterfaceV8Internal::supplementalMethod2MethodCallback, v8Undefined() , supplementalMethod2Signature, 2));
555 #endif // ENABLE(Condition11) || ENABLE(Condition12) 580 #endif // ENABLE(Condition11) || ENABLE(Condition12)
556 #if ENABLE(Condition11) || ENABLE(Condition12) 581 #if ENABLE(Condition11) || ENABLE(Condition12)
557 desc->Set(v8::String::NewSymbol("supplementalMethod4"), v8::FunctionTemplate ::New(TestInterfaceV8Internal::supplementalMethod4MethodCallback, v8Undefined(), v8::Local<v8::Signature>(), 0)); 582 desc->Set(v8::String::NewSymbol("supplementalMethod4"), v8::FunctionTemplate ::New(TestInterfaceV8Internal::supplementalMethod4MethodCallback, v8Undefined(), v8::Local<v8::Signature>(), 0));
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
633 return wrapper; 658 return wrapper;
634 } 659 }
635 void V8TestInterface::derefObject(void* object) 660 void V8TestInterface::derefObject(void* object)
636 { 661 {
637 static_cast<TestInterface*>(object)->deref(); 662 static_cast<TestInterface*>(object)->deref();
638 } 663 }
639 664
640 } // namespace WebCore 665 } // namespace WebCore
641 666
642 #endif // ENABLE(Condition1) || ENABLE(Condition2) 667 #endif // ENABLE(Condition1) || ENABLE(Condition2)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698