Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(334)

Side by Side Diff: Source/bindings/scripts/code_generator_v8.pm

Issue 25164005: Merge 158408 "Revert 157959 "Introduce a new reference graph to ..." (Closed) Base URL: svn://svn.chromium.org/blink/branches/chromium/1650/
Patch Set: Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 801 matching lines...) Expand 10 before | Expand all | Expand 10 after
812 812
813 $header{nameSpaceWebCore}->add(<<END); 813 $header{nameSpaceWebCore}->add(<<END);
814 814
815 template<> 815 template<>
816 class WrapperTypeTraits<${nativeType} > { 816 class WrapperTypeTraits<${nativeType} > {
817 public: 817 public:
818 static WrapperTypeInfo* info() { return &${v8ClassName}::info; } 818 static WrapperTypeInfo* info() { return &${v8ClassName}::info; }
819 }; 819 };
820 END 820 END
821 821
822 my $customWrap = $interface->extendedAttributes->{"CustomToV8"} || SVGTypeNe edsToHoldContextElement($interface->name); 822 my $customWrap = $interface->extendedAttributes->{"CustomToV8"};
823 if ($noToV8) { 823 if ($noToV8) {
824 die "Can't suppress toV8 for subclass\n" if $interface->parent; 824 die "Can't suppress toV8 for subclass\n" if $interface->parent;
825 } elsif ($noWrap) { 825 } elsif ($noWrap) {
826 die "Must have custom toV8\n" if !$customWrap; 826 die "Must have custom toV8\n" if !$customWrap;
827 $header{nameSpaceWebCore}->add(<<END); 827 $header{nameSpaceWebCore}->add(<<END);
828 class ${nativeType}; 828 class ${nativeType};
829 v8::Handle<v8::Value> toV8(${nativeType}*, v8::Handle<v8::Object> creationContex t, v8::Isolate*); 829 v8::Handle<v8::Value> toV8(${nativeType}*, v8::Handle<v8::Object> creationContex t, v8::Isolate*);
830 830
831 template<class CallbackInfo> 831 template<class CallbackInfo>
832 inline void v8SetReturnValue(const CallbackInfo& callbackInfo, ${nativeType}* im pl, v8::Handle<v8::Object> creationContext) 832 inline void v8SetReturnValue(const CallbackInfo& callbackInfo, ${nativeType}* im pl, v8::Handle<v8::Object> creationContext)
(...skipping 3185 matching lines...) Expand 10 before | Expand all | Expand 10 after
4018 ASSERT(impl); 4018 ASSERT(impl);
4019 v8::Handle<v8::Object> wrapper = ${v8ClassName}::createWrapper(impl, creatio nContext, isolate); 4019 v8::Handle<v8::Object> wrapper = ${v8ClassName}::createWrapper(impl, creatio nContext, isolate);
4020 if (!wrapper.IsEmpty()) 4020 if (!wrapper.IsEmpty())
4021 wrapper->SetIndexedPropertiesToExternalArrayData(impl->baseAddress(), $a rrayType, impl->length()); 4021 wrapper->SetIndexedPropertiesToExternalArrayData(impl->baseAddress(), $a rrayType, impl->length());
4022 return wrapper; 4022 return wrapper;
4023 } 4023 }
4024 4024
4025 END 4025 END
4026 } 4026 }
4027 4027
4028 # Add strong reference from TearOff to SVGElement, so that SVGElement would never get GC-ed while the TearOff is alive. We do this in V8-side to avoid circu lar reference on Blink side.
4029 if (SVGTypeNeedsToHoldContextElement($interface->name)) {
4030 # below include needed for SVGPathSegListPropertyTearOff
4031 AddToImplIncludes("V8SVGPathElement.h");
4032 $implementation{nameSpaceWebCore}->add(<<END);
4033 v8::Handle<v8::Object> wrap($nativeType* impl, v8::Handle<v8::Object> creationCo ntext, v8::Isolate* isolate)
4034 {
4035 ASSERT(impl);
4036 ASSERT(!DOMDataStore::containsWrapper<${v8ClassName}>(impl, isolate));
4037 v8::Handle<v8::Object> wrapper = ${v8ClassName}::createWrapper(impl, creatio nContext, isolate);
4038 if (impl->contextElement())
4039 V8HiddenPropertyName::setNamedHiddenReference(wrapper, "contextElement", toV8(impl->contextElement(), creationContext, isolate));
4040 return wrapper;
4041 }
4042
4043 END
4044 }
4045
4046 my @enabledPerContextFunctions; 4028 my @enabledPerContextFunctions;
4047 my @normalFunctions; 4029 my @normalFunctions;
4048 my $needsDomainSafeFunctionSetter = 0; 4030 my $needsDomainSafeFunctionSetter = 0;
4049 # Generate methods for functions. 4031 # Generate methods for functions.
4050 foreach my $function (@{$interface->functions}) { 4032 foreach my $function (@{$interface->functions}) {
4051 next if $function->name eq ""; 4033 next if $function->name eq "";
4052 GenerateFunction($function, $interface, ""); 4034 GenerateFunction($function, $interface, "");
4053 if ($function->extendedAttributes->{"PerWorldBindings"}) { 4035 if ($function->extendedAttributes->{"PerWorldBindings"}) {
4054 GenerateFunction($function, $interface, "ForMainWorld"); 4036 GenerateFunction($function, $interface, "ForMainWorld");
4055 } 4037 }
(...skipping 1735 matching lines...) Expand 10 before | Expand all | Expand 10 after
5791 return $svgTypeNeedingTearOff; 5773 return $svgTypeNeedingTearOff;
5792 } 5774 }
5793 5775
5794 sub IsSVGAnimatedType 5776 sub IsSVGAnimatedType
5795 { 5777 {
5796 my $type = shift; 5778 my $type = shift;
5797 5779
5798 return $type =~ /^SVGAnimated/; 5780 return $type =~ /^SVGAnimated/;
5799 } 5781 }
5800 5782
5801 sub SVGTypeNeedsToHoldContextElement
5802 {
5803 my $type = shift;
5804
5805 return IsSVGTypeNeedingTearOff($type) || IsSVGAnimatedType($type);
5806 }
5807
5808 sub GetSequenceType 5783 sub GetSequenceType
5809 { 5784 {
5810 my $type = shift; 5785 my $type = shift;
5811 5786
5812 return $1 if $type =~ /^sequence<([\w\d_\s]+)>.*/; 5787 return $1 if $type =~ /^sequence<([\w\d_\s]+)>.*/;
5813 return ""; 5788 return "";
5814 } 5789 }
5815 5790
5816 sub GetArrayType 5791 sub GetArrayType
5817 { 5792 {
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
6071 if ($currentInterface->extendedAttributes->{$extendedAttribute}) { 6046 if ($currentInterface->extendedAttributes->{$extendedAttribute}) {
6072 $found = 1; 6047 $found = 1;
6073 } 6048 }
6074 return 1 if $found; 6049 return 1 if $found;
6075 }, 0); 6050 }, 0);
6076 6051
6077 return $found; 6052 return $found;
6078 } 6053 }
6079 6054
6080 1; 6055 1;
OLDNEW
« no previous file with comments | « LayoutTests/svg/dom/SVGListPropertyTearOff-leaks-expected.txt ('k') | Source/core/svg/SVGAnimateElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698