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

Side by Side Diff: mojo/public/tools/bindings/generators/mojom_cpp_generator.py

Issue 459873003: Mojom generator: move Is.*Kind() functions into module.py and use them from all mojom_.*_generator.… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix java compilation Created 6 years, 4 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 # Copyright 2013 The Chromium Authors. All rights reserved. 1 # Copyright 2013 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 """Generates C++ source files from a mojom.Module.""" 5 """Generates C++ source files from a mojom.Module."""
6 6
7 import mojom.generate.generator as generator 7 import mojom.generate.generator as generator
8 import mojom.generate.module as mojom 8 import mojom.generate.module as mojom
9 import mojom.generate.pack as pack 9 import mojom.generate.pack as pack
10 from mojom.generate.template_expander import UseJinja 10 from mojom.generate.template_expander import UseJinja
11 11
12 12
13 _kind_to_cpp_type = { 13 _kind_to_cpp_type = {
14 mojom.BOOL: "bool", 14 mojom.BOOL: "bool",
15 mojom.INT8: "int8_t", 15 mojom.INT8: "int8_t",
16 mojom.UINT8: "uint8_t", 16 mojom.UINT8: "uint8_t",
17 mojom.INT16: "int16_t", 17 mojom.INT16: "int16_t",
18 mojom.UINT16: "uint16_t", 18 mojom.UINT16: "uint16_t",
19 mojom.INT32: "int32_t", 19 mojom.INT32: "int32_t",
20 mojom.UINT32: "uint32_t", 20 mojom.UINT32: "uint32_t",
21 mojom.FLOAT: "float", 21 mojom.FLOAT: "float",
22 mojom.HANDLE: "mojo::Handle", 22 mojom.HANDLE: "mojo::Handle",
23 mojom.DCPIPE: "mojo::DataPipeConsumerHandle", 23 mojom.DCPIPE: "mojo::DataPipeConsumerHandle",
24 mojom.DPPIPE: "mojo::DataPipeProducerHandle", 24 mojom.DPPIPE: "mojo::DataPipeProducerHandle",
25 mojom.MSGPIPE: "mojo::MessagePipeHandle", 25 mojom.MSGPIPE: "mojo::MessagePipeHandle",
26 mojom.SHAREDBUFFER: "mojo::SharedBufferHandle", 26 mojom.SHAREDBUFFER: "mojo::SharedBufferHandle",
27 mojom.INT64: "int64_t", 27 mojom.NULLABLE_HANDLE: "mojo::Handle",
28 mojom.UINT64: "uint64_t", 28 mojom.NULLABLE_DCPIPE: "mojo::DataPipeConsumerHandle",
29 mojom.DOUBLE: "double", 29 mojom.NULLABLE_DPPIPE: "mojo::DataPipeProducerHandle",
30 mojom.NULLABLE_MSGPIPE: "mojo::MessagePipeHandle",
31 mojom.NULLABLE_SHAREDBUFFER: "mojo::SharedBufferHandle",
32 mojom.INT64: "int64_t",
33 mojom.UINT64: "uint64_t",
34 mojom.DOUBLE: "double",
30 } 35 }
31 36
32 _kind_to_cpp_literal_suffix = { 37 _kind_to_cpp_literal_suffix = {
33 mojom.UINT8: "U", 38 mojom.UINT8: "U",
34 mojom.UINT16: "U", 39 mojom.UINT16: "U",
35 mojom.UINT32: "U", 40 mojom.UINT32: "U",
36 mojom.FLOAT: "f", 41 mojom.FLOAT: "f",
37 mojom.UINT64: "ULL", 42 mojom.UINT64: "ULL",
38 } 43 }
39 44
40 def ConstantValue(constant): 45 def ConstantValue(constant):
41 return ExpressionToText(constant.value, kind=constant.kind) 46 return ExpressionToText(constant.value, kind=constant.kind)
42 47
43 def DefaultValue(field): 48 def DefaultValue(field):
44 if field.default: 49 if field.default:
45 if isinstance(field.kind, mojom.Struct): 50 if mojom.IsStructKind(field.kind):
46 assert field.default == "default" 51 assert field.default == "default"
47 return "%s::New()" % GetNameForKind(field.kind) 52 return "%s::New()" % GetNameForKind(field.kind)
48 return ExpressionToText(field.default, kind=field.kind) 53 return ExpressionToText(field.default, kind=field.kind)
49 return "" 54 return ""
50 55
51 def NamespaceToArray(namespace): 56 def NamespaceToArray(namespace):
52 return namespace.split('.') if namespace else [] 57 return namespace.split('.') if namespace else []
53 58
54 def GetNameForKind(kind, internal = False): 59 def GetNameForKind(kind, internal = False):
55 parts = [] 60 parts = []
56 if kind.imported_from: 61 if kind.imported_from:
57 parts.extend(NamespaceToArray(kind.imported_from["namespace"])) 62 parts.extend(NamespaceToArray(kind.imported_from["namespace"]))
58 if internal: 63 if internal:
59 parts.append("internal") 64 parts.append("internal")
60 if kind.parent_kind: 65 if kind.parent_kind:
61 parts.append(kind.parent_kind.name) 66 parts.append(kind.parent_kind.name)
62 parts.append(kind.name) 67 parts.append(kind.name)
63 return "::".join(parts) 68 return "::".join(parts)
64 69
65 def GetCppType(kind): 70 def GetCppType(kind):
66 if isinstance(kind, mojom.Struct): 71 if mojom.IsStructKind(kind):
67 return "%s_Data*" % GetNameForKind(kind, internal=True) 72 return "%s_Data*" % GetNameForKind(kind, internal=True)
68 if isinstance(kind, (mojom.Array, mojom.FixedArray)): 73 if mojom.IsAnyArrayKind(kind):
69 return "mojo::internal::Array_Data<%s>*" % GetCppType(kind.kind) 74 return "mojo::internal::Array_Data<%s>*" % GetCppType(kind.kind)
70 if isinstance(kind, mojom.Interface) or \ 75 if mojom.IsInterfaceKind(kind) or mojom.IsInterfaceRequestKind(kind):
71 isinstance(kind, mojom.InterfaceRequest):
72 return "mojo::MessagePipeHandle" 76 return "mojo::MessagePipeHandle"
73 if isinstance(kind, mojom.Enum): 77 if mojom.IsEnumKind(kind):
74 return "int32_t" 78 return "int32_t"
75 if kind.spec == 's': 79 if mojom.IsStringKind(kind):
76 return "mojo::internal::String_Data*" 80 return "mojo::internal::String_Data*"
77 return _kind_to_cpp_type[kind] 81 return _kind_to_cpp_type[kind]
78 82
79 def GetCppPodType(kind): 83 def GetCppPodType(kind):
80 if kind.spec == 's': 84 if mojom.IsStringKind(kind):
81 return "char*" 85 return "char*"
82 return _kind_to_cpp_type[kind] 86 return _kind_to_cpp_type[kind]
83 87
84 def GetCppArrayArgWrapperType(kind): 88 def GetCppArrayArgWrapperType(kind):
85 if isinstance(kind, mojom.Enum): 89 if mojom.IsEnumKind(kind):
86 return GetNameForKind(kind) 90 return GetNameForKind(kind)
87 if isinstance(kind, mojom.Struct): 91 if mojom.IsStructKind(kind):
88 return "%sPtr" % GetNameForKind(kind) 92 return "%sPtr" % GetNameForKind(kind)
89 if isinstance(kind, (mojom.Array, mojom.FixedArray)): 93 if mojom.IsAnyArrayKind(kind):
90 return "mojo::Array<%s> " % GetCppArrayArgWrapperType(kind.kind) 94 return "mojo::Array<%s> " % GetCppArrayArgWrapperType(kind.kind)
91 if isinstance(kind, mojom.Interface): 95 if mojom.IsInterfaceKind(kind):
92 raise Exception("Arrays of interfaces not yet supported!") 96 raise Exception("Arrays of interfaces not yet supported!")
93 if isinstance(kind, mojom.InterfaceRequest): 97 if mojom.IsInterfaceRequestKind(kind):
94 raise Exception("Arrays of interface requests not yet supported!") 98 raise Exception("Arrays of interface requests not yet supported!")
95 if kind.spec == 's': 99 if mojom.IsStringKind(kind):
96 return "mojo::String" 100 return "mojo::String"
97 if kind.spec == 'h': 101 if mojom.IsHandleKind(kind):
98 return "mojo::ScopedHandle" 102 return "mojo::ScopedHandle"
99 if kind.spec == 'h:d:c': 103 if mojom.IsDataPipeConsumerKind(kind):
100 return "mojo::ScopedDataPipeConsumerHandle" 104 return "mojo::ScopedDataPipeConsumerHandle"
101 if kind.spec == 'h:d:p': 105 if mojom.IsDataPipeProducerKind(kind):
102 return "mojo::ScopedDataPipeProducerHandle" 106 return "mojo::ScopedDataPipeProducerHandle"
103 if kind.spec == 'h:m': 107 if mojom.IsMessagePipeKind(kind):
104 return "mojo::ScopedMessagePipeHandle" 108 return "mojo::ScopedMessagePipeHandle"
105 if kind.spec == 'h:s': 109 if mojom.IsSharedBufferKind(kind):
106 return "mojo::ScopedSharedBufferHandle" 110 return "mojo::ScopedSharedBufferHandle"
107 return _kind_to_cpp_type[kind] 111 return _kind_to_cpp_type[kind]
108 112
109 def GetCppResultWrapperType(kind): 113 def GetCppResultWrapperType(kind):
110 if isinstance(kind, mojom.Enum): 114 if mojom.IsEnumKind(kind):
111 return GetNameForKind(kind) 115 return GetNameForKind(kind)
112 if isinstance(kind, mojom.Struct): 116 if mojom.IsStructKind(kind):
113 return "%sPtr" % GetNameForKind(kind) 117 return "%sPtr" % GetNameForKind(kind)
114 if isinstance(kind, (mojom.Array, mojom.FixedArray)): 118 if mojom.IsAnyArrayKind(kind):
115 return "mojo::Array<%s>" % GetCppArrayArgWrapperType(kind.kind) 119 return "mojo::Array<%s>" % GetCppArrayArgWrapperType(kind.kind)
116 if isinstance(kind, mojom.Interface): 120 if mojom.IsInterfaceKind(kind):
117 return "%sPtr" % GetNameForKind(kind) 121 return "%sPtr" % GetNameForKind(kind)
118 if isinstance(kind, mojom.InterfaceRequest): 122 if mojom.IsInterfaceRequestKind(kind):
119 return "mojo::InterfaceRequest<%s>" % GetNameForKind(kind.kind) 123 return "mojo::InterfaceRequest<%s>" % GetNameForKind(kind.kind)
120 if kind.spec == 's': 124 if mojom.IsStringKind(kind):
121 return "mojo::String" 125 return "mojo::String"
122 if kind.spec == 'h': 126 if mojom.IsHandleKind(kind):
123 return "mojo::ScopedHandle" 127 return "mojo::ScopedHandle"
124 if kind.spec == 'h:d:c': 128 if mojom.IsDataPipeConsumerKind(kind):
125 return "mojo::ScopedDataPipeConsumerHandle" 129 return "mojo::ScopedDataPipeConsumerHandle"
126 if kind.spec == 'h:d:p': 130 if mojom.IsDataPipeProducerKind(kind):
127 return "mojo::ScopedDataPipeProducerHandle" 131 return "mojo::ScopedDataPipeProducerHandle"
128 if kind.spec == 'h:m': 132 if mojom.IsMessagePipeKind(kind):
129 return "mojo::ScopedMessagePipeHandle" 133 return "mojo::ScopedMessagePipeHandle"
130 if kind.spec == 'h:s': 134 if mojom.IsSharedBufferKind(kind):
131 return "mojo::ScopedSharedBufferHandle" 135 return "mojo::ScopedSharedBufferHandle"
132 return _kind_to_cpp_type[kind] 136 return _kind_to_cpp_type[kind]
133 137
134 def GetCppWrapperType(kind): 138 def GetCppWrapperType(kind):
135 if isinstance(kind, mojom.Enum): 139 if mojom.IsEnumKind(kind):
136 return GetNameForKind(kind) 140 return GetNameForKind(kind)
137 if isinstance(kind, mojom.Struct): 141 if mojom.IsStructKind(kind):
138 return "%sPtr" % GetNameForKind(kind) 142 return "%sPtr" % GetNameForKind(kind)
139 if isinstance(kind, (mojom.Array, mojom.FixedArray)): 143 if mojom.IsAnyArrayKind(kind):
140 return "mojo::Array<%s>" % GetCppArrayArgWrapperType(kind.kind) 144 return "mojo::Array<%s>" % GetCppArrayArgWrapperType(kind.kind)
141 if isinstance(kind, mojom.Interface): 145 if mojom.IsInterfaceKind(kind):
142 return "%sPtr" % GetNameForKind(kind) 146 return "%sPtr" % GetNameForKind(kind)
143 if isinstance(kind, mojom.InterfaceRequest): 147 if mojom.IsInterfaceRequestKind(kind):
144 raise Exception("InterfaceRequest fields not supported!") 148 raise Exception("InterfaceRequest fields not supported!")
145 if kind.spec == 's': 149 if mojom.IsStringKind(kind):
146 return "mojo::String" 150 return "mojo::String"
147 if kind.spec == 'h': 151 if mojom.IsHandleKind(kind):
148 return "mojo::ScopedHandle" 152 return "mojo::ScopedHandle"
149 if kind.spec == 'h:d:c': 153 if mojom.IsDataPipeConsumerKind(kind):
150 return "mojo::ScopedDataPipeConsumerHandle" 154 return "mojo::ScopedDataPipeConsumerHandle"
151 if kind.spec == 'h:d:p': 155 if mojom.IsDataPipeProducerKind(kind):
152 return "mojo::ScopedDataPipeProducerHandle" 156 return "mojo::ScopedDataPipeProducerHandle"
153 if kind.spec == 'h:m': 157 if mojom.IsMessagePipeKind(kind):
154 return "mojo::ScopedMessagePipeHandle" 158 return "mojo::ScopedMessagePipeHandle"
155 if kind.spec == 'h:s': 159 if mojom.IsSharedBufferKind(kind):
156 return "mojo::ScopedSharedBufferHandle" 160 return "mojo::ScopedSharedBufferHandle"
157 return _kind_to_cpp_type[kind] 161 return _kind_to_cpp_type[kind]
158 162
159 def GetCppConstWrapperType(kind): 163 def GetCppConstWrapperType(kind):
160 if isinstance(kind, mojom.Struct): 164 if mojom.IsStructKind(kind):
161 return "%sPtr" % GetNameForKind(kind) 165 return "%sPtr" % GetNameForKind(kind)
162 if isinstance(kind, (mojom.Array, mojom.FixedArray)): 166 if mojom.IsAnyArrayKind(kind):
163 return "mojo::Array<%s>" % GetCppArrayArgWrapperType(kind.kind) 167 return "mojo::Array<%s>" % GetCppArrayArgWrapperType(kind.kind)
164 if isinstance(kind, mojom.Interface): 168 if mojom.IsInterfaceKind(kind):
165 return "%sPtr" % GetNameForKind(kind) 169 return "%sPtr" % GetNameForKind(kind)
166 if isinstance(kind, mojom.InterfaceRequest): 170 if mojom.IsInterfaceRequestKind(kind):
167 return "mojo::InterfaceRequest<%s>" % GetNameForKind(kind.kind) 171 return "mojo::InterfaceRequest<%s>" % GetNameForKind(kind.kind)
168 if isinstance(kind, mojom.Enum): 172 if mojom.IsEnumKind(kind):
169 return GetNameForKind(kind) 173 return GetNameForKind(kind)
170 if kind.spec == 's': 174 if mojom.IsStringKind(kind):
171 return "const mojo::String&" 175 return "const mojo::String&"
172 if kind.spec == 'h': 176 if mojom.IsHandleKind(kind):
173 return "mojo::ScopedHandle" 177 return "mojo::ScopedHandle"
174 if kind.spec == 'h:d:c': 178 if mojom.IsDataPipeConsumerKind(kind):
175 return "mojo::ScopedDataPipeConsumerHandle" 179 return "mojo::ScopedDataPipeConsumerHandle"
176 if kind.spec == 'h:d:p': 180 if mojom.IsDataPipeProducerKind(kind):
177 return "mojo::ScopedDataPipeProducerHandle" 181 return "mojo::ScopedDataPipeProducerHandle"
178 if kind.spec == 'h:m': 182 if mojom.IsMessagePipeKind(kind):
179 return "mojo::ScopedMessagePipeHandle" 183 return "mojo::ScopedMessagePipeHandle"
180 if kind.spec == 'h:s': 184 if mojom.IsSharedBufferKind(kind):
181 return "mojo::ScopedSharedBufferHandle" 185 return "mojo::ScopedSharedBufferHandle"
182 if not kind in _kind_to_cpp_type: 186 if not kind in _kind_to_cpp_type:
183 print "missing:", kind.spec 187 print "missing:", kind.spec
184 return _kind_to_cpp_type[kind] 188 return _kind_to_cpp_type[kind]
185 189
186 def GetCppFieldType(kind): 190 def GetCppFieldType(kind):
187 if isinstance(kind, mojom.Struct): 191 if mojom.IsStructKind(kind):
188 return ("mojo::internal::StructPointer<%s_Data>" % 192 return ("mojo::internal::StructPointer<%s_Data>" %
189 GetNameForKind(kind, internal=True)) 193 GetNameForKind(kind, internal=True))
190 if isinstance(kind, (mojom.Array, mojom.FixedArray)): 194 if mojom.IsAnyArrayKind(kind):
191 return "mojo::internal::ArrayPointer<%s>" % GetCppType(kind.kind) 195 return "mojo::internal::ArrayPointer<%s>" % GetCppType(kind.kind)
192 if isinstance(kind, mojom.Interface) or \ 196 if mojom.IsInterfaceKind(kind) or mojom.IsInterfaceRequestKind(kind):
193 isinstance(kind, mojom.InterfaceRequest):
194 return "mojo::MessagePipeHandle" 197 return "mojo::MessagePipeHandle"
195 if isinstance(kind, mojom.Enum): 198 if mojom.IsEnumKind(kind):
196 return GetNameForKind(kind) 199 return GetNameForKind(kind)
197 if kind.spec == 's': 200 if mojom.IsStringKind(kind):
198 return "mojo::internal::StringPointer" 201 return "mojo::internal::StringPointer"
199 return _kind_to_cpp_type[kind] 202 return _kind_to_cpp_type[kind]
200 203
201 def IsStructWithHandles(struct): 204 def IsStructWithHandles(struct):
202 for pf in struct.packed.packed_fields: 205 for pf in struct.packed.packed_fields:
203 if generator.IsHandleKind(pf.field.kind): 206 if mojom.IsAnyHandleKind(pf.field.kind):
204 return True 207 return True
205 return False 208 return False
206 209
207 def TranslateConstants(token, kind): 210 def TranslateConstants(token, kind):
208 if isinstance(token, (mojom.NamedValue, mojom.EnumValue)): 211 if isinstance(token, mojom.NamedValue):
209 # Both variable and enum constants are constructed like: 212 # Both variable and enum constants are constructed like:
210 # Namespace::Struct::CONSTANT_NAME 213 # Namespace::Struct::CONSTANT_NAME
211 # For enums, CONSTANT_NAME is ENUM_NAME_ENUM_VALUE. 214 # For enums, CONSTANT_NAME is ENUM_NAME_ENUM_VALUE.
212 name = [] 215 name = []
213 if token.imported_from: 216 if token.imported_from:
214 name.extend(NamespaceToArray(token.namespace)) 217 name.extend(NamespaceToArray(token.namespace))
215 if token.parent_kind: 218 if token.parent_kind:
216 name.append(token.parent_kind.name) 219 name.append(token.parent_kind.name)
217 if isinstance(token, mojom.EnumValue): 220 if isinstance(token, mojom.EnumValue):
218 name.append( 221 name.append(
(...skipping 10 matching lines...) Expand all
229 for method in interface.methods: 232 for method in interface.methods:
230 if method.response_parameters != None: 233 if method.response_parameters != None:
231 return True 234 return True
232 return False 235 return False
233 236
234 def ShouldInlineStruct(struct): 237 def ShouldInlineStruct(struct):
235 # TODO(darin): Base this on the size of the wrapper class. 238 # TODO(darin): Base this on the size of the wrapper class.
236 if len(struct.fields) > 4: 239 if len(struct.fields) > 4:
237 return False 240 return False
238 for field in struct.fields: 241 for field in struct.fields:
239 if generator.IsHandleKind(field.kind) or generator.IsObjectKind(field.kind): 242 if mojom.IsMoveOnlyKind(field.kind):
240 return False 243 return False
241 return True 244 return True
242 245
243 _HEADER_SIZE = 8 246 _HEADER_SIZE = 8
244 247
245 class Generator(generator.Generator): 248 class Generator(generator.Generator):
246 249
247 cpp_filters = { 250 cpp_filters = {
248 "constant_value": ConstantValue, 251 "constant_value": ConstantValue,
249 "cpp_const_wrapper_type": GetCppConstWrapperType, 252 "cpp_const_wrapper_type": GetCppConstWrapperType,
250 "cpp_field_type": GetCppFieldType, 253 "cpp_field_type": GetCppFieldType,
251 "cpp_pod_type": GetCppPodType, 254 "cpp_pod_type": GetCppPodType,
252 "cpp_result_type": GetCppResultWrapperType, 255 "cpp_result_type": GetCppResultWrapperType,
253 "cpp_type": GetCppType, 256 "cpp_type": GetCppType,
254 "cpp_wrapper_type": GetCppWrapperType, 257 "cpp_wrapper_type": GetCppWrapperType,
255 "default_value": DefaultValue, 258 "default_value": DefaultValue,
256 "expected_array_size": generator.ExpectedArraySize, 259 "expected_array_size": generator.ExpectedArraySize,
257 "expression_to_text": ExpressionToText, 260 "expression_to_text": ExpressionToText,
258 "get_name_for_kind": GetNameForKind, 261 "get_name_for_kind": GetNameForKind,
259 "get_pad": pack.GetPad, 262 "get_pad": pack.GetPad,
260 "has_callbacks": HasCallbacks, 263 "has_callbacks": HasCallbacks,
261 "should_inline": ShouldInlineStruct, 264 "should_inline": ShouldInlineStruct,
262 "is_array_kind": generator.IsArrayKind, 265 "is_any_array_kind": mojom.IsAnyArrayKind,
263 "is_enum_kind": generator.IsEnumKind, 266 "is_enum_kind": mojom.IsEnumKind,
264 "is_move_only_kind": generator.IsMoveOnlyKind, 267 "is_move_only_kind": mojom.IsMoveOnlyKind,
265 "is_handle_kind": generator.IsHandleKind, 268 "is_any_handle_kind": mojom.IsAnyHandleKind,
266 "is_interface_kind": generator.IsInterfaceKind, 269 "is_interface_kind": mojom.IsInterfaceKind,
267 "is_interface_request_kind": generator.IsInterfaceRequestKind, 270 "is_interface_request_kind": mojom.IsInterfaceRequestKind,
268 "is_object_kind": generator.IsObjectKind, 271 "is_object_kind": mojom.IsObjectKind,
269 "is_string_kind": generator.IsStringKind, 272 "is_string_kind": mojom.IsStringKind,
270 "is_struct_with_handles": IsStructWithHandles, 273 "is_struct_with_handles": IsStructWithHandles,
271 "struct_size": lambda ps: ps.GetTotalSize() + _HEADER_SIZE, 274 "struct_size": lambda ps: ps.GetTotalSize() + _HEADER_SIZE,
272 "struct_from_method": generator.GetStructFromMethod, 275 "struct_from_method": generator.GetStructFromMethod,
273 "response_struct_from_method": generator.GetResponseStructFromMethod, 276 "response_struct_from_method": generator.GetResponseStructFromMethod,
274 "stylize_method": generator.StudlyCapsToCamel, 277 "stylize_method": generator.StudlyCapsToCamel,
275 "to_all_caps": generator.CamelCaseToAllCaps, 278 "to_all_caps": generator.CamelCaseToAllCaps,
276 } 279 }
277 280
278 def GetJinjaExports(self): 281 def GetJinjaExports(self):
279 return { 282 return {
(...skipping 17 matching lines...) Expand all
297 300
298 @UseJinja("cpp_templates/module.cc.tmpl", filters=cpp_filters) 301 @UseJinja("cpp_templates/module.cc.tmpl", filters=cpp_filters)
299 def GenerateModuleSource(self): 302 def GenerateModuleSource(self):
300 return self.GetJinjaExports() 303 return self.GetJinjaExports()
301 304
302 def GenerateFiles(self, args): 305 def GenerateFiles(self, args):
303 self.Write(self.GenerateModuleHeader(), "%s.h" % self.module.name) 306 self.Write(self.GenerateModuleHeader(), "%s.h" % self.module.name)
304 self.Write(self.GenerateModuleInternalHeader(), 307 self.Write(self.GenerateModuleInternalHeader(),
305 "%s-internal.h" % self.module.name) 308 "%s-internal.h" % self.module.name)
306 self.Write(self.GenerateModuleSource(), "%s.cc" % self.module.name) 309 self.Write(self.GenerateModuleSource(), "%s.cc" % self.module.name)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698