| 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 889 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 900 public: | 900 public: |
| 901 static const WrapperTypeInfo* wrapperTypeInfo() { return &${v8ClassName}::wr
apperTypeInfo; } | 901 static const WrapperTypeInfo* wrapperTypeInfo() { return &${v8ClassName}::wr
apperTypeInfo; } |
| 902 }; | 902 }; |
| 903 END | 903 END |
| 904 | 904 |
| 905 my $customWrap = NeedsSpecialWrap($interface); | 905 my $customWrap = NeedsSpecialWrap($interface); |
| 906 if ($noToV8) { | 906 if ($noToV8) { |
| 907 die "Can't suppress toV8 for subclass\n" if $interface->parent; | 907 die "Can't suppress toV8 for subclass\n" if $interface->parent; |
| 908 } elsif ($noWrap) { | 908 } elsif ($noWrap) { |
| 909 $header{nameSpaceWebCore}->add(<<END); | 909 $header{nameSpaceWebCore}->add(<<END); |
| 910 |
| 910 class ${nativeType}; | 911 class ${nativeType}; |
| 911 v8::Handle<v8::Value> toV8(${nativeType}*, v8::Handle<v8::Object> creationContex
t, v8::Isolate*); | 912 v8::Handle<v8::Value> toV8(${nativeType}*, v8::Handle<v8::Object> creationContex
t, v8::Isolate*); |
| 912 | 913 |
| 913 template<class CallbackInfo> | 914 template<class CallbackInfo> |
| 914 inline void v8SetReturnValue(const CallbackInfo& callbackInfo, ${nativeType}* im
pl) | 915 inline void v8SetReturnValue(const CallbackInfo& callbackInfo, ${nativeType}* im
pl) |
| 915 { | 916 { |
| 916 v8SetReturnValue(callbackInfo, toV8(impl, callbackInfo.Holder(), callbackInf
o.GetIsolate())); | 917 v8SetReturnValue(callbackInfo, toV8(impl, callbackInfo.Holder(), callbackInf
o.GetIsolate())); |
| 917 } | 918 } |
| 918 | 919 |
| 919 template<class CallbackInfo> | 920 template<class CallbackInfo> |
| 920 inline void v8SetReturnValueForMainWorld(const CallbackInfo& callbackInfo, ${nat
iveType}* impl) | 921 inline void v8SetReturnValueForMainWorld(const CallbackInfo& callbackInfo, ${nat
iveType}* impl) |
| 921 { | 922 { |
| 922 v8SetReturnValue(callbackInfo, toV8(impl, callbackInfo.Holder(), callbackIn
fo.GetIsolate())); | 923 v8SetReturnValue(callbackInfo, toV8(impl, callbackInfo.Holder(), callbackIn
fo.GetIsolate())); |
| 923 } | 924 } |
| 924 | 925 |
| 925 template<class CallbackInfo, class Wrappable> | 926 template<class CallbackInfo, class Wrappable> |
| 926 inline void v8SetReturnValueFast(const CallbackInfo& callbackInfo, ${nativeType}
* impl, Wrappable*) | 927 inline void v8SetReturnValueFast(const CallbackInfo& callbackInfo, ${nativeType}
* impl, Wrappable*) |
| 927 { | 928 { |
| 928 v8SetReturnValue(callbackInfo, toV8(impl, callbackInfo.Holder(), callbackIn
fo.GetIsolate())); | 929 v8SetReturnValue(callbackInfo, toV8(impl, callbackInfo.Holder(), callbackIn
fo.GetIsolate())); |
| 929 } | 930 } |
| 930 | |
| 931 END | 931 END |
| 932 } else { | 932 } else { |
| 933 if ($customWrap) { | 933 if ($customWrap) { |
| 934 $header{nameSpaceWebCore}->add(<<END); | 934 $header{nameSpaceWebCore}->add(<<END); |
| 935 | 935 |
| 936 v8::Handle<v8::Object> wrap(${nativeType}* impl, v8::Handle<v8::Object> creation
Context, v8::Isolate*); | 936 v8::Handle<v8::Object> wrap(${nativeType}* impl, v8::Handle<v8::Object> creation
Context, v8::Isolate*); |
| 937 END | 937 END |
| 938 } else { | 938 } else { |
| 939 $header{nameSpaceWebCore}->add(<<END); | 939 $header{nameSpaceWebCore}->add(<<END); |
| 940 | 940 |
| (...skipping 4110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5051 $code .= <<END; | 5051 $code .= <<END; |
| 5052 if (impl->is${type}()) | 5052 if (impl->is${type}()) |
| 5053 return wrap(to${type}(impl), creationContext, isolate); | 5053 return wrap(to${type}(impl), creationContext, isolate); |
| 5054 END | 5054 END |
| 5055 } | 5055 } |
| 5056 } | 5056 } |
| 5057 $code .= <<END; | 5057 $code .= <<END; |
| 5058 v8::Handle<v8::Object> wrapper = ${v8ClassName}::createWrapper(impl, creatio
nContext, isolate); | 5058 v8::Handle<v8::Object> wrapper = ${v8ClassName}::createWrapper(impl, creatio
nContext, isolate); |
| 5059 END | 5059 END |
| 5060 if ($isDocument) { | 5060 if ($isDocument) { |
| 5061 AddToImplIncludes("bindings/v8/ScriptController.h"); |
| 5061 AddToImplIncludes("bindings/v8/V8WindowShell.h"); | 5062 AddToImplIncludes("bindings/v8/V8WindowShell.h"); |
| 5062 $code .= <<END; | 5063 $code .= <<END; |
| 5063 if (wrapper.IsEmpty()) | 5064 if (wrapper.IsEmpty()) |
| 5064 return wrapper; | 5065 return wrapper; |
| 5065 if (!isolatedWorldForEnteredContext(isolate)) { | 5066 if (!isolatedWorldForEnteredContext(isolate)) { |
| 5066 if (Frame* frame = impl->frame()) | 5067 if (Frame* frame = impl->frame()) |
| 5067 frame->script().windowShell(mainThreadNormalWorld())->updateDocument
Wrapper(wrapper); | 5068 frame->script().windowShell(mainThreadNormalWorld())->updateDocument
Wrapper(wrapper); |
| 5068 } | 5069 } |
| 5069 END | 5070 END |
| 5070 } | 5071 } |
| 5071 $code .= <<END; | 5072 $code .= <<END; |
| 5072 return wrapper; | 5073 return wrapper; |
| 5073 } | 5074 } |
| 5074 | 5075 |
| 5075 END | 5076 END |
| 5076 $implementation{nameSpaceWebCore}->add($code); | 5077 $implementation{nameSpaceWebCore}->add($code); |
| 5077 } | 5078 } |
| 5078 | 5079 |
| 5079 sub GenerateToV8Converters | 5080 sub GenerateToV8Converters |
| 5080 { | 5081 { |
| 5081 my $interface = shift; | 5082 my $interface = shift; |
| 5082 my $v8ClassName = shift; | 5083 my $v8ClassName = shift; |
| 5083 my $nativeType = shift; | 5084 my $nativeType = shift; |
| 5084 my $interfaceName = $interface->name; | 5085 my $interfaceName = $interface->name; |
| 5085 | 5086 |
| 5086 if ($interface->extendedAttributes->{"CustomToV8"} || $interface->extendedAt
tributes->{"DoNotGenerateToV8"}) { | 5087 if ($interface->extendedAttributes->{"CustomToV8"} || $interface->extendedAt
tributes->{"DoNotGenerateToV8"}) { |
| 5087 return; | 5088 return; |
| 5088 } | 5089 } |
| 5089 | 5090 |
| 5090 AddToImplIncludes("bindings/v8/ScriptController.h"); | |
| 5091 | |
| 5092 GenerateSpecialWrap($interface, $v8ClassName, $nativeType); | 5091 GenerateSpecialWrap($interface, $v8ClassName, $nativeType); |
| 5093 | 5092 |
| 5094 my $createWrapperArgumentType = GetPassRefPtrType($nativeType); | 5093 my $createWrapperArgumentType = GetPassRefPtrType($nativeType); |
| 5095 my $baseType = BaseInterfaceName($interface); | 5094 my $baseType = BaseInterfaceName($interface); |
| 5096 | 5095 |
| 5097 # FIXME: Do we really need to treat /SVG/ as dependent DOM objects? | 5096 # FIXME: Do we really need to treat /SVG/ as dependent DOM objects? |
| 5098 my $wrapperConfiguration = "WrapperConfiguration::Independent"; | 5097 my $wrapperConfiguration = "WrapperConfiguration::Independent"; |
| 5099 if (InheritsExtendedAttribute($interface, "ActiveDOMObject") | 5098 if (InheritsExtendedAttribute($interface, "ActiveDOMObject") |
| 5100 || InheritsExtendedAttribute($interface, "DependentLifetime") | 5099 || InheritsExtendedAttribute($interface, "DependentLifetime") |
| 5101 || NeedsVisitDOMWrapper($interface) | 5100 || NeedsVisitDOMWrapper($interface) |
| (...skipping 13 matching lines...) Expand all Loading... |
| 5115 // the same object de-ref functions, though, so use that as the basis of
the check. | 5114 // the same object de-ref functions, though, so use that as the basis of
the check. |
| 5116 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction
== wrapperTypeInfo.derefObjectFunction); | 5115 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction
== wrapperTypeInfo.derefObjectFunction); |
| 5117 } | 5116 } |
| 5118 | 5117 |
| 5119 END | 5118 END |
| 5120 | 5119 |
| 5121 $code .= <<END if ($baseType ne $interfaceName); | 5120 $code .= <<END if ($baseType ne $interfaceName); |
| 5122 END | 5121 END |
| 5123 | 5122 |
| 5124 if (InheritsInterface($interface, "Document")) { | 5123 if (InheritsInterface($interface, "Document")) { |
| 5124 AddToImplIncludes("bindings/v8/ScriptController.h"); |
| 5125 AddToImplIncludes("core/frame/Frame.h"); | 5125 AddToImplIncludes("core/frame/Frame.h"); |
| 5126 $code .= <<END; | 5126 $code .= <<END; |
| 5127 if (Frame* frame = impl->frame()) { | 5127 if (Frame* frame = impl->frame()) { |
| 5128 if (frame->script().initializeMainWorld()) { | 5128 if (frame->script().initializeMainWorld()) { |
| 5129 // initializeMainWorld may have created a wrapper for the object, re
try from the start. | 5129 // initializeMainWorld may have created a wrapper for the object, re
try from the start. |
| 5130 v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapper<${v8ClassN
ame}>(impl.get(), isolate); | 5130 v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapper<${v8ClassN
ame}>(impl.get(), isolate); |
| 5131 if (!wrapper.IsEmpty()) | 5131 if (!wrapper.IsEmpty()) |
| 5132 return wrapper; | 5132 return wrapper; |
| 5133 } | 5133 } |
| 5134 } | 5134 } |
| (...skipping 1312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6447 return 1 if $name eq "ErrorCallback"; | 6447 return 1 if $name eq "ErrorCallback"; |
| 6448 return 1 if $name eq "FileCallback"; | 6448 return 1 if $name eq "FileCallback"; |
| 6449 return 1 if $name eq "FileSystemCallback"; | 6449 return 1 if $name eq "FileSystemCallback"; |
| 6450 return 1 if $name eq "FileSystemVoidCallback"; | 6450 return 1 if $name eq "FileSystemVoidCallback"; |
| 6451 return 1 if $name eq "FileWriterCallback"; | 6451 return 1 if $name eq "FileWriterCallback"; |
| 6452 return 1 if $name eq "MetadataCallback"; | 6452 return 1 if $name eq "MetadataCallback"; |
| 6453 return 0; | 6453 return 0; |
| 6454 } | 6454 } |
| 6455 | 6455 |
| 6456 1; | 6456 1; |
| OLD | NEW |