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 2915 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2926 last if $index eq $paramIndex; | 2926 last if $index eq $paramIndex; |
| 2927 if ($replacements{$parameter->name}) { | 2927 if ($replacements{$parameter->name}) { |
| 2928 push(@argumentList, $replacements{$parameter->name}); | 2928 push(@argumentList, $replacements{$parameter->name}); |
| 2929 } else { | 2929 } else { |
| 2930 push(@argumentList, $parameter->name); | 2930 push(@argumentList, $parameter->name); |
| 2931 } | 2931 } |
| 2932 $index++; | 2932 $index++; |
| 2933 } | 2933 } |
| 2934 | 2934 |
| 2935 my $argumentString = join(", ", @beforeArgumentList, @argumentList, @afterAr gumentList); | 2935 my $argumentString = join(", ", @beforeArgumentList, @argumentList, @afterAr gumentList); |
| 2936 $code .= " RefPtr<${implClassName}> impl = ${implClassName}::create(${arg umentString});\n"; | 2936 my $refPtrType = IsGarbageCollectedType($interfaceName) ? "RefPtrWillBeRawPt r<$implClassName>" : "RefPtr<$implClassName>"; |
|
haraken
2014/02/06 05:35:28
Probably we need to implement a good helper method
tkent
2014/02/06 05:44:52
This change looks like we need to introduce anothe
haraken
2014/02/06 06:17:46
Yeah, agreed. I'll rename [GarbageCollected] to [W
Nils Barth (inactive)
2014/02/07 00:59:24
That's already handled as part of v8_types.cpp_typ
| |
| 2937 $code .= " $refPtrType impl = ${implClassName}::create(${argumentString}) ;\n"; | |
| 2937 $code .= " v8::Handle<v8::Object> wrapper = info.Holder();\n"; | 2938 $code .= " v8::Handle<v8::Object> wrapper = info.Holder();\n"; |
| 2938 | 2939 |
| 2939 if ($constructorRaisesException) { | 2940 if ($constructorRaisesException) { |
| 2940 $code .= " if (exceptionState.throwIfNeeded())\n"; | 2941 $code .= " if (exceptionState.throwIfNeeded())\n"; |
| 2941 $code .= " return;\n"; | 2942 $code .= " return;\n"; |
| 2942 } | 2943 } |
| 2943 | 2944 |
| 2944 $code .= <<END; | 2945 $code .= <<END; |
| 2945 | 2946 |
| 2946 V8DOMWrapper::associateObjectWithWrapper<${v8ClassName}>(impl.release(), &${ v8ClassName}::wrapperTypeInfo, wrapper, info.GetIsolate(), WrapperConfiguration: :Dependent); | 2947 V8DOMWrapper::associateObjectWithWrapper<${v8ClassName}>(impl.release(), &${ v8ClassName}::wrapperTypeInfo, wrapper, info.GetIsolate(), WrapperConfiguration: :Dependent); |
| (...skipping 2206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5153 sub GenerateToV8Converters | 5154 sub GenerateToV8Converters |
| 5154 { | 5155 { |
| 5155 my $interface = shift; | 5156 my $interface = shift; |
| 5156 my $v8ClassName = shift; | 5157 my $v8ClassName = shift; |
| 5157 my $interfaceName = $interface->name; | 5158 my $interfaceName = $interface->name; |
| 5158 | 5159 |
| 5159 if (ExtendedAttributeContains($interface->extendedAttributes->{"Custom"}, "T oV8")) { | 5160 if (ExtendedAttributeContains($interface->extendedAttributes->{"Custom"}, "T oV8")) { |
| 5160 return; | 5161 return; |
| 5161 } | 5162 } |
| 5162 | 5163 |
| 5163 my $createWrapperArgumentType = GetPassRefPtrType($interface); | 5164 my $passRefPtrType = GetPassRefPtrType($interface); |
| 5164 | 5165 |
| 5165 # FIXME: Do we really need to treat /SVG/ as dependent DOM objects? | 5166 # FIXME: Do we really need to treat /SVG/ as dependent DOM objects? |
| 5166 my $wrapperConfiguration = "WrapperConfiguration::Independent"; | 5167 my $wrapperConfiguration = "WrapperConfiguration::Independent"; |
| 5167 if (InheritsExtendedAttribute($interface, "ActiveDOMObject") | 5168 if (InheritsExtendedAttribute($interface, "ActiveDOMObject") |
| 5168 || InheritsExtendedAttribute($interface, "DependentLifetime") | 5169 || InheritsExtendedAttribute($interface, "DependentLifetime") |
| 5169 || NeedsVisitDOMWrapper($interface) | 5170 || NeedsVisitDOMWrapper($interface) |
| 5170 || $v8ClassName =~ /SVG/) { | 5171 || $v8ClassName =~ /SVG/) { |
| 5171 $wrapperConfiguration = "WrapperConfiguration::Dependent"; | 5172 $wrapperConfiguration = "WrapperConfiguration::Dependent"; |
| 5172 } | 5173 } |
| 5173 | 5174 |
| 5174 my $code = ""; | 5175 my $code = ""; |
| 5175 $code .= <<END; | 5176 $code .= <<END; |
| 5176 v8::Handle<v8::Object> ${v8ClassName}::createWrapper(${createWrapperArgumentType } impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) | 5177 v8::Handle<v8::Object> ${v8ClassName}::createWrapper(${passRefPtrType} impl, v8: :Handle<v8::Object> creationContext, v8::Isolate* isolate) |
| 5177 { | 5178 { |
| 5178 ASSERT(impl); | 5179 ASSERT(impl); |
| 5179 ASSERT(!DOMDataStore::containsWrapper<${v8ClassName}>(impl.get(), isolate)); | 5180 ASSERT(!DOMDataStore::containsWrapper<${v8ClassName}>(impl.get(), isolate)); |
| 5180 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) { | 5181 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) { |
| 5181 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje ct(impl.get()); | 5182 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje ct(impl.get()); |
| 5182 // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapper TypeInfo. These will both have | 5183 // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapper TypeInfo. These will both have |
| 5183 // the same object de-ref functions, though, so use that as the basis of the check. | 5184 // the same object de-ref functions, though, so use that as the basis of the check. |
| 5184 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction == wrapperTypeInfo.derefObjectFunction); | 5185 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction == wrapperTypeInfo.derefObjectFunction); |
| 5185 } | 5186 } |
| 5186 | 5187 |
| (...skipping 1282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6469 if ($parameter->type eq "SerializedScriptValue") { | 6470 if ($parameter->type eq "SerializedScriptValue") { |
| 6470 return 1; | 6471 return 1; |
| 6471 } elsif (IsIntegerType($parameter->type)) { | 6472 } elsif (IsIntegerType($parameter->type)) { |
| 6472 return 1; | 6473 return 1; |
| 6473 } | 6474 } |
| 6474 } | 6475 } |
| 6475 return 0; | 6476 return 0; |
| 6476 } | 6477 } |
| 6477 | 6478 |
| 6478 1; | 6479 1; |
| OLD | NEW |