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

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

Issue 165443003: Pass implementation object to supplemental classes by reference (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 10 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
« no previous file with comments | « no previous file | Source/bindings/tests/results/V8TestInterface.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1591 matching lines...) Expand 10 before | Expand all | Expand 10 after
1602 } 1602 }
1603 1603
1604 my $getterString; 1604 my $getterString;
1605 my ($functionName, @arguments) = GetterExpression($interfaceName, $attribute ); 1605 my ($functionName, @arguments) = GetterExpression($interfaceName, $attribute );
1606 push(@arguments, "isNull") if $isNullable; 1606 push(@arguments, "isNull") if $isNullable;
1607 push(@arguments, "exceptionState") if $useExceptions; 1607 push(@arguments, "exceptionState") if $useExceptions;
1608 if ($attribute->extendedAttributes->{"ImplementedBy"}) { 1608 if ($attribute->extendedAttributes->{"ImplementedBy"}) {
1609 my $implementedBy = $attribute->extendedAttributes->{"ImplementedBy"}; 1609 my $implementedBy = $attribute->extendedAttributes->{"ImplementedBy"};
1610 my $implementedByImplName = GetImplNameFromImplementedBy($implementedBy) ; 1610 my $implementedByImplName = GetImplNameFromImplementedBy($implementedBy) ;
1611 AddToImplIncludes(HeaderFilesForInterface($implementedBy, $implementedBy ImplName)); 1611 AddToImplIncludes(HeaderFilesForInterface($implementedBy, $implementedBy ImplName));
1612 unshift(@arguments, "imp") if !$attribute->isStatic; 1612 if (!$attribute->isStatic) {
1613 $code .= " ASSERT(imp);\n";
1614 unshift(@arguments, "*imp");
1615 }
1613 $functionName = "${implementedByImplName}::${functionName}"; 1616 $functionName = "${implementedByImplName}::${functionName}";
1614 } elsif ($attribute->isStatic) { 1617 } elsif ($attribute->isStatic) {
1615 $functionName = "${implClassName}::${functionName}"; 1618 $functionName = "${implClassName}::${functionName}";
1616 } else { 1619 } else {
1617 $functionName = "imp->${functionName}"; 1620 $functionName = "imp->${functionName}";
1618 } 1621 }
1619 my ($arg, $subCode) = GenerateCallWith($attribute->extendedAttributes->{"Cal lWith"}, " ", 0); 1622 my ($arg, $subCode) = GenerateCallWith($attribute->extendedAttributes->{"Cal lWith"}, " ", 0);
1620 $code .= $subCode; 1623 $code .= $subCode;
1621 unshift(@arguments, @$arg); 1624 unshift(@arguments, @$arg);
1622 $getterString = "${functionName}(" . join(", ", @arguments) . ")"; 1625 $getterString = "${functionName}(" . join(", ", @arguments) . ")";
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
1759 END 1762 END
1760 } 1763 }
1761 } elsif ($attribute->type eq "EventHandler") { 1764 } elsif ($attribute->type eq "EventHandler") {
1762 AddToImplIncludes("bindings/v8/V8AbstractEventListener.h"); 1765 AddToImplIncludes("bindings/v8/V8AbstractEventListener.h");
1763 # FIXME: Pass the main world ID for main-world-only getters. 1766 # FIXME: Pass the main world ID for main-world-only getters.
1764 my ($functionName, @arguments) = GetterExpression($interfaceName, $attri bute); 1767 my ($functionName, @arguments) = GetterExpression($interfaceName, $attri bute);
1765 my $implementedBy = $attribute->extendedAttributes->{"ImplementedBy"}; 1768 my $implementedBy = $attribute->extendedAttributes->{"ImplementedBy"};
1766 if ($implementedBy) { 1769 if ($implementedBy) {
1767 my $implementedByImplName = GetImplNameFromImplementedBy($implemente dBy); 1770 my $implementedByImplName = GetImplNameFromImplementedBy($implemente dBy);
1768 $functionName = "${implementedByImplName}::${functionName}"; 1771 $functionName = "${implementedByImplName}::${functionName}";
1769 push(@arguments, "imp"); 1772 $code .= " ASSERT(imp);\n";
1773 push(@arguments, "*imp");
1770 } else { 1774 } else {
1771 $functionName = "imp->${functionName}"; 1775 $functionName = "imp->${functionName}";
1772 } 1776 }
1773 $code .= " EventListener* jsValue = ${functionName}(" . join(", ", @a rguments) . ");\n"; 1777 $code .= " EventListener* jsValue = ${functionName}(" . join(", ", @a rguments) . ");\n";
1774 $code .= " v8SetReturnValue(info, jsValue ? v8::Handle<v8::Value>(V8A bstractEventListener::cast(jsValue)->getListenerObject(imp->executionContext())) : v8::Handle<v8::Value>(v8::Null(info.GetIsolate())));\n"; 1778 $code .= " v8SetReturnValue(info, jsValue ? v8::Handle<v8::Value>(V8A bstractEventListener::cast(jsValue)->getListenerObject(imp->executionContext())) : v8::Handle<v8::Value>(v8::Null(info.GetIsolate())));\n";
1775 } else { 1779 } else {
1776 my $nativeValue = NativeToJSValue($attribute->type, $attribute->extended Attributes, $expression, " ", "", "info.GetIsolate()", "info", "imp", $forMai nWorldSuffix, "return"); 1780 my $nativeValue = NativeToJSValue($attribute->type, $attribute->extended Attributes, $expression, " ", "", "info.GetIsolate()", "info", "imp", $forMai nWorldSuffix, "return");
1777 $code .= "${nativeValue}\n"; 1781 $code .= "${nativeValue}\n";
1778 } 1782 }
1779 1783
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
2110 my $implementedBy = $attribute->extendedAttributes->{"ImplementedBy"}; 2114 my $implementedBy = $attribute->extendedAttributes->{"ImplementedBy"};
2111 my $implementedByImplName; 2115 my $implementedByImplName;
2112 if ($implementedBy) { 2116 if ($implementedBy) {
2113 $implementedByImplName = GetImplNameFromImplementedBy($implementedBy ); 2117 $implementedByImplName = GetImplNameFromImplementedBy($implementedBy );
2114 } 2118 }
2115 if (!InheritsInterface($interface, "Node")) { 2119 if (!InheritsInterface($interface, "Node")) {
2116 my $attrImplName = GetImplName($attribute); 2120 my $attrImplName = GetImplName($attribute);
2117 my @arguments; 2121 my @arguments;
2118 if ($implementedBy) { 2122 if ($implementedBy) {
2119 $attrImplName = "${implementedByImplName}::${attrImplName}"; 2123 $attrImplName = "${implementedByImplName}::${attrImplName}";
2120 push(@arguments, "imp"); 2124 $code .= " ASSERT(imp);\n";
2125 push(@arguments, "*imp");
2121 } else { 2126 } else {
2122 $attrImplName = "imp->${attrImplName}"; 2127 $attrImplName = "imp->${attrImplName}";
2123 } 2128 }
2124 $code .= " moveEventListenerToNewWrapper(info.Holder(), ${attrImp lName}(" . join(", ", @arguments) . "), jsValue, ${v8ClassName}::eventListenerCa cheIndex, info.GetIsolate());\n"; 2129 $code .= " moveEventListenerToNewWrapper(info.Holder(), ${attrImp lName}(" . join(", ", @arguments) . "), jsValue, ${v8ClassName}::eventListenerCa cheIndex, info.GetIsolate());\n";
2125 } 2130 }
2126 my ($functionName, @arguments) = SetterExpression($interfaceName, $attri bute); 2131 my ($functionName, @arguments) = SetterExpression($interfaceName, $attri bute);
2127 if ($implementedBy) { 2132 if ($implementedBy) {
2133 $code .= " ASSERT(imp);\n";
2128 $functionName = "${implementedByImplName}::${functionName}"; 2134 $functionName = "${implementedByImplName}::${functionName}";
2129 push(@arguments, "imp"); 2135 push(@arguments, "*imp");
2130 } else { 2136 } else {
2131 $functionName = "imp->${functionName}"; 2137 $functionName = "imp->${functionName}";
2132 } 2138 }
2133 if (($interfaceName eq "Window" or $interfaceName eq "WorkerGlobalScope" ) and $attribute->name eq "onerror") { 2139 if (($interfaceName eq "Window" or $interfaceName eq "WorkerGlobalScope" ) and $attribute->name eq "onerror") {
2134 AddToImplIncludes("bindings/v8/V8ErrorHandler.h"); 2140 AddToImplIncludes("bindings/v8/V8ErrorHandler.h");
2135 push(@arguments, "V8EventListenerList::findOrCreateWrapper<V8ErrorHa ndler>(jsValue, true, info.GetIsolate())"); 2141 push(@arguments, "V8EventListenerList::findOrCreateWrapper<V8ErrorHa ndler>(jsValue, true, info.GetIsolate())");
2136 } else { 2142 } else {
2137 push(@arguments, "V8EventListenerList::getEventListener(jsValue, tru e, ListenerFindOrCreate)"); 2143 push(@arguments, "V8EventListenerList::getEventListener(jsValue, tru e, ListenerFindOrCreate)");
2138 } 2144 }
2139 $code .= " ${functionName}(" . join(", ", @arguments) . ");\n"; 2145 $code .= " ${functionName}(" . join(", ", @arguments) . ");\n";
2140 } else { 2146 } else {
2141 my ($functionName, @arguments) = SetterExpression($interfaceName, $attri bute); 2147 my ($functionName, @arguments) = SetterExpression($interfaceName, $attri bute);
2142 push(@arguments, $expression); 2148 push(@arguments, $expression);
2143 push(@arguments, "exceptionState") if $useExceptions; 2149 push(@arguments, "exceptionState") if $useExceptions;
2144 if ($attribute->extendedAttributes->{"ImplementedBy"}) { 2150 if ($attribute->extendedAttributes->{"ImplementedBy"}) {
2145 my $implementedBy = $attribute->extendedAttributes->{"ImplementedBy" }; 2151 my $implementedBy = $attribute->extendedAttributes->{"ImplementedBy" };
2146 my $implementedByImplName = GetImplNameFromImplementedBy($implemente dBy); 2152 my $implementedByImplName = GetImplNameFromImplementedBy($implemente dBy);
2147 AddToImplIncludes(HeaderFilesForInterface($implementedBy, $implement edByImplName)); 2153 AddToImplIncludes(HeaderFilesForInterface($implementedBy, $implement edByImplName));
2148 unshift(@arguments, "imp") if !$attribute->isStatic; 2154 if (!$attribute->isStatic) {
2155 $code .= " ASSERT(imp);\n";
2156 unshift(@arguments, "*imp");
2157 }
2149 $functionName = "${implementedByImplName}::${functionName}"; 2158 $functionName = "${implementedByImplName}::${functionName}";
2150 } elsif ($attribute->isStatic) { 2159 } elsif ($attribute->isStatic) {
2151 $functionName = "${implClassName}::${functionName}"; 2160 $functionName = "${implClassName}::${functionName}";
2152 } else { 2161 } else {
2153 $functionName = "imp->${functionName}"; 2162 $functionName = "imp->${functionName}";
2154 } 2163 }
2155 my ($arg, $subCode) = GenerateCallWith($attribute->extendedAttributes->{ "SetterCallWith"} || $attribute->extendedAttributes->{"CallWith"}, " ", 1); 2164 my ($arg, $subCode) = GenerateCallWith($attribute->extendedAttributes->{ "SetterCallWith"} || $attribute->extendedAttributes->{"CallWith"}, " ", 1);
2156 $code .= $subCode; 2165 $code .= $subCode;
2157 unshift(@arguments, @$arg); 2166 unshift(@arguments, @$arg);
2158 $code .= " ${functionName}(" . join(", ", @arguments) . ");\n"; 2167 $code .= " ${functionName}(" . join(", ", @arguments) . ");\n";
(...skipping 3118 matching lines...) Expand 10 before | Expand all | Expand 10 after
5277 5286
5278 my $index = 0; 5287 my $index = 0;
5279 my $humanFriendlyIndex = $index + 1; 5288 my $humanFriendlyIndex = $index + 1;
5280 5289
5281 my @arguments; 5290 my @arguments;
5282 my $functionName; 5291 my $functionName;
5283 my $implementedBy = $function->extendedAttributes->{"ImplementedBy"}; 5292 my $implementedBy = $function->extendedAttributes->{"ImplementedBy"};
5284 if ($implementedBy) { 5293 if ($implementedBy) {
5285 my $implementedByImplName = GetImplNameFromImplementedBy($implementedBy) ; 5294 my $implementedByImplName = GetImplNameFromImplementedBy($implementedBy) ;
5286 AddToImplIncludes(HeaderFilesForInterface($implementedBy, $implementedBy ImplName)); 5295 AddToImplIncludes(HeaderFilesForInterface($implementedBy, $implementedBy ImplName));
5287 unshift(@arguments, "imp") if !$function->isStatic; 5296 if (!$function->isStatic) {
5297 $code .= " ASSERT(imp);\n";
5298 unshift(@arguments, "*imp");
5299 }
5288 $functionName = "${implementedByImplName}::${name}"; 5300 $functionName = "${implementedByImplName}::${name}";
5289 } elsif ($function->isStatic) { 5301 } elsif ($function->isStatic) {
5290 $functionName = "${implClassName}::${name}"; 5302 $functionName = "${implClassName}::${name}";
5291 } else { 5303 } else {
5292 $functionName = "imp->${name}"; 5304 $functionName = "imp->${name}";
5293 } 5305 }
5294 5306
5295 my $callWith = $function->extendedAttributes->{"CallWith"}; 5307 my $callWith = $function->extendedAttributes->{"CallWith"};
5296 my ($callWithArgs, $subCode) = GenerateCallWith($callWith, $indent, 1, $func tion); 5308 my ($callWithArgs, $subCode) = GenerateCallWith($callWith, $indent, 1, $func tion);
5297 $code .= $subCode; 5309 $code .= $subCode;
(...skipping 1181 matching lines...) Expand 10 before | Expand all | Expand 10 after
6479 if ($parameter->type eq "SerializedScriptValue") { 6491 if ($parameter->type eq "SerializedScriptValue") {
6480 return 1; 6492 return 1;
6481 } elsif (IsIntegerType($parameter->type)) { 6493 } elsif (IsIntegerType($parameter->type)) {
6482 return 1; 6494 return 1;
6483 } 6495 }
6484 } 6496 }
6485 return 0; 6497 return 0;
6486 } 6498 }
6487 6499
6488 1; 6500 1;
OLDNEW
« no previous file with comments | « no previous file | Source/bindings/tests/results/V8TestInterface.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698