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

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 477 matching lines...) Expand 10 before | Expand all | Expand 10 after
518 { 520 {
519 if (!args.IsConstructCall()) 521 if (!args.IsConstructCall())
520 return throwTypeError("DOM object constructor cannot be called as a func tion.", args.GetIsolate()); 522 return throwTypeError("DOM object constructor cannot be called as a func tion.", args.GetIsolate());
521 523
522 if (ConstructorMode::current() == ConstructorMode::WrapExistingObject) 524 if (ConstructorMode::current() == ConstructorMode::WrapExistingObject)
523 return args.Holder(); 525 return args.Holder();
524 526
525 return TestInterfaceV8Internal::constructor(args); 527 return TestInterfaceV8Internal::constructor(args);
526 } 528 }
527 529
530 v8::Handle<v8::Value> V8TestInterface::namedPropertyGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
531 {
532 if (!info.Holder()->GetRealNamedPropertyInPrototypeChain(name).IsEmpty())
533 return v8Undefined();
534 if (info.Holder()->HasRealNamedCallbackProperty(name))
535 return v8Undefined();
536
537 ASSERT(V8DOMWrapper::maybeDOMWrapper(info.Holder()));
538 TestInterface* collection = toNative(info.Holder());
539 AtomicString propertyName = toWebCoreAtomicString(name);
540 WTF::UnionType2<Node, NodeList> element = collection->getItem(propertyName);
541 if (element.isNull())
542 return v8Undefined();
543 if (element.member1())
544 return toV8Fast(element.member1(), info, collection);
545 if (element.member2())
546 return toV8Fast(element.member2(), info, collection);
547 ASSERT_NOT_REACHED();
548 return v8Undefined();
549 }
550
528 static v8::Persistent<v8::FunctionTemplate> ConfigureV8TestInterfaceTemplate(v8: :Persistent<v8::FunctionTemplate> desc, v8::Isolate* isolate, WrapperWorldType c urrentWorldType) 551 static v8::Persistent<v8::FunctionTemplate> ConfigureV8TestInterfaceTemplate(v8: :Persistent<v8::FunctionTemplate> desc, v8::Isolate* isolate, WrapperWorldType c urrentWorldType)
529 { 552 {
530 desc->ReadOnlyPrototype(); 553 desc->ReadOnlyPrototype();
531 554
532 v8::Local<v8::Signature> defaultSignature; 555 v8::Local<v8::Signature> defaultSignature;
533 defaultSignature = V8DOMConfiguration::configureTemplate(desc, "TestInterfac e", v8::Persistent<v8::FunctionTemplate>(), V8TestInterface::internalFieldCount, 556 defaultSignature = V8DOMConfiguration::configureTemplate(desc, "TestInterfac e", v8::Persistent<v8::FunctionTemplate>(), V8TestInterface::internalFieldCount,
534 V8TestInterfaceAttrs, WTF_ARRAY_LENGTH(V8TestInterfaceAttrs), 557 V8TestInterfaceAttrs, WTF_ARRAY_LENGTH(V8TestInterfaceAttrs),
535 V8TestInterfaceMethods, WTF_ARRAY_LENGTH(V8TestInterfaceMethods), isolat e, currentWorldType); 558 V8TestInterfaceMethods, WTF_ARRAY_LENGTH(V8TestInterfaceMethods), isolat e, currentWorldType);
536 UNUSED_PARAM(defaultSignature); // In some cases, it will not be used. 559 UNUSED_PARAM(defaultSignature); // In some cases, it will not be used.
537 desc->SetCallHandler(V8TestInterface::constructorCallback); 560 desc->SetCallHandler(V8TestInterface::constructorCallback);
538 desc->SetLength(1); 561 desc->SetLength(1);
539 v8::Local<v8::ObjectTemplate> instance = desc->InstanceTemplate(); 562 v8::Local<v8::ObjectTemplate> instance = desc->InstanceTemplate();
540 v8::Local<v8::ObjectTemplate> proto = desc->PrototypeTemplate(); 563 v8::Local<v8::ObjectTemplate> proto = desc->PrototypeTemplate();
541 UNUSED_PARAM(instance); // In some cases, it will not be used. 564 UNUSED_PARAM(instance); // In some cases, it will not be used.
542 UNUSED_PARAM(proto); // In some cases, it will not be used. 565 UNUSED_PARAM(proto); // In some cases, it will not be used.
543 566
544 #if ENABLE(Condition11) || ENABLE(Condition12) 567 #if ENABLE(Condition11) || ENABLE(Condition12)
545 if (RuntimeEnabledFeatures::condition13Enabled()) { 568 if (RuntimeEnabledFeatures::condition13Enabled()) {
546 static const V8DOMConfiguration::BatchedAttribute attrData =\ 569 static const V8DOMConfiguration::BatchedAttribute attrData =\
547 // Attribute 'Node13' (Type: 'attribute' ExtAttr: 'EnabledAtRuntime Cond itional ImplementedBy') 570 // Attribute 'Node13' (Type: 'attribute' ExtAttr: 'EnabledAtRuntime Cond itional ImplementedBy')
548 {"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 */}; 571 {"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 */};
549 V8DOMConfiguration::configureAttribute(instance, proto, attrData, isolat e, currentWorldType); 572 V8DOMConfiguration::configureAttribute(instance, proto, attrData, isolat e, currentWorldType);
550 } 573 }
551 574
552 #endif // ENABLE(Condition11) || ENABLE(Condition12) 575 #endif // ENABLE(Condition11) || ENABLE(Condition12)
576 desc->InstanceTemplate()->SetNamedPropertyHandler(V8TestInterface::namedProp ertyGetter, 0, 0, 0, 0);
553 577
554 // Custom Signature 'supplementalMethod2' 578 // Custom Signature 'supplementalMethod2'
555 const int supplementalMethod2Argc = 2; 579 const int supplementalMethod2Argc = 2;
556 v8::Handle<v8::FunctionTemplate> supplementalMethod2Argv[supplementalMethod2 Argc] = { v8::Handle<v8::FunctionTemplate>(), V8PerIsolateData::from(isolate)->r awTemplate(&V8TestObject::info, currentWorldType) }; 580 v8::Handle<v8::FunctionTemplate> supplementalMethod2Argv[supplementalMethod2 Argc] = { v8::Handle<v8::FunctionTemplate>(), V8PerIsolateData::from(isolate)->r awTemplate(&V8TestObject::info, currentWorldType) };
557 v8::Handle<v8::Signature> supplementalMethod2Signature = v8::Signature::New( desc, supplementalMethod2Argc, supplementalMethod2Argv); 581 v8::Handle<v8::Signature> supplementalMethod2Signature = v8::Signature::New( desc, supplementalMethod2Argc, supplementalMethod2Argv);
558 #if ENABLE(Condition11) || ENABLE(Condition12) 582 #if ENABLE(Condition11) || ENABLE(Condition12)
559 proto->Set(v8::String::NewSymbol("supplementalMethod2"), v8::FunctionTemplat e::New(TestInterfaceV8Internal::supplementalMethod2MethodCallback, v8Undefined() , supplementalMethod2Signature, 2)); 583 proto->Set(v8::String::NewSymbol("supplementalMethod2"), v8::FunctionTemplat e::New(TestInterfaceV8Internal::supplementalMethod2MethodCallback, v8Undefined() , supplementalMethod2Signature, 2));
560 #endif // ENABLE(Condition11) || ENABLE(Condition12) 584 #endif // ENABLE(Condition11) || ENABLE(Condition12)
561 #if ENABLE(Condition11) || ENABLE(Condition12) 585 #if ENABLE(Condition11) || ENABLE(Condition12)
562 desc->Set(v8::String::NewSymbol("supplementalMethod4"), v8::FunctionTemplate ::New(TestInterfaceV8Internal::supplementalMethod4MethodCallback, v8Undefined(), v8::Local<v8::Signature>(), 0)); 586 desc->Set(v8::String::NewSymbol("supplementalMethod4"), v8::FunctionTemplate ::New(TestInterfaceV8Internal::supplementalMethod4MethodCallback, v8Undefined(), v8::Local<v8::Signature>(), 0));
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
637 return wrapper; 661 return wrapper;
638 } 662 }
639 void V8TestInterface::derefObject(void* object) 663 void V8TestInterface::derefObject(void* object)
640 { 664 {
641 static_cast<TestInterface*>(object)->deref(); 665 static_cast<TestInterface*>(object)->deref();
642 } 666 }
643 667
644 } // namespace WebCore 668 } // namespace WebCore
645 669
646 #endif // ENABLE(Condition1) || ENABLE(Condition2) 670 #endif // ENABLE(Condition1) || ENABLE(Condition2)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698