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 24 matching lines...) Expand all Loading... |
35 use InFilesCompiler; | 35 use InFilesCompiler; |
36 | 36 |
37 my %defaultParameters = ( | 37 my %defaultParameters = ( |
38 'namespace' => 0 | 38 'namespace' => 0 |
39 ); | 39 ); |
40 | 40 |
41 sub defaultItemFactory | 41 sub defaultItemFactory |
42 { | 42 { |
43 return ( | 43 return ( |
44 'interfaceName' => 0, | 44 'interfaceName' => 0, |
45 'conditional' => 0 | 45 'conditional' => 0, |
| 46 'runtimeConditional' => 0 |
46 ); | 47 ); |
47 } | 48 } |
48 | 49 |
49 my $InCompiler = InFilesCompiler->new(\%defaultParameters, \&defaultItemFactory)
; | 50 my $InCompiler = InFilesCompiler->new(\%defaultParameters, \&defaultItemFactory)
; |
50 | 51 |
51 my $outputDir = $InCompiler->initializeFromCommandLine(); | 52 my $outputDir = $InCompiler->initializeFromCommandLine(); |
52 $InCompiler->compile(\&generateCode); | 53 $InCompiler->compile(\&generateCode); |
53 | 54 |
54 sub generateCode() | 55 sub generateCode() |
55 { | 56 { |
(...skipping 22 matching lines...) Expand all Loading... |
78 my $outputFile = "$outputDir/${namespace}Factory.cpp"; | 79 my $outputFile = "$outputDir/${namespace}Factory.cpp"; |
79 | 80 |
80 open F, ">$outputFile" or die "Failed to open file: $!"; | 81 open F, ">$outputFile" or die "Failed to open file: $!"; |
81 | 82 |
82 print F $InCompiler->license(); | 83 print F $InCompiler->license(); |
83 | 84 |
84 print F "#include \"config.h\"\n"; | 85 print F "#include \"config.h\"\n"; |
85 print F "#include \"${namespace}Factory.h\"\n"; | 86 print F "#include \"${namespace}Factory.h\"\n"; |
86 print F "\n"; | 87 print F "\n"; |
87 print F "#include \"${namespace}Headers.h\"\n"; | 88 print F "#include \"${namespace}Headers.h\"\n"; |
| 89 print F "#if USE(V8)\n"; |
| 90 print F "#include \"RuntimeEnabledFeatures.h\"\n"; |
| 91 print F "#endif\n"; |
88 print F "\n"; | 92 print F "\n"; |
89 print F "namespace WebCore {\n"; | 93 print F "namespace WebCore {\n"; |
90 print F "\n"; | 94 print F "\n"; |
91 print F "PassRefPtr<$namespace> ${namespace}Factory::create(const String& ty
pe)\n"; | 95 print F "PassRefPtr<$namespace> ${namespace}Factory::create(const String& ty
pe)\n"; |
92 print F "{\n"; | 96 print F "{\n"; |
93 | 97 |
94 for my $eventName (sort keys %parsedEvents) { | 98 for my $eventName (sort keys %parsedEvents) { |
95 my $conditional = $parsedEvents{$eventName}{"conditional"}; | 99 my $conditional = $parsedEvents{$eventName}{"conditional"}; |
| 100 my $runtimeConditional = $parsedEvents{$eventName}{"runtimeConditional"}
; |
96 my $interfaceName = $InCompiler->interfaceForItem($eventName); | 101 my $interfaceName = $InCompiler->interfaceForItem($eventName); |
97 | 102 |
98 print F "#if ENABLE($conditional)\n" if $conditional; | 103 print F "#if ENABLE($conditional)\n" if $conditional; |
| 104 if ($runtimeConditional) { |
| 105 print F " #if USE(V8)\n"; |
| 106 print F " // FIXME: JSC should support RuntimeEnabledFeatures as
well.\n"; |
| 107 print F " if (type == \"$eventName\" && RuntimeEnabledFeatures::$
runtimeConditional())\n"; |
| 108 print F " return ${interfaceName}::create();\n"; |
| 109 print F " #else\n"; |
| 110 } |
99 print F " if (type == \"$eventName\")\n"; | 111 print F " if (type == \"$eventName\")\n"; |
100 print F " return ${interfaceName}::create();\n"; | 112 print F " return ${interfaceName}::create();\n"; |
| 113 print F "#endif // USE(V8)\n" if $runtimeConditional; |
101 print F "#endif\n" if $conditional; | 114 print F "#endif\n" if $conditional; |
102 } | 115 } |
103 | 116 |
104 print F " return 0;\n"; | 117 print F " return 0;\n"; |
105 print F "}\n"; | 118 print F "}\n"; |
106 print F "\n"; | 119 print F "\n"; |
107 print F "} // namespace WebCore\n"; | 120 print F "} // namespace WebCore\n"; |
108 | 121 |
109 close F; | 122 close F; |
110 } | 123 } |
OLD | NEW |