| 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 = fromInternalPointer(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 fromInternalPointer(object->GetAlignedPointerFromInternalField(v8
DOMWrapperObjectIndex)); |
| 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 my $toWrappedType; |
| 752 my $fromWrappedType; |
| 753 if ($interface->parent) { |
| 754 my $v8ParentClassName = "V8" . $interface->parent; |
| 755 $toWrappedType = "${v8ParentClassName}::toInternalPointer(impl)"; |
| 756 $fromWrappedType = "static_cast<${nativeType}*>(${v8ParentClassName}::fr
omInternalPointer(object))"; |
| 757 } else { |
| 758 $toWrappedType = "impl"; |
| 759 $fromWrappedType = "static_cast<${nativeType}*>(object)"; |
| 760 } |
| 761 |
| 762 $header{classPublic}->add(<<END); |
| 763 static inline void* toInternalPointer(${nativeType}* impl) |
| 764 { |
| 765 return $toWrappedType; |
| 766 } |
| 767 |
| 768 static inline ${nativeType}* fromInternalPointer(void* object) |
| 769 { |
| 770 return $fromWrappedType; |
| 771 } |
| 772 END |
| 773 |
| 751 if ($interface->name eq "Window") { | 774 if ($interface->name eq "Window") { |
| 752 $header{classPublic}->add(<<END); | 775 $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); | 776 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); | 777 static bool indexedSecurityCheckCustom(v8::Local<v8::Object> host, uint32_t
index, v8::AccessType, v8::Local<v8::Value> data); |
| 755 END | 778 END |
| 756 } | 779 } |
| 757 | 780 |
| 758 if (@enabledPerContextAttributes) { | 781 if (@enabledPerContextAttributes) { |
| 759 $header{classPublic}->add(<<END); | 782 $header{classPublic}->add(<<END); |
| 760 static void installPerContextProperties(v8::Handle<v8::Object>, ${nativeType
}*, v8::Isolate*); | 783 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); | 870 $header{nameSpaceWebCore}->add(<<END); |
| 848 | 871 |
| 849 v8::Handle<v8::Object> wrap(${nativeType}* impl, v8::Handle<v8::Object> creation
Context, v8::Isolate*); | 872 v8::Handle<v8::Object> wrap(${nativeType}* impl, v8::Handle<v8::Object> creation
Context, v8::Isolate*); |
| 850 END | 873 END |
| 851 } else { | 874 } else { |
| 852 $header{nameSpaceWebCore}->add(<<END); | 875 $header{nameSpaceWebCore}->add(<<END); |
| 853 | 876 |
| 854 inline v8::Handle<v8::Object> wrap(${nativeType}* impl, v8::Handle<v8::Object> c
reationContext, v8::Isolate* isolate) | 877 inline v8::Handle<v8::Object> wrap(${nativeType}* impl, v8::Handle<v8::Object> c
reationContext, v8::Isolate* isolate) |
| 855 { | 878 { |
| 856 ASSERT(impl); | 879 ASSERT(impl); |
| 857 ASSERT(DOMDataStore::getWrapper(impl, isolate).IsEmpty()); | 880 ASSERT(DOMDataStore::getWrapper<${v8ClassName}>(impl, isolate).IsEmpty()); |
| 858 if (ScriptWrappable::wrapperCanBeStoredInObject(impl)) { | 881 if (ScriptWrappable::wrapperCanBeStoredInObject(impl)) { |
| 859 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje
ct(impl); | 882 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje
ct(impl); |
| 860 // Might be a XXXConstructor::info instead of an XXX::info. These will b
oth have | 883 // 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. | 884 // 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); | 885 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction
== ${v8ClassName}::info.derefObjectFunction); |
| 863 } | 886 } |
| 864 return $createWrapperCall(impl, creationContext, isolate); | 887 return $createWrapperCall(impl, creationContext, isolate); |
| 865 } | 888 } |
| 866 END | 889 END |
| 867 } | 890 } |
| 868 | 891 |
| 869 $header{nameSpaceWebCore}->add(<<END); | 892 $header{nameSpaceWebCore}->add(<<END); |
| 870 | 893 |
| 871 inline v8::Handle<v8::Value> toV8(${nativeType}* impl, v8::Handle<v8::Object> cr
eationContext, v8::Isolate* isolate) | 894 inline v8::Handle<v8::Value> toV8(${nativeType}* impl, v8::Handle<v8::Object> cr
eationContext, v8::Isolate* isolate) |
| 872 { | 895 { |
| 873 if (UNLIKELY(!impl)) | 896 if (UNLIKELY(!impl)) |
| 874 return v8NullWithCheck(isolate); | 897 return v8NullWithCheck(isolate); |
| 875 v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapper(impl, isolate); | 898 v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapper<${v8ClassName}>(imp
l, isolate); |
| 876 if (!wrapper.IsEmpty()) | 899 if (!wrapper.IsEmpty()) |
| 877 return wrapper; | 900 return wrapper; |
| 878 return wrap(impl, creationContext, isolate); | 901 return wrap(impl, creationContext, isolate); |
| 879 } | 902 } |
| 880 | 903 |
| 881 inline v8::Handle<v8::Value> toV8ForMainWorld(${nativeType}* impl, v8::Handle<v8
::Object> creationContext, v8::Isolate* isolate) | 904 inline v8::Handle<v8::Value> toV8ForMainWorld(${nativeType}* impl, v8::Handle<v8
::Object> creationContext, v8::Isolate* isolate) |
| 882 { | 905 { |
| 883 ASSERT(worldType(isolate) == MainWorld); | 906 ASSERT(worldType(isolate) == MainWorld); |
| 884 if (UNLIKELY(!impl)) | 907 if (UNLIKELY(!impl)) |
| 885 return v8NullWithCheck(isolate); | 908 return v8NullWithCheck(isolate); |
| 886 v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapperForMainWorld(impl); | 909 v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapperForMainWorld<${v8Cla
ssName}>(impl); |
| 887 if (!wrapper.IsEmpty()) | 910 if (!wrapper.IsEmpty()) |
| 888 return wrapper; | 911 return wrapper; |
| 889 return wrap(impl, creationContext, isolate); | 912 return wrap(impl, creationContext, isolate); |
| 890 } | 913 } |
| 891 | 914 |
| 892 template<class HolderContainer, class Wrappable> | 915 template<class HolderContainer, class Wrappable> |
| 893 inline v8::Handle<v8::Value> toV8Fast(${nativeType}* impl, const HolderContainer
& container, Wrappable* wrappable) | 916 inline v8::Handle<v8::Value> toV8Fast(${nativeType}* impl, const HolderContainer
& container, Wrappable* wrappable) |
| 894 { | 917 { |
| 895 if (UNLIKELY(!impl)) | 918 if (UNLIKELY(!impl)) |
| 896 return v8::Null(container.GetIsolate()); | 919 return v8::Null(container.GetIsolate()); |
| 897 v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperFast(impl, containe
r, wrappable); | 920 v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperFast<${v8ClassName}
>(impl, container, wrappable); |
| 898 if (!wrapper.IsEmpty()) | 921 if (!wrapper.IsEmpty()) |
| 899 return wrapper; | 922 return wrapper; |
| 900 return wrap(impl, container.Holder(), container.GetIsolate()); | 923 return wrap(impl, container.Holder(), container.GetIsolate()); |
| 901 } | 924 } |
| 902 | 925 |
| 903 template<class HolderContainer, class Wrappable> | 926 template<class HolderContainer, class Wrappable> |
| 904 inline v8::Handle<v8::Value> toV8FastForMainWorld(${nativeType}* impl, const Hol
derContainer& container, Wrappable* wrappable) | 927 inline v8::Handle<v8::Value> toV8FastForMainWorld(${nativeType}* impl, const Hol
derContainer& container, Wrappable* wrappable) |
| 905 { | 928 { |
| 906 ASSERT(worldType(container.GetIsolate()) == MainWorld); | 929 ASSERT(worldType(container.GetIsolate()) == MainWorld); |
| 907 if (UNLIKELY(!impl)) | 930 if (UNLIKELY(!impl)) |
| 908 return v8::Null(container.GetIsolate()); | 931 return v8::Null(container.GetIsolate()); |
| 909 v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperForMainWorld(impl); | 932 v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperForMainWorld<${v8Cl
assName}>(impl); |
| 910 if (!wrapper.IsEmpty()) | 933 if (!wrapper.IsEmpty()) |
| 911 return wrapper; | 934 return wrapper; |
| 912 return wrap(impl, container.Holder(), container.GetIsolate()); | 935 return wrap(impl, container.Holder(), container.GetIsolate()); |
| 913 } | 936 } |
| 914 | 937 |
| 915 template<class HolderContainer, class Wrappable> | 938 template<class HolderContainer, class Wrappable> |
| 916 inline v8::Handle<v8::Value> toV8FastForMainWorld(PassRefPtr< ${nativeType} > im
pl, const HolderContainer& container, Wrappable* wrappable) | 939 inline v8::Handle<v8::Value> toV8FastForMainWorld(PassRefPtr< ${nativeType} > im
pl, const HolderContainer& container, Wrappable* wrappable) |
| 917 { | 940 { |
| 918 return toV8FastForMainWorld(impl.get(), container, wrappable); | 941 return toV8FastForMainWorld(impl.get(), container, wrappable); |
| 919 } | 942 } |
| (...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1511 $code .= "}\n\n"; | 1534 $code .= "}\n\n"; |
| 1512 $implementation{nameSpaceInternal}->add($code); | 1535 $implementation{nameSpaceInternal}->add($code); |
| 1513 return; | 1536 return; |
| 1514 } | 1537 } |
| 1515 | 1538 |
| 1516 AddIncludesForType($returnType); | 1539 AddIncludesForType($returnType); |
| 1517 AddToImplIncludes("bindings/v8/V8HiddenPropertyName.h"); | 1540 AddToImplIncludes("bindings/v8/V8HiddenPropertyName.h"); |
| 1518 # Check for a wrapper in the wrapper cache. If there is one, we know tha
t a hidden reference has already | 1541 # Check for a wrapper in the wrapper cache. If there is one, we know tha
t a hidden reference has already |
| 1519 # been created. If we don't find a wrapper, we create both a wrapper and
a hidden reference. | 1542 # been created. If we don't find a wrapper, we create both a wrapper and
a hidden reference. |
| 1520 my $nativeReturnType = GetNativeType($returnType); | 1543 my $nativeReturnType = GetNativeType($returnType); |
| 1544 my $v8ReturnType = "V8" . $returnType; |
| 1521 $code .= " $nativeReturnType result = ${getterString};\n"; | 1545 $code .= " $nativeReturnType result = ${getterString};\n"; |
| 1522 if ($forMainWorldSuffix) { | 1546 if ($forMainWorldSuffix) { |
| 1523 $code .= " v8::Handle<v8::Value> wrapper = result.get() ? v8::Handl
e<v8::Value>(DOMDataStore::getWrapper${forMainWorldSuffix}(result.get())) : v8Un
defined();\n"; | 1547 $code .= " v8::Handle<v8::Value> wrapper = result.get() ? v8::Handl
e<v8::Value>(DOMDataStore::getWrapper${forMainWorldSuffix}<${v8ReturnType}>(resu
lt.get())) : v8Undefined();\n"; |
| 1524 } else { | 1548 } else { |
| 1525 $code .= " v8::Handle<v8::Value> wrapper = result.get() ? v8::Handl
e<v8::Value>(DOMDataStore::getWrapper(result.get(), info.GetIsolate())) : v8Unde
fined();\n"; | 1549 $code .= " v8::Handle<v8::Value> wrapper = result.get() ? v8::Handl
e<v8::Value>(DOMDataStore::getWrapper<${v8ReturnType}>(result.get(), info.GetIso
late())) : v8Undefined();\n"; |
| 1526 } | 1550 } |
| 1527 $code .= " if (wrapper.IsEmpty()) {\n"; | 1551 $code .= " if (wrapper.IsEmpty()) {\n"; |
| 1528 $code .= " wrapper = toV8(result.get(), info.Holder(), info.GetIs
olate());\n"; # FIXME: Could use wrap here since the wrapper is empty. | 1552 $code .= " wrapper = toV8(result.get(), info.Holder(), info.GetIs
olate());\n"; # FIXME: Could use wrap here since the wrapper is empty. |
| 1529 $code .= " if (!wrapper.IsEmpty())\n"; | 1553 $code .= " if (!wrapper.IsEmpty())\n"; |
| 1530 $code .= " V8HiddenPropertyName::setNamedHiddenReference(info
.Holder(), \"${attrName}\", wrapper);\n"; | 1554 $code .= " V8HiddenPropertyName::setNamedHiddenReference(info
.Holder(), \"${attrName}\", wrapper);\n"; |
| 1531 $code .= " }\n"; | 1555 $code .= " }\n"; |
| 1532 $code .= " v8SetReturnValue(info, wrapper);\n"; | 1556 $code .= " v8SetReturnValue(info, wrapper);\n"; |
| 1533 $code .= " return;\n"; | 1557 $code .= " return;\n"; |
| 1534 $code .= "}\n\n"; | 1558 $code .= "}\n\n"; |
| 1535 $code .= "#endif // ${conditionalString}\n\n" if $conditionalString; | 1559 $code .= "#endif // ${conditionalString}\n\n" if $conditionalString; |
| (...skipping 1022 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2558 | 2582 |
| 2559 if ($interface->extendedAttributes->{"ConstructorRaisesException"}) { | 2583 if ($interface->extendedAttributes->{"ConstructorRaisesException"}) { |
| 2560 $code .= " if (ec) {\n"; | 2584 $code .= " if (ec) {\n"; |
| 2561 $code .= " setDOMException(ec, args.GetIsolate());\n"; | 2585 $code .= " setDOMException(ec, args.GetIsolate());\n"; |
| 2562 $code .= " return;\n"; | 2586 $code .= " return;\n"; |
| 2563 $code .= " }\n"; | 2587 $code .= " }\n"; |
| 2564 } | 2588 } |
| 2565 | 2589 |
| 2566 $code .= <<END; | 2590 $code .= <<END; |
| 2567 | 2591 |
| 2568 V8DOMWrapper::associateObjectWithWrapper(impl.release(), &${v8ClassName}::in
fo, wrapper, args.GetIsolate(), WrapperConfiguration::Dependent); | 2592 V8DOMWrapper::associateObjectWithWrapper<${v8ClassName}>(impl.release(), &${
v8ClassName}::info, wrapper, args.GetIsolate(), WrapperConfiguration::Dependent)
; |
| 2569 args.GetReturnValue().Set(wrapper); | 2593 args.GetReturnValue().Set(wrapper); |
| 2570 } | 2594 } |
| 2571 | 2595 |
| 2572 END | 2596 END |
| 2573 $implementation{nameSpaceInternal}->add($code); | 2597 $implementation{nameSpaceInternal}->add($code); |
| 2574 } | 2598 } |
| 2575 | 2599 |
| 2576 # The Web IDL specification states that Interface objects for interfaces MUST ha
ve a property named | 2600 # The Web IDL specification states that Interface objects for interfaces MUST ha
ve a property named |
| 2577 # "length" that returns the length of the shortest argument list of the entries
in the effective | 2601 # "length" that returns the length of the shortest argument list of the entries
in the effective |
| 2578 # overload set for constructors. In other words, use the lowest number of mandat
ory arguments among | 2602 # overload set for constructors. In other words, use the lowest number of mandat
ory arguments among |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2666 args.Holder()->SetHiddenValue(V8HiddenPropertyName::${attributeName}
(), ${attributeName}); | 2690 args.Holder()->SetHiddenValue(V8HiddenPropertyName::${attributeName}
(), ${attributeName}); |
| 2667 END | 2691 END |
| 2668 } | 2692 } |
| 2669 } | 2693 } |
| 2670 $implementation{nameSpaceInternal}->add(<<END); | 2694 $implementation{nameSpaceInternal}->add(<<END); |
| 2671 } | 2695 } |
| 2672 | 2696 |
| 2673 RefPtr<${implClassName}> event = ${implClassName}::create(type, eventInit); | 2697 RefPtr<${implClassName}> event = ${implClassName}::create(type, eventInit); |
| 2674 | 2698 |
| 2675 v8::Handle<v8::Object> wrapper = args.Holder(); | 2699 v8::Handle<v8::Object> wrapper = args.Holder(); |
| 2676 V8DOMWrapper::associateObjectWithWrapper(event.release(), &${v8ClassName}::i
nfo, wrapper, args.GetIsolate(), WrapperConfiguration::Dependent); | 2700 V8DOMWrapper::associateObjectWithWrapper<${v8ClassName}>(event.release(), &$
{v8ClassName}::info, wrapper, args.GetIsolate(), WrapperConfiguration::Dependent
); |
| 2677 v8SetReturnValue(args, wrapper); | 2701 v8SetReturnValue(args, wrapper); |
| 2678 } | 2702 } |
| 2679 END | 2703 END |
| 2680 | 2704 |
| 2681 my $code = ""; | 2705 my $code = ""; |
| 2682 $code .= <<END; | 2706 $code .= <<END; |
| 2683 bool fill${implClassName}Init(${implClassName}Init& eventInit, const Dictionary&
options) | 2707 bool fill${implClassName}Init(${implClassName}Init& eventInit, const Dictionary&
options) |
| 2684 { | 2708 { |
| 2685 END | 2709 END |
| 2686 | 2710 |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2824 | 2848 |
| 2825 if ($interface->extendedAttributes->{"ConstructorRaisesException"}) { | 2849 if ($interface->extendedAttributes->{"ConstructorRaisesException"}) { |
| 2826 $code .= " if (ec) {\n"; | 2850 $code .= " if (ec) {\n"; |
| 2827 $code .= " setDOMException(ec, args.GetIsolate());\n"; | 2851 $code .= " setDOMException(ec, args.GetIsolate());\n"; |
| 2828 $code .= " return;\n"; | 2852 $code .= " return;\n"; |
| 2829 $code .= " }\n"; | 2853 $code .= " }\n"; |
| 2830 } | 2854 } |
| 2831 | 2855 |
| 2832 $code .= <<END; | 2856 $code .= <<END; |
| 2833 | 2857 |
| 2834 V8DOMWrapper::associateObjectWithWrapper(impl.release(), &${v8ClassName}Cons
tructor::info, wrapper, args.GetIsolate(), WrapperConfiguration::Dependent); | 2858 V8DOMWrapper::associateObjectWithWrapper<${v8ClassName}>(impl.release(), &${
v8ClassName}Constructor::info, wrapper, args.GetIsolate(), WrapperConfiguration:
:Dependent); |
| 2835 args.GetReturnValue().Set(wrapper); | 2859 args.GetReturnValue().Set(wrapper); |
| 2836 } | 2860 } |
| 2837 | 2861 |
| 2838 END | 2862 END |
| 2839 $implementation{nameSpaceWebCore}->add($code); | 2863 $implementation{nameSpaceWebCore}->add($code); |
| 2840 | 2864 |
| 2841 $code = <<END; | 2865 $code = <<END; |
| 2842 v8::Handle<v8::FunctionTemplate> ${v8ClassName}Constructor::GetTemplate(v8::Isol
ate* isolate, WrapperWorldType currentWorldType) | 2866 v8::Handle<v8::FunctionTemplate> ${v8ClassName}Constructor::GetTemplate(v8::Isol
ate* isolate, WrapperWorldType currentWorldType) |
| 2843 { | 2867 { |
| 2844 static v8::Persistent<v8::FunctionTemplate> cachedTemplate; | 2868 static v8::Persistent<v8::FunctionTemplate> cachedTemplate; |
| (...skipping 1642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4487 } | 4511 } |
| 4488 | 4512 |
| 4489 END | 4513 END |
| 4490 } | 4514 } |
| 4491 | 4515 |
| 4492 GenerateToV8Converters($interface, $v8ClassName, $nativeType); | 4516 GenerateToV8Converters($interface, $v8ClassName, $nativeType); |
| 4493 | 4517 |
| 4494 $implementation{nameSpaceWebCore}->add(<<END); | 4518 $implementation{nameSpaceWebCore}->add(<<END); |
| 4495 void ${v8ClassName}::derefObject(void* object) | 4519 void ${v8ClassName}::derefObject(void* object) |
| 4496 { | 4520 { |
| 4497 static_cast<${nativeType}*>(object)->deref(); | 4521 fromInternalPointer(object)->deref(); |
| 4498 } | 4522 } |
| 4499 | 4523 |
| 4500 END | 4524 END |
| 4501 } | 4525 } |
| 4502 | 4526 |
| 4503 sub GenerateHeaderContentHeader | 4527 sub GenerateHeaderContentHeader |
| 4504 { | 4528 { |
| 4505 my $interface = shift; | 4529 my $interface = shift; |
| 4506 my $v8ClassName = GetV8ClassName($interface); | 4530 my $v8ClassName = GetV8ClassName($interface); |
| 4507 my $conditionalString = GenerateConditionalString($interface); | 4531 my $conditionalString = GenerateConditionalString($interface); |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4733 || $v8ClassName =~ /SVG/) { | 4757 || $v8ClassName =~ /SVG/) { |
| 4734 $wrapperConfiguration = "WrapperConfiguration::Dependent"; | 4758 $wrapperConfiguration = "WrapperConfiguration::Dependent"; |
| 4735 } | 4759 } |
| 4736 | 4760 |
| 4737 my $code = ""; | 4761 my $code = ""; |
| 4738 $code .= <<END; | 4762 $code .= <<END; |
| 4739 | 4763 |
| 4740 v8::Handle<v8::Object> ${v8ClassName}::createWrapper(${createWrapperArgumentType
} impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) | 4764 v8::Handle<v8::Object> ${v8ClassName}::createWrapper(${createWrapperArgumentType
} impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) |
| 4741 { | 4765 { |
| 4742 ASSERT(impl.get()); | 4766 ASSERT(impl.get()); |
| 4743 ASSERT(DOMDataStore::getWrapper(impl.get(), isolate).IsEmpty()); | 4767 ASSERT(DOMDataStore::getWrapper<${v8ClassName}>(impl.get(), isolate).IsEmpty
()); |
| 4744 END | 4768 END |
| 4745 | 4769 |
| 4746 $code .= <<END if ($baseType ne $interfaceName); | 4770 $code .= <<END if ($baseType ne $interfaceName); |
| 4747 ASSERT(static_cast<void*>(static_cast<${baseType}*>(impl.get())) == static_c
ast<void*>(impl.get())); | |
| 4748 END | 4771 END |
| 4749 | 4772 |
| 4750 if (InheritsInterface($interface, "Document")) { | 4773 if (InheritsInterface($interface, "Document")) { |
| 4751 $code .= <<END; | 4774 $code .= <<END; |
| 4752 if (Frame* frame = impl->frame()) { | 4775 if (Frame* frame = impl->frame()) { |
| 4753 if (frame->script()->initializeMainWorld()) { | 4776 if (frame->script()->initializeMainWorld()) { |
| 4754 // initializeMainWorld may have created a wrapper for the object, re
try from the start. | 4777 // initializeMainWorld may have created a wrapper for the object, re
try from the start. |
| 4755 v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapper(impl.get()
, isolate); | 4778 v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapper<${v8ClassN
ame}>(impl.get(), isolate); |
| 4756 if (!wrapper.IsEmpty()) | 4779 if (!wrapper.IsEmpty()) |
| 4757 return wrapper; | 4780 return wrapper; |
| 4758 } | 4781 } |
| 4759 } | 4782 } |
| 4760 END | 4783 END |
| 4761 } | 4784 } |
| 4762 | 4785 |
| 4763 $code .= <<END; | 4786 $code .= <<END; |
| 4764 | 4787 |
| 4765 v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext
, &info, impl.get(), isolate); | 4788 v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext
, &info, toInternalPointer(impl.get()), isolate); |
| 4766 if (UNLIKELY(wrapper.IsEmpty())) | 4789 if (UNLIKELY(wrapper.IsEmpty())) |
| 4767 return wrapper; | 4790 return wrapper; |
| 4768 END | 4791 END |
| 4769 if (IsTypedArrayType($interface->name)) { | 4792 if (IsTypedArrayType($interface->name)) { |
| 4770 AddToImplIncludes("bindings/v8/custom/V8ArrayBufferCustom.h"); | 4793 AddToImplIncludes("bindings/v8/custom/V8ArrayBufferCustom.h"); |
| 4771 $code .= <<END; | 4794 $code .= <<END; |
| 4772 if (!impl->buffer()->hasDeallocationObserver()) { | 4795 if (!impl->buffer()->hasDeallocationObserver()) { |
| 4773 v8::V8::AdjustAmountOfExternalAllocatedMemory(impl->buffer()->byteLength
()); | 4796 v8::V8::AdjustAmountOfExternalAllocatedMemory(impl->buffer()->byteLength
()); |
| 4774 impl->buffer()->setDeallocationObserver(V8ArrayBufferDeallocationObserve
r::instance()); | 4797 impl->buffer()->setDeallocationObserver(V8ArrayBufferDeallocationObserve
r::instance()); |
| 4775 } | 4798 } |
| 4776 END | 4799 END |
| 4777 } | 4800 } |
| 4778 | 4801 |
| 4779 $code .= <<END; | 4802 $code .= <<END; |
| 4780 installPerContextProperties(wrapper, impl.get(), isolate); | 4803 installPerContextProperties(wrapper, impl.get(), isolate); |
| 4781 V8DOMWrapper::associateObjectWithWrapper(impl, &info, wrapper, isolate, $wra
pperConfiguration); | 4804 V8DOMWrapper::associateObjectWithWrapper<$v8ClassName>(impl, &info, wrapper,
isolate, $wrapperConfiguration); |
| 4782 return wrapper; | 4805 return wrapper; |
| 4783 } | 4806 } |
| 4784 END | 4807 END |
| 4785 $implementation{nameSpaceWebCore}->add($code); | 4808 $implementation{nameSpaceWebCore}->add($code); |
| 4786 } | 4809 } |
| 4787 | 4810 |
| 4788 sub GenerateSecurityCheckFunctions | 4811 sub GenerateSecurityCheckFunctions |
| 4789 { | 4812 { |
| 4790 my $interface = shift; | 4813 my $interface = shift; |
| 4791 my $implClassName = GetImplName($interface); | 4814 my $implClassName = GetImplName($interface); |
| (...skipping 1248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6040 if ($currentInterface->extendedAttributes->{$extendedAttribute}) { | 6063 if ($currentInterface->extendedAttributes->{$extendedAttribute}) { |
| 6041 $found = 1; | 6064 $found = 1; |
| 6042 } | 6065 } |
| 6043 return 1 if $found; | 6066 return 1 if $found; |
| 6044 }, 0); | 6067 }, 0); |
| 6045 | 6068 |
| 6046 return $found; | 6069 return $found; |
| 6047 } | 6070 } |
| 6048 | 6071 |
| 6049 1; | 6072 1; |
| OLD | NEW |