Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # Copyright (C) 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org> | 1 # Copyright (C) 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org> |
| 2 # Copyright (C) 2006 Anders Carlsson <andersca@mac.com> | 2 # Copyright (C) 2006 Anders Carlsson <andersca@mac.com> |
| 3 # Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> | 3 # Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> |
| 4 # Copyright (C) 2006 Alexey Proskuryakov <ap@webkit.org> | 4 # Copyright (C) 2006 Alexey Proskuryakov <ap@webkit.org> |
| 5 # Copyright (C) 2006 Apple Computer, Inc. | 5 # Copyright (C) 2006 Apple Computer, Inc. |
| 6 # Copyright (C) 2007, 2008, 2009, 2012 Google Inc. | 6 # Copyright (C) 2007, 2008, 2009, 2012 Google Inc. |
| 7 # Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au> | 7 # Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au> |
| 8 # Copyright (C) Research In Motion Limited 2010. All rights reserved. | 8 # Copyright (C) Research In Motion Limited 2010. All rights reserved. |
| 9 # Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) | 9 # Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) |
| 10 # Copyright (C) 2012 Ericsson AB. All rights reserved. | 10 # Copyright (C) 2012 Ericsson AB. All rights reserved. |
| (...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 484 my $implClassName = GetImplName($interface); | 484 my $implClassName = GetImplName($interface); |
| 485 my $v8ClassName = GetV8ClassName($interface); | 485 my $v8ClassName = GetV8ClassName($interface); |
| 486 | 486 |
| 487 if ($interface->extendedAttributes->{"CustomIsReachable"}) { | 487 if ($interface->extendedAttributes->{"CustomIsReachable"}) { |
| 488 return; | 488 return; |
| 489 } | 489 } |
| 490 | 490 |
| 491 my $code = <<END; | 491 my $code = <<END; |
| 492 void* ${v8ClassName}::opaqueRootForGC(void* object, v8::Isolate* isolate) | 492 void* ${v8ClassName}::opaqueRootForGC(void* object, v8::Isolate* isolate) |
| 493 { | 493 { |
| 494 ${implClassName}* impl = static_cast<${implClassName}*>(object); | 494 ${implClassName}* impl = fromWrappedType(object); |
| 495 END | 495 END |
| 496 my $isReachableMethod = $interface->extendedAttributes->{"GenerateIsReachabl e"}; | 496 my $isReachableMethod = $interface->extendedAttributes->{"GenerateIsReachabl e"}; |
| 497 if ($isReachableMethod) { | 497 if ($isReachableMethod) { |
| 498 AddToImplIncludes("bindings/v8/V8GCController.h"); | 498 AddToImplIncludes("bindings/v8/V8GCController.h"); |
| 499 AddToImplIncludes("core/dom/Element.h"); | 499 AddToImplIncludes("core/dom/Element.h"); |
| 500 $code .= <<END; | 500 $code .= <<END; |
| 501 if (Node* owner = impl->${isReachableMethod}()) | 501 if (Node* owner = impl->${isReachableMethod}()) |
| 502 return V8GCController::opaqueRootForGC(owner, isolate); | 502 return V8GCController::opaqueRootForGC(owner, isolate); |
| 503 END | 503 END |
| 504 } | 504 } |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 662 | 662 |
| 663 $header{class}->addHeader("class $v8ClassName {"); | 663 $header{class}->addHeader("class $v8ClassName {"); |
| 664 $header{class}->addFooter("};"); | 664 $header{class}->addFooter("};"); |
| 665 | 665 |
| 666 $header{classPublic}->add(<<END); | 666 $header{classPublic}->add(<<END); |
| 667 static bool HasInstance(v8::Handle<v8::Value>, v8::Isolate*, WrapperWorldTyp e); | 667 static bool HasInstance(v8::Handle<v8::Value>, v8::Isolate*, WrapperWorldTyp e); |
| 668 static bool HasInstanceInAnyWorld(v8::Handle<v8::Value>, v8::Isolate*); | 668 static bool HasInstanceInAnyWorld(v8::Handle<v8::Value>, v8::Isolate*); |
| 669 static v8::Handle<v8::FunctionTemplate> GetTemplate(v8::Isolate*, WrapperWor ldType); | 669 static v8::Handle<v8::FunctionTemplate> GetTemplate(v8::Isolate*, WrapperWor ldType); |
| 670 static ${nativeType}* toNative(v8::Handle<v8::Object> object) | 670 static ${nativeType}* toNative(v8::Handle<v8::Object> object) |
| 671 { | 671 { |
| 672 return reinterpret_cast<${nativeType}*>(object->GetAlignedPointerFromInt ernalField(v8DOMWrapperObjectIndex)); | 672 return fromWrappedType(object->GetAlignedPointerFromInternalField(v8DOMW rapperObjectIndex)); |
| 673 } | 673 } |
| 674 static void derefObject(void*); | 674 static void derefObject(void*); |
| 675 static WrapperTypeInfo info; | 675 static WrapperTypeInfo info; |
| 676 END | 676 END |
| 677 | 677 |
| 678 if (NeedsOpaqueRootForGC($interface)) { | 678 if (NeedsOpaqueRootForGC($interface)) { |
| 679 $header{classPublic}->add(" static void* opaqueRootForGC(void*, v8::I solate*);\n"); | 679 $header{classPublic}->add(" static void* opaqueRootForGC(void*, v8::I solate*);\n"); |
| 680 } | 680 } |
| 681 | 681 |
| 682 if (InheritsExtendedAttribute($interface, "ActiveDOMObject")) { | 682 if (InheritsExtendedAttribute($interface, "ActiveDOMObject")) { |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 741 } | 741 } |
| 742 if ($attrExt->{"EnabledPerContext"}) { | 742 if ($attrExt->{"EnabledPerContext"}) { |
| 743 push(@enabledPerContextAttributes, $attribute); | 743 push(@enabledPerContextAttributes, $attribute); |
| 744 } | 744 } |
| 745 } | 745 } |
| 746 | 746 |
| 747 GenerateHeaderNamedAndIndexedPropertyAccessors($interface); | 747 GenerateHeaderNamedAndIndexedPropertyAccessors($interface); |
| 748 GenerateHeaderLegacyCall($interface); | 748 GenerateHeaderLegacyCall($interface); |
| 749 GenerateHeaderCustomInternalFieldIndices($interface); | 749 GenerateHeaderCustomInternalFieldIndices($interface); |
| 750 | 750 |
| 751 $header{classPublic}->add(<<END); | |
| 752 static inline void* toWrappedType(${nativeType}* impl) | |
| 753 { | |
| 754 END | |
| 755 if ($interface->parent) { | |
| 756 my $v8ParentClassName = "V8" . $interface->parent; | |
| 757 $header{classPublic}->add(" return ${v8ParentClassName}::toWr appedType(impl);\n"); | |
|
arv (Not doing code reviews)
2013/07/08 15:51:46
How about storing the return expression in a varia
| |
| 758 } else { | |
| 759 $header{classPublic}->add(" return impl;\n"); | |
| 760 } | |
| 761 $header{classPublic}->add(<<END); | |
| 762 } | |
| 763 | |
| 764 static inline ${nativeType}* fromWrappedType(void* object) | |
| 765 { | |
| 766 END | |
| 767 if ($interface->parent) { | |
| 768 my $v8ParentClassName = "V8" . $interface->parent; | |
| 769 $header{classPublic}->add(" return static_cast<${nativeType}* >(${v8ParentClassName}::fromWrappedType(object));\n"); | |
|
arv (Not doing code reviews)
2013/07/08 15:51:46
same here, extract the argument to a variable.
| |
| 770 } else { | |
| 771 $header{classPublic}->add(" return static_cast<${nativeType}* >(object);\n"); | |
| 772 } | |
| 773 $header{classPublic}->add(<<END); | |
| 774 } | |
| 775 END | |
| 776 | |
| 751 if ($interface->name eq "Window") { | 777 if ($interface->name eq "Window") { |
| 752 $header{classPublic}->add(<<END); | 778 $header{classPublic}->add(<<END); |
| 753 static bool namedSecurityCheckCustom(v8::Local<v8::Object> host, v8::Local<v 8::Value> key, v8::AccessType, v8::Local<v8::Value> data); | 779 static bool namedSecurityCheckCustom(v8::Local<v8::Object> host, v8::Local<v 8::Value> key, v8::AccessType, v8::Local<v8::Value> data); |
| 754 static bool indexedSecurityCheckCustom(v8::Local<v8::Object> host, uint32_t index, v8::AccessType, v8::Local<v8::Value> data); | 780 static bool indexedSecurityCheckCustom(v8::Local<v8::Object> host, uint32_t index, v8::AccessType, v8::Local<v8::Value> data); |
| 755 END | 781 END |
| 756 } | 782 } |
| 757 | 783 |
| 758 if (@enabledPerContextAttributes) { | 784 if (@enabledPerContextAttributes) { |
| 759 $header{classPublic}->add(<<END); | 785 $header{classPublic}->add(<<END); |
| 760 static void installPerContextProperties(v8::Handle<v8::Object>, ${nativeType }*, v8::Isolate*); | 786 static void installPerContextProperties(v8::Handle<v8::Object>, ${nativeType }*, v8::Isolate*); |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 847 $header{nameSpaceWebCore}->add(<<END); | 873 $header{nameSpaceWebCore}->add(<<END); |
| 848 | 874 |
| 849 v8::Handle<v8::Object> wrap(${nativeType}* impl, v8::Handle<v8::Object> creation Context, v8::Isolate*); | 875 v8::Handle<v8::Object> wrap(${nativeType}* impl, v8::Handle<v8::Object> creation Context, v8::Isolate*); |
| 850 END | 876 END |
| 851 } else { | 877 } else { |
| 852 $header{nameSpaceWebCore}->add(<<END); | 878 $header{nameSpaceWebCore}->add(<<END); |
| 853 | 879 |
| 854 inline v8::Handle<v8::Object> wrap(${nativeType}* impl, v8::Handle<v8::Object> c reationContext, v8::Isolate* isolate) | 880 inline v8::Handle<v8::Object> wrap(${nativeType}* impl, v8::Handle<v8::Object> c reationContext, v8::Isolate* isolate) |
| 855 { | 881 { |
| 856 ASSERT(impl); | 882 ASSERT(impl); |
| 857 ASSERT(DOMDataStore::getWrapper(impl, isolate).IsEmpty()); | 883 ASSERT(DOMDataStore::getWrapper<${v8ClassName}>(impl, isolate).IsEmpty()); |
| 858 if (ScriptWrappable::wrapperCanBeStoredInObject(impl)) { | 884 if (ScriptWrappable::wrapperCanBeStoredInObject(impl)) { |
| 859 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje ct(impl); | 885 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje ct(impl); |
| 860 // Might be a XXXConstructor::info instead of an XXX::info. These will b oth have | 886 // Might be a XXXConstructor::info instead of an XXX::info. These will b oth have |
| 861 // the same object de-ref functions, though, so use that as the basis of the check. | 887 // the same object de-ref functions, though, so use that as the basis of the check. |
| 862 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction == ${v8ClassName}::info.derefObjectFunction); | 888 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction == ${v8ClassName}::info.derefObjectFunction); |
| 863 } | 889 } |
| 864 return $createWrapperCall(impl, creationContext, isolate); | 890 return $createWrapperCall(impl, creationContext, isolate); |
| 865 } | 891 } |
| 866 END | 892 END |
| 867 } | 893 } |
| 868 | 894 |
| 869 $header{nameSpaceWebCore}->add(<<END); | 895 $header{nameSpaceWebCore}->add(<<END); |
| 870 | 896 |
| 871 inline v8::Handle<v8::Value> toV8(${nativeType}* impl, v8::Handle<v8::Object> cr eationContext, v8::Isolate* isolate) | 897 inline v8::Handle<v8::Value> toV8(${nativeType}* impl, v8::Handle<v8::Object> cr eationContext, v8::Isolate* isolate) |
| 872 { | 898 { |
| 873 if (UNLIKELY(!impl)) | 899 if (UNLIKELY(!impl)) |
| 874 return v8NullWithCheck(isolate); | 900 return v8NullWithCheck(isolate); |
| 875 v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapper(impl, isolate); | 901 v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapper<${v8ClassName}>(imp l, isolate); |
| 876 if (!wrapper.IsEmpty()) | 902 if (!wrapper.IsEmpty()) |
| 877 return wrapper; | 903 return wrapper; |
| 878 return wrap(impl, creationContext, isolate); | 904 return wrap(impl, creationContext, isolate); |
| 879 } | 905 } |
| 880 | 906 |
| 881 inline v8::Handle<v8::Value> toV8ForMainWorld(${nativeType}* impl, v8::Handle<v8 ::Object> creationContext, v8::Isolate* isolate) | 907 inline v8::Handle<v8::Value> toV8ForMainWorld(${nativeType}* impl, v8::Handle<v8 ::Object> creationContext, v8::Isolate* isolate) |
| 882 { | 908 { |
| 883 ASSERT(worldType(isolate) == MainWorld); | 909 ASSERT(worldType(isolate) == MainWorld); |
| 884 if (UNLIKELY(!impl)) | 910 if (UNLIKELY(!impl)) |
| 885 return v8NullWithCheck(isolate); | 911 return v8NullWithCheck(isolate); |
| 886 v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapperForMainWorld(impl); | 912 v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapperForMainWorld<${v8Cla ssName}>(impl); |
| 887 if (!wrapper.IsEmpty()) | 913 if (!wrapper.IsEmpty()) |
| 888 return wrapper; | 914 return wrapper; |
| 889 return wrap(impl, creationContext, isolate); | 915 return wrap(impl, creationContext, isolate); |
| 890 } | 916 } |
| 891 | 917 |
| 892 template<class HolderContainer, class Wrappable> | 918 template<class HolderContainer, class Wrappable> |
| 893 inline v8::Handle<v8::Value> toV8Fast(${nativeType}* impl, const HolderContainer & container, Wrappable* wrappable) | 919 inline v8::Handle<v8::Value> toV8Fast(${nativeType}* impl, const HolderContainer & container, Wrappable* wrappable) |
| 894 { | 920 { |
| 895 if (UNLIKELY(!impl)) | 921 if (UNLIKELY(!impl)) |
| 896 return v8::Null(container.GetIsolate()); | 922 return v8::Null(container.GetIsolate()); |
| 897 v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperFast(impl, containe r, wrappable); | 923 v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperFast<${v8ClassName} >(impl, container, wrappable); |
| 898 if (!wrapper.IsEmpty()) | 924 if (!wrapper.IsEmpty()) |
| 899 return wrapper; | 925 return wrapper; |
| 900 return wrap(impl, container.Holder(), container.GetIsolate()); | 926 return wrap(impl, container.Holder(), container.GetIsolate()); |
| 901 } | 927 } |
| 902 | 928 |
| 903 template<class HolderContainer, class Wrappable> | 929 template<class HolderContainer, class Wrappable> |
| 904 inline v8::Handle<v8::Value> toV8FastForMainWorld(${nativeType}* impl, const Hol derContainer& container, Wrappable* wrappable) | 930 inline v8::Handle<v8::Value> toV8FastForMainWorld(${nativeType}* impl, const Hol derContainer& container, Wrappable* wrappable) |
| 905 { | 931 { |
| 906 ASSERT(worldType(container.GetIsolate()) == MainWorld); | 932 ASSERT(worldType(container.GetIsolate()) == MainWorld); |
| 907 if (UNLIKELY(!impl)) | 933 if (UNLIKELY(!impl)) |
| 908 return v8::Null(container.GetIsolate()); | 934 return v8::Null(container.GetIsolate()); |
| 909 v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperForMainWorld(impl); | 935 v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperForMainWorld<${v8Cl assName}>(impl); |
| 910 if (!wrapper.IsEmpty()) | 936 if (!wrapper.IsEmpty()) |
| 911 return wrapper; | 937 return wrapper; |
| 912 return wrap(impl, container.Holder(), container.GetIsolate()); | 938 return wrap(impl, container.Holder(), container.GetIsolate()); |
| 913 } | 939 } |
| 914 | 940 |
| 915 template<class HolderContainer, class Wrappable> | 941 template<class HolderContainer, class Wrappable> |
| 916 inline v8::Handle<v8::Value> toV8FastForMainWorld(PassRefPtr< ${nativeType} > im pl, const HolderContainer& container, Wrappable* wrappable) | 942 inline v8::Handle<v8::Value> toV8FastForMainWorld(PassRefPtr< ${nativeType} > im pl, const HolderContainer& container, Wrappable* wrappable) |
| 917 { | 943 { |
| 918 return toV8FastForMainWorld(impl.get(), container, wrappable); | 944 return toV8FastForMainWorld(impl.get(), container, wrappable); |
| 919 } | 945 } |
| (...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1507 $code .= "}\n\n"; | 1533 $code .= "}\n\n"; |
| 1508 $implementation{nameSpaceInternal}->add($code); | 1534 $implementation{nameSpaceInternal}->add($code); |
| 1509 return; | 1535 return; |
| 1510 } | 1536 } |
| 1511 | 1537 |
| 1512 AddIncludesForType($returnType); | 1538 AddIncludesForType($returnType); |
| 1513 AddToImplIncludes("bindings/v8/V8HiddenPropertyName.h"); | 1539 AddToImplIncludes("bindings/v8/V8HiddenPropertyName.h"); |
| 1514 # Check for a wrapper in the wrapper cache. If there is one, we know tha t a hidden reference has already | 1540 # Check for a wrapper in the wrapper cache. If there is one, we know tha t a hidden reference has already |
| 1515 # been created. If we don't find a wrapper, we create both a wrapper and a hidden reference. | 1541 # been created. If we don't find a wrapper, we create both a wrapper and a hidden reference. |
| 1516 my $nativeReturnType = GetNativeType($returnType); | 1542 my $nativeReturnType = GetNativeType($returnType); |
| 1543 my $v8ReturnType = "V8" . $returnType; | |
| 1517 $code .= " $nativeReturnType result = ${getterString};\n"; | 1544 $code .= " $nativeReturnType result = ${getterString};\n"; |
| 1518 if ($forMainWorldSuffix) { | 1545 if ($forMainWorldSuffix) { |
| 1519 $code .= " v8::Handle<v8::Value> wrapper = result.get() ? v8::Handl e<v8::Value>(DOMDataStore::getWrapper${forMainWorldSuffix}(result.get())) : v8Un defined();\n"; | 1546 $code .= " v8::Handle<v8::Value> wrapper = result.get() ? v8::Handl e<v8::Value>(DOMDataStore::getWrapper${forMainWorldSuffix}<${v8ReturnType}>(resu lt.get())) : v8Undefined();\n"; |
| 1520 } else { | 1547 } else { |
| 1521 $code .= " v8::Handle<v8::Value> wrapper = result.get() ? v8::Handl e<v8::Value>(DOMDataStore::getWrapper(result.get(), info.GetIsolate())) : v8Unde fined();\n"; | 1548 $code .= " v8::Handle<v8::Value> wrapper = result.get() ? v8::Handl e<v8::Value>(DOMDataStore::getWrapper<${v8ReturnType}>(result.get(), info.GetIso late())) : v8Undefined();\n"; |
| 1522 } | 1549 } |
| 1523 $code .= " if (wrapper.IsEmpty()) {\n"; | 1550 $code .= " if (wrapper.IsEmpty()) {\n"; |
| 1524 $code .= " wrapper = toV8(result.get(), info.Holder(), info.GetIs olate());\n"; # FIXME: Could use wrap here since the wrapper is empty. | 1551 $code .= " wrapper = toV8(result.get(), info.Holder(), info.GetIs olate());\n"; # FIXME: Could use wrap here since the wrapper is empty. |
| 1525 $code .= " if (!wrapper.IsEmpty())\n"; | 1552 $code .= " if (!wrapper.IsEmpty())\n"; |
| 1526 $code .= " V8HiddenPropertyName::setNamedHiddenReference(info .Holder(), \"${attrName}\", wrapper);\n"; | 1553 $code .= " V8HiddenPropertyName::setNamedHiddenReference(info .Holder(), \"${attrName}\", wrapper);\n"; |
| 1527 $code .= " }\n"; | 1554 $code .= " }\n"; |
| 1528 $code .= " v8SetReturnValue(info, wrapper);\n"; | 1555 $code .= " v8SetReturnValue(info, wrapper);\n"; |
| 1529 $code .= " return;\n"; | 1556 $code .= " return;\n"; |
| 1530 $code .= "}\n\n"; | 1557 $code .= "}\n\n"; |
| 1531 $code .= "#endif // ${conditionalString}\n\n" if $conditionalString; | 1558 $code .= "#endif // ${conditionalString}\n\n" if $conditionalString; |
| (...skipping 1030 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2562 | 2589 |
| 2563 if ($interface->extendedAttributes->{"ConstructorRaisesException"}) { | 2590 if ($interface->extendedAttributes->{"ConstructorRaisesException"}) { |
| 2564 $code .= " if (ec) {\n"; | 2591 $code .= " if (ec) {\n"; |
| 2565 $code .= " setDOMException(ec, args.GetIsolate());\n"; | 2592 $code .= " setDOMException(ec, args.GetIsolate());\n"; |
| 2566 $code .= " return;\n"; | 2593 $code .= " return;\n"; |
| 2567 $code .= " }\n"; | 2594 $code .= " }\n"; |
| 2568 } | 2595 } |
| 2569 | 2596 |
| 2570 $code .= <<END; | 2597 $code .= <<END; |
| 2571 | 2598 |
| 2572 V8DOMWrapper::associateObjectWithWrapper(impl.release(), &${v8ClassName}::in fo, wrapper, args.GetIsolate(), WrapperConfiguration::Dependent); | 2599 V8DOMWrapper::associateObjectWithWrapper<${v8ClassName}>(impl.release(), &${ v8ClassName}::info, wrapper, args.GetIsolate(), WrapperConfiguration::Dependent) ; |
| 2573 args.GetReturnValue().Set(wrapper); | 2600 args.GetReturnValue().Set(wrapper); |
| 2574 } | 2601 } |
| 2575 | 2602 |
| 2576 END | 2603 END |
| 2577 $implementation{nameSpaceInternal}->add($code); | 2604 $implementation{nameSpaceInternal}->add($code); |
| 2578 } | 2605 } |
| 2579 | 2606 |
| 2580 # The Web IDL specification states that Interface objects for interfaces MUST ha ve a property named | 2607 # The Web IDL specification states that Interface objects for interfaces MUST ha ve a property named |
| 2581 # "length" that returns the length of the shortest argument list of the entries in the effective | 2608 # "length" that returns the length of the shortest argument list of the entries in the effective |
| 2582 # overload set for constructors. In other words, use the lowest number of mandat ory arguments among | 2609 # overload set for constructors. In other words, use the lowest number of mandat ory arguments among |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2656 ${implClassName}Init eventInit; | 2683 ${implClassName}Init eventInit; |
| 2657 if (args.Length() >= 2) { | 2684 if (args.Length() >= 2) { |
| 2658 V8TRYCATCH_VOID(Dictionary, options, Dictionary(args[1], args.GetIsolate ())); | 2685 V8TRYCATCH_VOID(Dictionary, options, Dictionary(args[1], args.GetIsolate ())); |
| 2659 if (!fill${implClassName}Init(eventInit, options)) | 2686 if (!fill${implClassName}Init(eventInit, options)) |
| 2660 return; | 2687 return; |
| 2661 } | 2688 } |
| 2662 | 2689 |
| 2663 RefPtr<${implClassName}> event = ${implClassName}::create(type, eventInit); | 2690 RefPtr<${implClassName}> event = ${implClassName}::create(type, eventInit); |
| 2664 | 2691 |
| 2665 v8::Handle<v8::Object> wrapper = args.Holder(); | 2692 v8::Handle<v8::Object> wrapper = args.Holder(); |
| 2666 V8DOMWrapper::associateObjectWithWrapper(event.release(), &${v8ClassName}::i nfo, wrapper, args.GetIsolate(), WrapperConfiguration::Dependent); | 2693 V8DOMWrapper::associateObjectWithWrapper<${v8ClassName}>(event.release(), &$ {v8ClassName}::info, wrapper, args.GetIsolate(), WrapperConfiguration::Dependent ); |
| 2667 args.GetReturnValue().Set(wrapper); | 2694 args.GetReturnValue().Set(wrapper); |
| 2668 } | 2695 } |
| 2669 END | 2696 END |
| 2670 | 2697 |
| 2671 my $code = ""; | 2698 my $code = ""; |
| 2672 $code .= <<END; | 2699 $code .= <<END; |
| 2673 bool fill${implClassName}Init(${implClassName}Init& eventInit, const Dictionary& options) | 2700 bool fill${implClassName}Init(${implClassName}Init& eventInit, const Dictionary& options) |
| 2674 { | 2701 { |
| 2675 END | 2702 END |
| 2676 | 2703 |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2811 | 2838 |
| 2812 if ($interface->extendedAttributes->{"ConstructorRaisesException"}) { | 2839 if ($interface->extendedAttributes->{"ConstructorRaisesException"}) { |
| 2813 $code .= " if (ec) {\n"; | 2840 $code .= " if (ec) {\n"; |
| 2814 $code .= " setDOMException(ec, args.GetIsolate());\n"; | 2841 $code .= " setDOMException(ec, args.GetIsolate());\n"; |
| 2815 $code .= " return;\n"; | 2842 $code .= " return;\n"; |
| 2816 $code .= " }\n"; | 2843 $code .= " }\n"; |
| 2817 } | 2844 } |
| 2818 | 2845 |
| 2819 $code .= <<END; | 2846 $code .= <<END; |
| 2820 | 2847 |
| 2821 V8DOMWrapper::associateObjectWithWrapper(impl.release(), &${v8ClassName}Cons tructor::info, wrapper, args.GetIsolate(), WrapperConfiguration::Dependent); | 2848 V8DOMWrapper::associateObjectWithWrapper<${v8ClassName}>(impl.release(), &${ v8ClassName}Constructor::info, wrapper, args.GetIsolate(), WrapperConfiguration: :Dependent); |
| 2822 args.GetReturnValue().Set(wrapper); | 2849 args.GetReturnValue().Set(wrapper); |
| 2823 } | 2850 } |
| 2824 | 2851 |
| 2825 END | 2852 END |
| 2826 $implementation{nameSpaceWebCore}->add($code); | 2853 $implementation{nameSpaceWebCore}->add($code); |
| 2827 | 2854 |
| 2828 $code = <<END; | 2855 $code = <<END; |
| 2829 v8::Handle<v8::FunctionTemplate> ${v8ClassName}Constructor::GetTemplate(v8::Isol ate* isolate, WrapperWorldType currentWorldType) | 2856 v8::Handle<v8::FunctionTemplate> ${v8ClassName}Constructor::GetTemplate(v8::Isol ate* isolate, WrapperWorldType currentWorldType) |
| 2830 { | 2857 { |
| 2831 static v8::Persistent<v8::FunctionTemplate> cachedTemplate; | 2858 static v8::Persistent<v8::FunctionTemplate> cachedTemplate; |
| (...skipping 1642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4474 } | 4501 } |
| 4475 | 4502 |
| 4476 END | 4503 END |
| 4477 } | 4504 } |
| 4478 | 4505 |
| 4479 GenerateToV8Converters($interface, $v8ClassName, $nativeType); | 4506 GenerateToV8Converters($interface, $v8ClassName, $nativeType); |
| 4480 | 4507 |
| 4481 $implementation{nameSpaceWebCore}->add(<<END); | 4508 $implementation{nameSpaceWebCore}->add(<<END); |
| 4482 void ${v8ClassName}::derefObject(void* object) | 4509 void ${v8ClassName}::derefObject(void* object) |
| 4483 { | 4510 { |
| 4484 static_cast<${nativeType}*>(object)->deref(); | 4511 fromWrappedType(object)->deref(); |
| 4485 } | 4512 } |
| 4486 | 4513 |
| 4487 END | 4514 END |
| 4488 } | 4515 } |
| 4489 | 4516 |
| 4490 sub GenerateHeaderContentHeader | 4517 sub GenerateHeaderContentHeader |
| 4491 { | 4518 { |
| 4492 my $interface = shift; | 4519 my $interface = shift; |
| 4493 my $v8ClassName = GetV8ClassName($interface); | 4520 my $v8ClassName = GetV8ClassName($interface); |
| 4494 my $conditionalString = GenerateConditionalString($interface); | 4521 my $conditionalString = GenerateConditionalString($interface); |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4720 || $v8ClassName =~ /SVG/) { | 4747 || $v8ClassName =~ /SVG/) { |
| 4721 $wrapperConfiguration = "WrapperConfiguration::Dependent"; | 4748 $wrapperConfiguration = "WrapperConfiguration::Dependent"; |
| 4722 } | 4749 } |
| 4723 | 4750 |
| 4724 my $code = ""; | 4751 my $code = ""; |
| 4725 $code .= <<END; | 4752 $code .= <<END; |
| 4726 | 4753 |
| 4727 v8::Handle<v8::Object> ${v8ClassName}::createWrapper(${createWrapperArgumentType } impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) | 4754 v8::Handle<v8::Object> ${v8ClassName}::createWrapper(${createWrapperArgumentType } impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) |
| 4728 { | 4755 { |
| 4729 ASSERT(impl.get()); | 4756 ASSERT(impl.get()); |
| 4730 ASSERT(DOMDataStore::getWrapper(impl.get(), isolate).IsEmpty()); | 4757 ASSERT(DOMDataStore::getWrapper<${v8ClassName}>(impl.get(), isolate).IsEmpty ()); |
| 4731 END | 4758 END |
| 4732 | 4759 |
| 4733 $code .= <<END if ($baseType ne $interfaceName); | 4760 $code .= <<END if ($baseType ne $interfaceName); |
| 4734 ASSERT(static_cast<void*>(static_cast<${baseType}*>(impl.get())) == static_c ast<void*>(impl.get())); | |
| 4735 END | 4761 END |
| 4736 | 4762 |
| 4737 if (InheritsInterface($interface, "Document")) { | 4763 if (InheritsInterface($interface, "Document")) { |
| 4738 $code .= <<END; | 4764 $code .= <<END; |
| 4739 if (Frame* frame = impl->frame()) { | 4765 if (Frame* frame = impl->frame()) { |
| 4740 if (frame->script()->initializeMainWorld()) { | 4766 if (frame->script()->initializeMainWorld()) { |
| 4741 // initializeMainWorld may have created a wrapper for the object, re try from the start. | 4767 // initializeMainWorld may have created a wrapper for the object, re try from the start. |
| 4742 v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapper(impl.get() , isolate); | 4768 v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapper<${v8ClassN ame}>(impl.get(), isolate); |
| 4743 if (!wrapper.IsEmpty()) | 4769 if (!wrapper.IsEmpty()) |
| 4744 return wrapper; | 4770 return wrapper; |
| 4745 } | 4771 } |
| 4746 } | 4772 } |
| 4747 END | 4773 END |
| 4748 } | 4774 } |
| 4749 | 4775 |
| 4750 $code .= <<END; | 4776 $code .= <<END; |
| 4751 | 4777 |
| 4752 v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext , &info, impl.get(), isolate); | 4778 v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext , &info, toWrappedType(impl.get()), isolate); |
| 4753 if (UNLIKELY(wrapper.IsEmpty())) | 4779 if (UNLIKELY(wrapper.IsEmpty())) |
| 4754 return wrapper; | 4780 return wrapper; |
| 4755 END | 4781 END |
| 4756 if (IsTypedArrayType($interface->name)) { | 4782 if (IsTypedArrayType($interface->name)) { |
| 4757 AddToImplIncludes("bindings/v8/custom/V8ArrayBufferCustom.h"); | 4783 AddToImplIncludes("bindings/v8/custom/V8ArrayBufferCustom.h"); |
| 4758 $code .= <<END; | 4784 $code .= <<END; |
| 4759 if (!impl->buffer()->hasDeallocationObserver()) { | 4785 if (!impl->buffer()->hasDeallocationObserver()) { |
| 4760 v8::V8::AdjustAmountOfExternalAllocatedMemory(impl->buffer()->byteLength ()); | 4786 v8::V8::AdjustAmountOfExternalAllocatedMemory(impl->buffer()->byteLength ()); |
| 4761 impl->buffer()->setDeallocationObserver(V8ArrayBufferDeallocationObserve r::instance()); | 4787 impl->buffer()->setDeallocationObserver(V8ArrayBufferDeallocationObserve r::instance()); |
| 4762 } | 4788 } |
| 4763 END | 4789 END |
| 4764 } | 4790 } |
| 4765 | 4791 |
| 4766 $code .= <<END; | 4792 $code .= <<END; |
| 4767 installPerContextProperties(wrapper, impl.get(), isolate); | 4793 installPerContextProperties(wrapper, impl.get(), isolate); |
| 4768 V8DOMWrapper::associateObjectWithWrapper(impl, &info, wrapper, isolate, $wra pperConfiguration); | 4794 V8DOMWrapper::associateObjectWithWrapper<$v8ClassName>(impl, &info, wrapper, isolate, $wrapperConfiguration); |
| 4769 return wrapper; | 4795 return wrapper; |
| 4770 } | 4796 } |
| 4771 END | 4797 END |
| 4772 $implementation{nameSpaceWebCore}->add($code); | 4798 $implementation{nameSpaceWebCore}->add($code); |
| 4773 } | 4799 } |
| 4774 | 4800 |
| 4775 sub GenerateSecurityCheckFunctions | 4801 sub GenerateSecurityCheckFunctions |
| 4776 { | 4802 { |
| 4777 my $interface = shift; | 4803 my $interface = shift; |
| 4778 my $implClassName = GetImplName($interface); | 4804 my $implClassName = GetImplName($interface); |
| (...skipping 1248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6027 if ($currentInterface->extendedAttributes->{$extendedAttribute}) { | 6053 if ($currentInterface->extendedAttributes->{$extendedAttribute}) { |
| 6028 $found = 1; | 6054 $found = 1; |
| 6029 } | 6055 } |
| 6030 return 1 if $found; | 6056 return 1 if $found; |
| 6031 }, 0); | 6057 }, 0); |
| 6032 | 6058 |
| 6033 return $found; | 6059 return $found; |
| 6034 } | 6060 } |
| 6035 | 6061 |
| 6036 1; | 6062 1; |
| OLD | NEW |