| OLD | NEW |
| 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 |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 "cpp_wrapper_type": GetCppWrapperType, | 282 "cpp_wrapper_type": GetCppWrapperType, |
| 283 "default_value": DefaultValue, | 283 "default_value": DefaultValue, |
| 284 "expected_array_size": generator.ExpectedArraySize, | 284 "expected_array_size": generator.ExpectedArraySize, |
| 285 "expression_to_text": ExpressionToText, | 285 "expression_to_text": ExpressionToText, |
| 286 "get_array_validate_params": GetArrayValidateParams, | 286 "get_array_validate_params": GetArrayValidateParams, |
| 287 "get_name_for_kind": GetNameForKind, | 287 "get_name_for_kind": GetNameForKind, |
| 288 "get_pad": pack.GetPad, | 288 "get_pad": pack.GetPad, |
| 289 "has_callbacks": mojom.HasCallbacks, | 289 "has_callbacks": mojom.HasCallbacks, |
| 290 "should_inline": ShouldInlineStruct, | 290 "should_inline": ShouldInlineStruct, |
| 291 "is_any_array_kind": mojom.IsAnyArrayKind, | 291 "is_any_array_kind": mojom.IsAnyArrayKind, |
| 292 "is_cloneable_kind": mojom.IsCloneableKind, |
| 292 "is_enum_kind": mojom.IsEnumKind, | 293 "is_enum_kind": mojom.IsEnumKind, |
| 293 "is_move_only_kind": mojom.IsMoveOnlyKind, | 294 "is_move_only_kind": mojom.IsMoveOnlyKind, |
| 294 "is_any_handle_kind": mojom.IsAnyHandleKind, | 295 "is_any_handle_kind": mojom.IsAnyHandleKind, |
| 295 "is_interface_kind": mojom.IsInterfaceKind, | 296 "is_interface_kind": mojom.IsInterfaceKind, |
| 296 "is_interface_request_kind": mojom.IsInterfaceRequestKind, | 297 "is_interface_request_kind": mojom.IsInterfaceRequestKind, |
| 297 "is_nullable_kind": mojom.IsNullableKind, | 298 "is_nullable_kind": mojom.IsNullableKind, |
| 298 "is_object_kind": mojom.IsObjectKind, | 299 "is_object_kind": mojom.IsObjectKind, |
| 299 "is_string_kind": mojom.IsStringKind, | 300 "is_string_kind": mojom.IsStringKind, |
| 301 "is_struct_kind": mojom.IsStructKind, |
| 300 "is_struct_with_handles": IsStructWithHandles, | 302 "is_struct_with_handles": IsStructWithHandles, |
| 301 "struct_size": lambda ps: ps.GetTotalSize() + _HEADER_SIZE, | 303 "struct_size": lambda ps: ps.GetTotalSize() + _HEADER_SIZE, |
| 302 "struct_from_method": generator.GetStructFromMethod, | 304 "struct_from_method": generator.GetStructFromMethod, |
| 303 "response_struct_from_method": generator.GetResponseStructFromMethod, | 305 "response_struct_from_method": generator.GetResponseStructFromMethod, |
| 304 "stylize_method": generator.StudlyCapsToCamel, | 306 "stylize_method": generator.StudlyCapsToCamel, |
| 305 "to_all_caps": generator.CamelCaseToAllCaps, | 307 "to_all_caps": generator.CamelCaseToAllCaps, |
| 306 } | 308 } |
| 307 | 309 |
| 308 def GetJinjaExports(self): | 310 def GetJinjaExports(self): |
| 309 return { | 311 return { |
| (...skipping 17 matching lines...) Expand all Loading... |
| 327 | 329 |
| 328 @UseJinja("cpp_templates/module.cc.tmpl", filters=cpp_filters) | 330 @UseJinja("cpp_templates/module.cc.tmpl", filters=cpp_filters) |
| 329 def GenerateModuleSource(self): | 331 def GenerateModuleSource(self): |
| 330 return self.GetJinjaExports() | 332 return self.GetJinjaExports() |
| 331 | 333 |
| 332 def GenerateFiles(self, args): | 334 def GenerateFiles(self, args): |
| 333 self.Write(self.GenerateModuleHeader(), "%s.h" % self.module.name) | 335 self.Write(self.GenerateModuleHeader(), "%s.h" % self.module.name) |
| 334 self.Write(self.GenerateModuleInternalHeader(), | 336 self.Write(self.GenerateModuleInternalHeader(), |
| 335 "%s-internal.h" % self.module.name) | 337 "%s-internal.h" % self.module.name) |
| 336 self.Write(self.GenerateModuleSource(), "%s.cc" % self.module.name) | 338 self.Write(self.GenerateModuleSource(), "%s.cc" % self.module.name) |
| OLD | NEW |