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

Side by Side Diff: third_party/WebKit/WebCore/bindings/scripts/CodeGeneratorCOM.pm

Issue 21165: Revert the merge. Mac build is mysteriously broken. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 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
OLDNEW
1 # 1 #
2 # Copyright (C) 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org> 2 # Copyright (C) 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>
3 # Copyright (C) 2006 Anders Carlsson <andersca@mac.com> 3 # Copyright (C) 2006 Anders Carlsson <andersca@mac.com>
4 # Copyright (C) 2006, 2007 Samuel Weinig <sam@webkit.org> 4 # Copyright (C) 2006, 2007 Samuel Weinig <sam@webkit.org>
5 # Copyright (C) 2006 Alexey Proskuryakov <ap@webkit.org> 5 # Copyright (C) 2006 Alexey Proskuryakov <ap@webkit.org>
6 # Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. 6 # Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
7 # 7 #
8 # This library is free software; you can redistribute it and/or 8 # This library is free software; you can redistribute it and/or
9 # modify it under the terms of the GNU Library General Public 9 # modify it under the terms of the GNU Library General Public
10 # License as published by the Free Software Foundation; either 10 # License as published by the Free Software Foundation; either
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 229
230 $type =~ s/^WebCore:://; 230 $type =~ s/^WebCore:://;
231 231
232 return $type; 232 return $type;
233 } 233 }
234 234
235 sub GetParentInterface 235 sub GetParentInterface
236 { 236 {
237 my ($dataNode) = @_; 237 my ($dataNode) = @_;
238 return "I" . $TEMP_PREFIX . "DOMObject" if (@{$dataNode->parents} == 0); 238 return "I" . $TEMP_PREFIX . "DOMObject" if (@{$dataNode->parents} == 0);
239 return "I" . $TEMP_PREFIX . "DOMNode" if $codeGenerator->StripModule($dataNo de->parents(0)) eq "EventTargetNode";
239 return GetInterfaceName($codeGenerator->StripModule($dataNode->parents(0))); 240 return GetInterfaceName($codeGenerator->StripModule($dataNode->parents(0)));
240 } 241 }
241 242
242 sub GetParentClass 243 sub GetParentClass
243 { 244 {
244 my ($dataNode) = @_; 245 my ($dataNode) = @_;
245 return $TEMP_PREFIX . "DOMObject" if (@{$dataNode->parents} == 0); 246 return $TEMP_PREFIX . "DOMObject" if (@{$dataNode->parents} == 0);
247 return $TEMP_PREFIX . "DOMNode" if $codeGenerator->StripModule($dataNode->pa rents(0)) eq "EventTargetNode";
246 return GetClassName($codeGenerator->StripModule($dataNode->parents(0))); 248 return GetClassName($codeGenerator->StripModule($dataNode->parents(0)));
247 } 249 }
248 250
249 sub AddForwardDeclarationsForTypeInIDL 251 sub AddForwardDeclarationsForTypeInIDL
250 { 252 {
251 my $type = $codeGenerator->StripModule(shift); 253 my $type = $codeGenerator->StripModule(shift);
252 254
253 return if $codeGenerator->IsNonPointerType($type) or $codeGenerator->IsStrin gType($type); 255 return if $codeGenerator->IsNonPointerType($type) or $codeGenerator->IsStrin gType($type);
254 256
255 my $interface = GetInterfaceName($type); 257 my $interface = GetInterfaceName($type);
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 return if $codeGenerator->IsNonPointerType($type); 309 return if $codeGenerator->IsNonPointerType($type);
308 310
309 if ($codeGenerator->IsStringType($type)) { 311 if ($codeGenerator->IsStringType($type)) {
310 $CPPImplementationWebCoreIncludes{"AtomicString.h"} = 1; 312 $CPPImplementationWebCoreIncludes{"AtomicString.h"} = 1;
311 $CPPImplementationWebCoreIncludes{"BString.h"} = 1; 313 $CPPImplementationWebCoreIncludes{"BString.h"} = 1;
312 $CPPImplementationWebCoreIncludes{"KURL.h"} = 1; 314 $CPPImplementationWebCoreIncludes{"KURL.h"} = 1;
313 return; 315 return;
314 } 316 }
315 317
316 # Special casing 318 # Special casing
319 $CPPImplementationWebCoreIncludes{"EventTargetNode.h"} = 1 if $type eq "Node ";
317 $CPPImplementationWebCoreIncludes{"NameNodeList.h"} = 1 if $type eq "NodeLis t"; 320 $CPPImplementationWebCoreIncludes{"NameNodeList.h"} = 1 if $type eq "NodeLis t";
318 $CPPImplementationWebCoreIncludes{"CSSMutableStyleDeclaration.h"} = 1 if $ty pe eq "CSSStyleDeclaration"; 321 $CPPImplementationWebCoreIncludes{"CSSMutableStyleDeclaration.h"} = 1 if $ty pe eq "CSSStyleDeclaration";
319 322
320 # Add implementation type 323 # Add implementation type
321 $CPPImplementationWebCoreIncludes{StripNamespace(IDLTypeToImplementationType ($type)) . ".h"} = 1; 324 $CPPImplementationWebCoreIncludes{StripNamespace(IDLTypeToImplementationType ($type)) . ".h"} = 1;
322 325
323 my $COMClassName = GetClassName($type); 326 my $COMClassName = GetClassName($type);
324 $CPPImplementationIncludes{"${COMClassName}.h"} = 1; 327 $CPPImplementationIncludes{"${COMClassName}.h"} = 1;
325 } 328 }
326 329
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
696 "Inden t" => 0, 699 "Inden t" => 0,
697 "Inclu deSemiColon" => 0, 700 "Inclu deSemiColon" => 0,
698 "UseCl assName" => 1, 701 "UseCl assName" => 1,
699 "AddVi rtualKeyword" => 0 }); 702 "AddVi rtualKeyword" => 0 });
700 703
701 my $implementationClassWithoutNamespace = StripNamespace($implementationClas s); 704 my $implementationClassWithoutNamespace = StripNamespace($implementationClas s);
702 705
703 my $functionName = $function->signature->name; 706 my $functionName = $function->signature->name;
704 my $returnIDLType = $function->signature->type; 707 my $returnIDLType = $function->signature->type;
705 my $noReturn = ($returnIDLType eq "void"); 708 my $noReturn = ($returnIDLType eq "void");
709 my $requiresEventTargetNodeCast = $function->signature->extendedAttributes-> {"EventTargetNodeCast"};
706 my $raisesExceptions = @{$function->raisesExceptions}; 710 my $raisesExceptions = @{$function->raisesExceptions};
707 711
708 AddIncludesForTypeInCPPImplementation($returnIDLType); 712 AddIncludesForTypeInCPPImplementation($returnIDLType);
709 $CPPImplementationWebCoreIncludes{"ExceptionCode.h"} = 1 if $raisesException s; 713 $CPPImplementationWebCoreIncludes{"ExceptionCode.h"} = 1 if $raisesException s;
710 714
711 my %needsCustom = (); 715 my %needsCustom = ();
712 my @parameterInitialization = (); 716 my @parameterInitialization = ();
713 my @parameterList = (); 717 my @parameterList = ();
714 foreach my $param (@{$function->parameters}) { 718 foreach my $param (@{$function->parameters}) {
715 my $paramName = $param->name; 719 my $paramName = $param->name;
(...skipping 29 matching lines...) Expand all
745 $paramInit .= " if (!${ptrName})\n"; 749 $paramInit .= " if (!${ptrName})\n";
746 $paramInit .= " return E_NOINTERFACE;"; 750 $paramInit .= " return E_NOINTERFACE;";
747 push(@parameterInitialization, $paramInit); 751 push(@parameterInitialization, $paramInit);
748 push(@parameterList, "${ptrName}->impl${paramTypeImplementationWitho utNamespace}()"); 752 push(@parameterList, "${ptrName}->impl${paramTypeImplementationWitho utNamespace}()");
749 } 753 }
750 } 754 }
751 755
752 push(@parameterList, "ec") if $raisesExceptions; 756 push(@parameterList, "ec") if $raisesExceptions;
753 757
754 my $implementationGetter = "impl${implementationClassWithoutNamespace}()"; 758 my $implementationGetter = "impl${implementationClassWithoutNamespace}()";
759 if ($requiresEventTargetNodeCast) {
760 $implementationGetter = "WebCore::EventTargetNodeCast(${implementationGe tter})";
761 }
755 762
756 my $callSigBegin = " "; 763 my $callSigBegin = " ";
757 my $callSigMiddle = "${implementationGetter}->" . $codeGenerator->WK_lcfirst ($functionName) . "(" . join(", ", @parameterList) . ")"; 764 my $callSigMiddle = "${implementationGetter}->" . $codeGenerator->WK_lcfirst ($functionName) . "(" . join(", ", @parameterList) . ")";
758 my $callSigEnd = ";\n"; 765 my $callSigEnd = ";\n";
759 766
760 if (defined $needsCustom{"NodeToReturn"}) { 767 if (defined $needsCustom{"NodeToReturn"}) {
761 my $nodeToReturn = $needsCustom{"NodeToReturn"}; 768 my $nodeToReturn = $needsCustom{"NodeToReturn"};
762 $callSigBegin .= "if ("; 769 $callSigBegin .= "if (";
763 $callSigEnd = ")\n"; 770 $callSigEnd = ")\n";
764 $callSigEnd .= " *result = ${nodeToReturn};"; 771 $callSigEnd .= " *result = ${nodeToReturn};";
(...skipping 22 matching lines...) Expand all
787 794
788 push(@functionImplementation, $signature); 795 push(@functionImplementation, $signature);
789 push(@functionImplementation, "{\n"); 796 push(@functionImplementation, "{\n");
790 unless ($noReturn) { 797 unless ($noReturn) {
791 push(@functionImplementation, " if (!result)\n"); 798 push(@functionImplementation, " if (!result)\n");
792 push(@functionImplementation, " return E_POINTER;\n\n"); 799 push(@functionImplementation, " return E_POINTER;\n\n");
793 push(@functionImplementation, " *result = 0;\n\n") if $needsCustom{"C anReturnEarly"}; 800 push(@functionImplementation, " *result = 0;\n\n") if $needsCustom{"C anReturnEarly"};
794 } 801 }
795 push(@functionImplementation, " WebCore::ExceptionCode ec = 0;\n") if $ra isesExceptions; # FIXME: CHECK EXCEPTION AND DO SOMETHING WITH IT 802 push(@functionImplementation, " WebCore::ExceptionCode ec = 0;\n") if $ra isesExceptions; # FIXME: CHECK EXCEPTION AND DO SOMETHING WITH IT
796 push(@functionImplementation, join("\n", @parameterInitialization) . (@param eterInitialization > 0 ? "\n" : "")); 803 push(@functionImplementation, join("\n", @parameterInitialization) . (@param eterInitialization > 0 ? "\n" : ""));
804 if ($requiresEventTargetNodeCast) {
805 push(@functionImplementation, " if (!impl${implementationClassWithout Namespace}()->isEventTargetNode())\n");
806 push(@functionImplementation, " return E_FAIL;\n");
807 }
797 push(@functionImplementation, $callSigBegin . $callSigMiddle . $callSigEnd . "\n"); 808 push(@functionImplementation, $callSigBegin . $callSigMiddle . $callSigEnd . "\n");
798 push(@functionImplementation, " return S_OK;\n"); 809 push(@functionImplementation, " return S_OK;\n");
799 push(@functionImplementation, "}\n\n"); 810 push(@functionImplementation, "}\n\n");
800 811
801 return join("", @functionImplementation); 812 return join("", @functionImplementation);
802 } 813 }
803 814
804 815
805 # ----------------------------------------------------------------------------- 816 # -----------------------------------------------------------------------------
806 # CPP Header 817 # CPP Header
(...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after
1293 print OUTPUTCPPImplementation @CPPImplementationContent; 1304 print OUTPUTCPPImplementation @CPPImplementationContent;
1294 1305
1295 close(OUTPUTCPPImplementation); 1306 close(OUTPUTCPPImplementation);
1296 1307
1297 @CPPImplementationHeader = (); 1308 @CPPImplementationHeader = ();
1298 @CPPImplementationContent = (); 1309 @CPPImplementationContent = ();
1299 } 1310 }
1300 } 1311 }
1301 1312
1302 1; 1313 1;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698