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 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 "unsigned long" => 1, | 160 "unsigned long" => 1, |
161 "unsigned long long" => 1, | 161 "unsigned long long" => 1, |
162 "float" => 1, | 162 "float" => 1, |
163 "double" => 1, | 163 "double" => 1, |
164 ); | 164 ); |
165 | 165 |
166 my %nonWrapperTypes = ("CompareHow" => 1, | 166 my %nonWrapperTypes = ("CompareHow" => 1, |
167 "DOMTimeStamp" => 1, | 167 "DOMTimeStamp" => 1, |
168 "Dictionary" => 1, | 168 "Dictionary" => 1, |
169 "EventListener" => 1, | 169 "EventListener" => 1, |
170 # FIXME: When EventTarget is an interface and not a mixin
, fix this so that | |
171 # EventTarget is treated as a wrapper type. | |
172 "EventTarget" => 1, | |
173 "MediaQueryListListener" => 1, | 170 "MediaQueryListListener" => 1, |
174 "NodeFilter" => 1, | 171 "NodeFilter" => 1, |
175 "SerializedScriptValue" => 1, | 172 "SerializedScriptValue" => 1, |
176 "any" => 1, | 173 "any" => 1, |
177 ); | 174 ); |
178 | 175 |
179 my %typedArrayHash = ("ArrayBuffer" => [], | 176 my %typedArrayHash = ("ArrayBuffer" => [], |
180 "ArrayBufferView" => [], | 177 "ArrayBufferView" => [], |
181 "Uint8Array" => ["unsigned char", "v8::kExternalUnsignedBy
teArray"], | 178 "Uint8Array" => ["unsigned char", "v8::kExternalUnsignedBy
teArray"], |
182 "Uint8ClampedArray" => ["unsigned char", "v8::kExternalPix
elArray"], | 179 "Uint8ClampedArray" => ["unsigned char", "v8::kExternalPix
elArray"], |
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
675 END | 672 END |
676 | 673 |
677 if (NeedsOpaqueRootForGC($interface)) { | 674 if (NeedsOpaqueRootForGC($interface)) { |
678 $header{classPublic}->add(" static void* opaqueRootForGC(void*, v8::I
solate*);\n"); | 675 $header{classPublic}->add(" static void* opaqueRootForGC(void*, v8::I
solate*);\n"); |
679 } | 676 } |
680 | 677 |
681 if (InheritsExtendedAttribute($interface, "ActiveDOMObject")) { | 678 if (InheritsExtendedAttribute($interface, "ActiveDOMObject")) { |
682 $header{classPublic}->add(" static ActiveDOMObject* toActiveDOMObject
(v8::Handle<v8::Object>);\n"); | 679 $header{classPublic}->add(" static ActiveDOMObject* toActiveDOMObject
(v8::Handle<v8::Object>);\n"); |
683 } | 680 } |
684 | 681 |
685 if (InheritsExtendedAttribute($interface, "EventTarget")) { | 682 if (InheritsInterface($interface, "EventTarget")) { |
686 $header{classPublic}->add(" static EventTarget* toEventTarget(v8::Han
dle<v8::Object>);\n"); | 683 $header{classPublic}->add(" static EventTarget* toEventTarget(v8::Han
dle<v8::Object>);\n"); |
687 } | 684 } |
688 | 685 |
689 if ($interfaceName eq "Window") { | 686 if ($interfaceName eq "Window") { |
690 $header{classPublic}->add(<<END); | 687 $header{classPublic}->add(<<END); |
691 static v8::Handle<v8::ObjectTemplate> GetShadowObjectTemplate(v8::Isolate*,
WrapperWorldType); | 688 static v8::Handle<v8::ObjectTemplate> GetShadowObjectTemplate(v8::Isolate*,
WrapperWorldType); |
692 END | 689 END |
693 } | 690 } |
694 | 691 |
695 my @enabledPerContextFunctions; | 692 my @enabledPerContextFunctions; |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
974 return 0; | 971 return 0; |
975 } | 972 } |
976 | 973 |
977 sub GetInternalFields | 974 sub GetInternalFields |
978 { | 975 { |
979 my $interface = shift; | 976 my $interface = shift; |
980 | 977 |
981 my @customInternalFields = (); | 978 my @customInternalFields = (); |
982 # Event listeners on DOM nodes are explicitly supported in the GC controller
. | 979 # Event listeners on DOM nodes are explicitly supported in the GC controller
. |
983 if (!InheritsInterface($interface, "Node") && | 980 if (!InheritsInterface($interface, "Node") && |
984 (InheritsExtendedAttribute($interface, "EventTarget") || HasEventListene
rAttribute($interface))) { | 981 (InheritsInterface($interface, "EventTarget") || HasEventListenerAttribu
te($interface))) { |
985 push(@customInternalFields, "eventListenerCacheIndex"); | 982 push(@customInternalFields, "eventListenerCacheIndex"); |
986 } | 983 } |
987 return @customInternalFields; | 984 return @customInternalFields; |
988 } | 985 } |
989 | 986 |
990 sub GenerateHeaderCustomInternalFieldIndices | 987 sub GenerateHeaderCustomInternalFieldIndices |
991 { | 988 { |
992 my $interface = shift; | 989 my $interface = shift; |
993 my @customInternalFields = GetInternalFields($interface); | 990 my @customInternalFields = GetInternalFields($interface); |
994 my $customFieldCounter = 0; | 991 my $customFieldCounter = 0; |
(...skipping 1798 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2793 | 2790 |
2794 my @beforeArgumentList; | 2791 my @beforeArgumentList; |
2795 my @afterArgumentList; | 2792 my @afterArgumentList; |
2796 | 2793 |
2797 my $toActiveDOMObject = "0"; | 2794 my $toActiveDOMObject = "0"; |
2798 if (InheritsExtendedAttribute($interface, "ActiveDOMObject")) { | 2795 if (InheritsExtendedAttribute($interface, "ActiveDOMObject")) { |
2799 $toActiveDOMObject = "${v8ClassName}::toActiveDOMObject"; | 2796 $toActiveDOMObject = "${v8ClassName}::toActiveDOMObject"; |
2800 } | 2797 } |
2801 | 2798 |
2802 my $toEventTarget = "0"; | 2799 my $toEventTarget = "0"; |
2803 if (InheritsExtendedAttribute($interface, "EventTarget")) { | 2800 if (InheritsInterface($interface, "EventTarget")) { |
2804 $toEventTarget = "${v8ClassName}::toEventTarget"; | 2801 $toEventTarget = "${v8ClassName}::toEventTarget"; |
2805 } | 2802 } |
2806 | 2803 |
2807 AddToImplIncludes("core/page/Frame.h"); | 2804 AddToImplIncludes("core/page/Frame.h"); |
2808 $implementation{nameSpaceWebCore}->add(<<END); | 2805 $implementation{nameSpaceWebCore}->add(<<END); |
2809 WrapperTypeInfo ${v8ClassName}Constructor::info = { ${v8ClassName}Constructor::G
etTemplate, ${v8ClassName}::derefObject, $toActiveDOMObject, $toEventTarget, 0,
${v8ClassName}::installPerContextPrototypeProperties, 0, WrapperTypeObjectProtot
ype }; | 2806 WrapperTypeInfo ${v8ClassName}Constructor::info = { ${v8ClassName}Constructor::G
etTemplate, ${v8ClassName}::derefObject, $toActiveDOMObject, $toEventTarget, 0,
${v8ClassName}::installPerContextPrototypeProperties, 0, WrapperTypeObjectProtot
ype }; |
2810 | 2807 |
2811 END | 2808 END |
2812 | 2809 |
2813 my $code = ""; | 2810 my $code = ""; |
(...skipping 1048 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3862 AddToImplIncludes("bindings/v8/V8Binding.h"); | 3859 AddToImplIncludes("bindings/v8/V8Binding.h"); |
3863 AddToImplIncludes("bindings/v8/V8DOMWrapper.h"); | 3860 AddToImplIncludes("bindings/v8/V8DOMWrapper.h"); |
3864 AddToImplIncludes("core/dom/ContextFeatures.h"); | 3861 AddToImplIncludes("core/dom/ContextFeatures.h"); |
3865 AddToImplIncludes("core/dom/Document.h"); | 3862 AddToImplIncludes("core/dom/Document.h"); |
3866 AddToImplIncludes("RuntimeEnabledFeatures.h"); | 3863 AddToImplIncludes("RuntimeEnabledFeatures.h"); |
3867 AddToImplIncludes("core/platform/chromium/TraceEvent.h"); | 3864 AddToImplIncludes("core/platform/chromium/TraceEvent.h"); |
3868 | 3865 |
3869 AddIncludesForType($interfaceName); | 3866 AddIncludesForType($interfaceName); |
3870 | 3867 |
3871 my $toActiveDOMObject = InheritsExtendedAttribute($interface, "ActiveDOMObje
ct") ? "${v8ClassName}::toActiveDOMObject" : "0"; | 3868 my $toActiveDOMObject = InheritsExtendedAttribute($interface, "ActiveDOMObje
ct") ? "${v8ClassName}::toActiveDOMObject" : "0"; |
3872 my $toEventTarget = InheritsExtendedAttribute($interface, "EventTarget") ? "
${v8ClassName}::toEventTarget" : "0"; | 3869 my $toEventTarget = InheritsInterface($interface, "EventTarget") ? "${v8Clas
sName}::toEventTarget" : "0"; |
3873 my $rootForGC = NeedsOpaqueRootForGC($interface) ? "${v8ClassName}::opaqueRo
otForGC" : "0"; | 3870 my $rootForGC = NeedsOpaqueRootForGC($interface) ? "${v8ClassName}::opaqueRo
otForGC" : "0"; |
3874 | 3871 |
3875 # Find the super descriptor. | 3872 # Find the super descriptor. |
3876 my $parentClass = ""; | 3873 my $parentClass = ""; |
3877 my $parentClassTemplate = ""; | 3874 my $parentClassTemplate = ""; |
3878 if ($interface->parent) { | 3875 if ($interface->parent) { |
3879 my $parent = $interface->parent; | 3876 my $parent = $interface->parent; |
3880 AddToImplIncludes("V8${parent}.h"); | 3877 AddToImplIncludes("V8${parent}.h"); |
3881 $parentClass = "V8" . $parent; | 3878 $parentClass = "V8" . $parent; |
3882 $parentClassTemplate = $parentClass . "::GetTemplate(isolate, currentWor
ldType)"; | 3879 $parentClassTemplate = $parentClass . "::GetTemplate(isolate, currentWor
ldType)"; |
(...skipping 580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4463 my $returnValue = $interfaceName eq "MessagePort" ? "0" : "toNative(obje
ct)"; | 4460 my $returnValue = $interfaceName eq "MessagePort" ? "0" : "toNative(obje
ct)"; |
4464 $implementation{nameSpaceWebCore}->add(<<END); | 4461 $implementation{nameSpaceWebCore}->add(<<END); |
4465 ActiveDOMObject* ${v8ClassName}::toActiveDOMObject(v8::Handle<v8::Object> object
) | 4462 ActiveDOMObject* ${v8ClassName}::toActiveDOMObject(v8::Handle<v8::Object> object
) |
4466 { | 4463 { |
4467 return $returnValue; | 4464 return $returnValue; |
4468 } | 4465 } |
4469 | 4466 |
4470 END | 4467 END |
4471 } | 4468 } |
4472 | 4469 |
4473 if (InheritsExtendedAttribute($interface, "EventTarget")) { | 4470 if (InheritsInterface($interface, "EventTarget")) { |
4474 $implementation{nameSpaceWebCore}->add(<<END); | 4471 $implementation{nameSpaceWebCore}->add(<<END); |
4475 EventTarget* ${v8ClassName}::toEventTarget(v8::Handle<v8::Object> object) | 4472 EventTarget* ${v8ClassName}::toEventTarget(v8::Handle<v8::Object> object) |
4476 { | 4473 { |
4477 return toNative(object); | 4474 return toNative(object); |
4478 } | 4475 } |
4479 | 4476 |
4480 END | 4477 END |
4481 } | 4478 } |
4482 | 4479 |
4483 if ($interfaceName eq "Window") { | 4480 if ($interfaceName eq "Window") { |
(...skipping 998 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5482 if ($arrayOrSequenceType) { | 5479 if ($arrayOrSequenceType) { |
5483 if (IsRefPtrType($arrayOrSequenceType)) { | 5480 if (IsRefPtrType($arrayOrSequenceType)) { |
5484 AddIncludesForType($arrayOrSequenceType); | 5481 AddIncludesForType($arrayOrSequenceType); |
5485 } | 5482 } |
5486 return "${indent}v8SetReturnValue(${getHolderContainer}, v8Array($native
Value, $getIsolate));" if $isReturnValue; | 5483 return "${indent}v8SetReturnValue(${getHolderContainer}, v8Array($native
Value, $getIsolate));" if $isReturnValue; |
5487 return "$indent$receiver v8Array($nativeValue, $getIsolate);"; | 5484 return "$indent$receiver v8Array($nativeValue, $getIsolate);"; |
5488 } | 5485 } |
5489 | 5486 |
5490 AddIncludesForType($type); | 5487 AddIncludesForType($type); |
5491 | 5488 |
5492 if (IsDOMNodeType($type) || $type eq "EventTarget") { | |
5493 if ($getScriptWrappable) { | |
5494 # FIXME: Use safe handles | |
5495 return "${indent}v8SetReturnValue(${getHolderContainer}, toV8Fast${for
MainWorldSuffix}($nativeValue$getHolderContainerArg$getScriptWrappableArg));" if
$isReturnValue; | |
5496 return "$indent$receiver toV8Fast${forMainWorldSuffix}($nativeValue$ge
tHolderContainerArg$getScriptWrappableArg);"; | |
5497 } | |
5498 # FIXME: Use safe handles | |
5499 return "${indent}v8SetReturnValue(${getHolderContainer}, toV8($nativeValue
, $getCreationContext, $getIsolate));" if $isReturnValue; | |
5500 return "$indent$receiver toV8($nativeValue, $getCreationContext, $getIsola
te);"; | |
5501 } | |
5502 | |
5503 if ($type eq "SerializedScriptValue") { | 5489 if ($type eq "SerializedScriptValue") { |
5504 AddToImplIncludes("$type.h"); | 5490 AddToImplIncludes("$type.h"); |
5505 my $returnValue = "$nativeValue ? $nativeValue->deserialize() : v8::Hand
le<v8::Value>(v8::Null($getIsolate))"; | 5491 my $returnValue = "$nativeValue ? $nativeValue->deserialize() : v8::Hand
le<v8::Value>(v8::Null($getIsolate))"; |
5506 return "${indent}v8SetReturnValue(${getHolderContainer}, $returnValue);"
if $isReturnValue; | 5492 return "${indent}v8SetReturnValue(${getHolderContainer}, $returnValue);"
if $isReturnValue; |
5507 return "$indent$receiver $returnValue;"; | 5493 return "$indent$receiver $returnValue;"; |
5508 } | 5494 } |
5509 | 5495 |
5510 AddToImplIncludes("wtf/RefCounted.h"); | |
5511 AddToImplIncludes("wtf/RefPtr.h"); | 5496 AddToImplIncludes("wtf/RefPtr.h"); |
5512 AddToImplIncludes("wtf/GetPtr.h"); | 5497 AddToImplIncludes("wtf/GetPtr.h"); |
5513 | 5498 |
5514 if ($getScriptWrappable) { | 5499 if ($getScriptWrappable) { |
5515 # FIXME: Use safe handles | 5500 # FIXME: Use safe handles |
5516 return "${indent}v8SetReturnValue(${getHolderContainer}, toV8Fast${forMa
inWorldSuffix}($nativeValue$getHolderContainerArg$getScriptWrappableArg));" if $
isReturnValue; | 5501 return "${indent}v8SetReturnValue(${getHolderContainer}, toV8Fast${forMa
inWorldSuffix}($nativeValue$getHolderContainerArg$getScriptWrappableArg));" if $
isReturnValue; |
5517 return "$indent$receiver toV8Fast${forMainWorldSuffix}($nativeValue$getH
olderContainerArg$getScriptWrappableArg);"; | 5502 return "$indent$receiver toV8Fast${forMainWorldSuffix}($nativeValue$getH
olderContainerArg$getScriptWrappableArg);"; |
5518 } | 5503 } |
5519 # FIXME: Use safe handles | 5504 # FIXME: Use safe handles |
5520 return "${indent}v8SetReturnValue(${getHolderContainer}, toV8($nativeValue,
$getCreationContext, $getIsolate));" if $isReturnValue; | 5505 return "${indent}v8SetReturnValue(${getHolderContainer}, toV8($nativeValue,
$getCreationContext, $getIsolate));" if $isReturnValue; |
(...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6059 if ($currentInterface->extendedAttributes->{$extendedAttribute}) { | 6044 if ($currentInterface->extendedAttributes->{$extendedAttribute}) { |
6060 $found = 1; | 6045 $found = 1; |
6061 } | 6046 } |
6062 return 1 if $found; | 6047 return 1 if $found; |
6063 }, 0); | 6048 }, 0); |
6064 | 6049 |
6065 return $found; | 6050 return $found; |
6066 } | 6051 } |
6067 | 6052 |
6068 1; | 6053 1; |
OLD | NEW |