OLD | NEW |
1 #!/usr/bin/perl -w | 1 #!/usr/bin/perl -w |
2 | 2 |
3 # Copyright (C) 2005, 2006, 2007, 2009 Apple Inc. All rights reserved. | 3 # Copyright (C) 2005, 2006, 2007, 2009 Apple Inc. All rights reserved. |
4 # Copyright (C) 2009, Julien Chaffraix <jchaffraix@webkit.org> | 4 # Copyright (C) 2009, Julien Chaffraix <jchaffraix@webkit.org> |
5 # Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmob
ile.com/) | 5 # Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmob
ile.com/) |
6 # Copyright (C) 2011 Ericsson AB. All rights reserved. | 6 # Copyright (C) 2011 Ericsson AB. All rights reserved. |
7 # Copyright (C) 2011 Google, Inc. All rights reserved. | 7 # Copyright (C) 2011 Google, Inc. All rights reserved. |
8 # | 8 # |
9 # Redistribution and use in source and binary forms, with or without | 9 # Redistribution and use in source and binary forms, with or without |
10 # modification, are permitted provided that the following conditions | 10 # modification, are permitted provided that the following conditions |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 # Currently, only Events have factory files. | 76 # Currently, only Events have factory files. |
77 return if $namespace ne "Event"; | 77 return if $namespace ne "Event"; |
78 | 78 |
79 my $outputFile = "$outputDir/${namespace}Factory.cpp"; | 79 my $outputFile = "$outputDir/${namespace}Factory.cpp"; |
80 | 80 |
81 open F, ">$outputFile" or die "Failed to open file: $!"; | 81 open F, ">$outputFile" or die "Failed to open file: $!"; |
82 | 82 |
83 print F $InCompiler->license(); | 83 print F $InCompiler->license(); |
84 | 84 |
85 print F "#include \"config.h\"\n"; | 85 print F "#include \"config.h\"\n"; |
86 print F "#include \"${namespace}Factory.h\"\n"; | 86 print F "#include \"core/dom/${namespace}Factory.h\"\n"; |
87 print F "\n"; | 87 print F "\n"; |
88 print F "#include \"${namespace}Headers.h\"\n"; | 88 print F "#include \"${namespace}Headers.h\"\n"; |
89 print F "#include \"RuntimeEnabledFeatures.h\"\n"; | 89 print F "#include \"core/page/RuntimeEnabledFeatures.h\"\n"; |
90 print F "\n"; | 90 print F "\n"; |
91 print F "namespace WebCore {\n"; | 91 print F "namespace WebCore {\n"; |
92 print F "\n"; | 92 print F "\n"; |
93 print F "PassRefPtr<$namespace> ${namespace}Factory::create(const String& ty
pe)\n"; | 93 print F "PassRefPtr<$namespace> ${namespace}Factory::create(const String& ty
pe)\n"; |
94 print F "{\n"; | 94 print F "{\n"; |
95 | 95 |
96 for my $eventName (sort keys %parsedEvents) { | 96 for my $eventName (sort keys %parsedEvents) { |
97 my $conditional = $parsedEvents{$eventName}{"conditional"}; | 97 my $conditional = $parsedEvents{$eventName}{"conditional"}; |
98 my $runtimeConditional = $parsedEvents{$eventName}{"runtimeConditional"}
; | 98 my $runtimeConditional = $parsedEvents{$eventName}{"runtimeConditional"}
; |
99 my $interfaceName = $InCompiler->interfaceForItem($eventName); | 99 my $interfaceName = $InCompiler->interfaceForItem($eventName); |
100 | 100 |
101 print F "#if ENABLE($conditional)\n" if $conditional; | 101 print F "#if ENABLE($conditional)\n" if $conditional; |
102 if ($runtimeConditional) { | 102 if ($runtimeConditional) { |
103 print F " if (type == \"$eventName\" && RuntimeEnabledFeatures::$
runtimeConditional())\n"; | 103 print F " if (type == \"$eventName\" && RuntimeEnabledFeatures::$
runtimeConditional())\n"; |
104 } else { | 104 } else { |
105 print F " if (type == \"$eventName\")\n"; | 105 print F " if (type == \"$eventName\")\n"; |
106 } | 106 } |
107 print F " return ${interfaceName}::create();\n"; | 107 print F " return ${interfaceName}::create();\n"; |
108 print F "#endif\n" if $conditional; | 108 print F "#endif\n" if $conditional; |
109 } | 109 } |
110 | 110 |
111 print F " return 0;\n"; | 111 print F " return 0;\n"; |
112 print F "}\n"; | 112 print F "}\n"; |
113 print F "\n"; | 113 print F "\n"; |
114 print F "} // namespace WebCore\n"; | 114 print F "} // namespace WebCore\n"; |
115 | 115 |
116 close F; | 116 close F; |
117 } | 117 } |
OLD | NEW |