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

Side by Side Diff: core/scripts/make_event_factory.py

Issue 37053003: Roll IDL to multivm@1467 (Closed) Base URL: https://dart.googlecode.com/svn/third_party/WebCore
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
« no previous file with comments | « core/page/WindowPagePopup.idl ('k') | core/scripts/make_runtime_features.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (C) 2013 Google Inc. All rights reserved. 2 # Copyright (C) 2013 Google Inc. All rights reserved.
3 # 3 #
4 # Redistribution and use in source and binary forms, with or without 4 # Redistribution and use in source and binary forms, with or without
5 # modification, are permitted provided that the following conditions are 5 # modification, are permitted provided that the following conditions are
6 # met: 6 # met:
7 # 7 #
8 # * Redistributions of source code must retain the above copyright 8 # * Redistributions of source code must retain the above copyright
9 # notice, this list of conditions and the following disclaimer. 9 # notice, this list of conditions and the following disclaimer.
10 # * Redistributions in binary form must reproduce the above 10 # * Redistributions in binary form must reproduce the above
(...skipping 15 matching lines...) Expand all
26 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 29
30 import os.path 30 import os.path
31 import sys 31 import sys
32 import shutil 32 import shutil
33 33
34 from in_file import InFile 34 from in_file import InFile
35 import name_macros 35 import name_macros
36 from name_utilities import lower_first
36 import license 37 import license
37 38
38 39
39 IMPLEMENTATION_TEMPLATE = """%(license)s 40 IMPLEMENTATION_TEMPLATE = """%(license)s
40 #include "config.h" 41 #include "config.h"
41 #include "%(class_name)sFactory.h" 42 #include "%(class_name)sFactory.h"
42 43
43 #include "%(class_name)sHeaders.h" 44 #include "%(class_name)sHeaders.h"
44 #include "RuntimeEnabledFeatures.h" 45 #include "RuntimeEnabledFeatures.h"
45 46
(...skipping 20 matching lines...) Expand all
66 } 67 }
67 68
68 def __init__(self, in_file_path, enabled_conditions): 69 def __init__(self, in_file_path, enabled_conditions):
69 super(EventFactoryWriter, self).__init__(in_file_path, enabled_condition s) 70 super(EventFactoryWriter, self).__init__(in_file_path, enabled_condition s)
70 self._outputs[(self.class_name + ".cpp")] = self.generate_implementation 71 self._outputs[(self.class_name + ".cpp")] = self.generate_implementation
71 72
72 def _events(self): 73 def _events(self):
73 return self.in_file.name_dictionaries 74 return self.in_file.name_dictionaries
74 75
75 def _factory_implementation(self, event): 76 def _factory_implementation(self, event):
76 runtime_condition = ''
77 if event['EnabledAtRuntime']: 77 if event['EnabledAtRuntime']:
78 runtime_condition = ' && RuntimeEnabledFeatures::' + event['EnabledA tRuntime'] + '()' 78 runtime_condition = ' && RuntimeEnabledFeatures::%s()' % lower_first (event['EnabledAtRuntime'])
79 else:
80 runtime_condition = ''
79 name = os.path.basename(event['name']) 81 name = os.path.basename(event['name'])
80 class_name = self._class_name_for_entry(event) 82 class_name = self._class_name_for_entry(event)
81 implementation = """ if (type == "%(name)s"%(runtime_condition)s) 83 implementation = """ if (type == "%(name)s"%(runtime_condition)s)
82 return %(class_name)s::create();""" % { 84 return %(class_name)s::create();""" % {
83 'name': name, 85 'name': name,
84 'runtime_condition': runtime_condition, 86 'runtime_condition': runtime_condition,
85 'class_name': class_name, 87 'class_name': class_name,
86 } 88 }
87 return self.wrap_with_condition(implementation, event['Conditional']) 89 return self.wrap_with_condition(implementation, event['Conditional'])
88 90
89 def generate_implementation(self): 91 def generate_implementation(self):
90 return IMPLEMENTATION_TEMPLATE % { 92 return IMPLEMENTATION_TEMPLATE % {
91 'class_name': self.class_name, 93 'class_name': self.class_name,
92 'license': license.license_for_generated_cpp(), 94 'license': license.license_for_generated_cpp(),
93 'factory_implementation': "\n".join(map(self._factory_implementation , self._events())), 95 'factory_implementation': "\n".join(map(self._factory_implementation , self._events())),
94 } 96 }
95 97
96 98
97 if __name__ == "__main__": 99 if __name__ == "__main__":
98 name_macros.Maker(EventFactoryWriter).main(sys.argv) 100 name_macros.Maker(EventFactoryWriter).main(sys.argv)
OLDNEW
« no previous file with comments | « core/page/WindowPagePopup.idl ('k') | core/scripts/make_runtime_features.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698