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 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
404 "is_associated_interface_kind": mojom.IsAssociatedInterfaceKind, | 404 "is_associated_interface_kind": mojom.IsAssociatedInterfaceKind, |
405 "is_associated_interface_request_kind": | 405 "is_associated_interface_request_kind": |
406 mojom.IsAssociatedInterfaceRequestKind, | 406 mojom.IsAssociatedInterfaceRequestKind, |
407 "is_associated_kind": mojom.IsAssociatedKind, | 407 "is_associated_kind": mojom.IsAssociatedKind, |
408 "is_map_kind": mojom.IsMapKind, | 408 "is_map_kind": mojom.IsMapKind, |
409 "is_nullable_kind": mojom.IsNullableKind, | 409 "is_nullable_kind": mojom.IsNullableKind, |
410 "is_object_kind": mojom.IsObjectKind, | 410 "is_object_kind": mojom.IsObjectKind, |
411 "is_string_kind": mojom.IsStringKind, | 411 "is_string_kind": mojom.IsStringKind, |
412 "is_struct_kind": mojom.IsStructKind, | 412 "is_struct_kind": mojom.IsStructKind, |
413 "is_union_kind": mojom.IsUnionKind, | 413 "is_union_kind": mojom.IsUnionKind, |
| 414 "passes_associated_kinds": mojom.PassesAssociatedKinds, |
414 "struct_size": lambda ps: ps.GetTotalSize() + _HEADER_SIZE, | 415 "struct_size": lambda ps: ps.GetTotalSize() + _HEADER_SIZE, |
415 "stylize_method": generator.StudlyCapsToCamel, | 416 "stylize_method": generator.StudlyCapsToCamel, |
416 "to_all_caps": generator.CamelCaseToAllCaps, | 417 "to_all_caps": generator.CamelCaseToAllCaps, |
417 "under_to_camel": generator.UnderToCamel, | 418 "under_to_camel": generator.UnderToCamel, |
418 } | 419 } |
419 | 420 |
420 def GetJinjaExports(self): | 421 def GetJinjaExports(self): |
421 return { | 422 return { |
422 "module": self.module, | 423 "module": self.module, |
423 "namespace": self.module.namespace, | 424 "namespace": self.module.namespace, |
(...skipping 18 matching lines...) Expand all Loading... |
442 def GenerateModuleSource(self): | 443 def GenerateModuleSource(self): |
443 return self.GetJinjaExports() | 444 return self.GetJinjaExports() |
444 | 445 |
445 def GenerateFiles(self, args): | 446 def GenerateFiles(self, args): |
446 self.Write(self.GenerateModuleHeader(), | 447 self.Write(self.GenerateModuleHeader(), |
447 self.MatchMojomFilePath("%s.h" % self.module.name)) | 448 self.MatchMojomFilePath("%s.h" % self.module.name)) |
448 self.Write(self.GenerateModuleInternalHeader(), | 449 self.Write(self.GenerateModuleInternalHeader(), |
449 self.MatchMojomFilePath("%s-internal.h" % self.module.name)) | 450 self.MatchMojomFilePath("%s-internal.h" % self.module.name)) |
450 self.Write(self.GenerateModuleSource(), | 451 self.Write(self.GenerateModuleSource(), |
451 self.MatchMojomFilePath("%s.cc" % self.module.name)) | 452 self.MatchMojomFilePath("%s.cc" % self.module.name)) |
OLD | NEW |