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

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

Issue 622593002: mojo: Allow circular dependencies between structs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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
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
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 "should_inline": ShouldInlineStruct, 290 "should_inline": ShouldInlineStruct,
291 "is_any_array_kind": mojom.IsAnyArrayKind, 291 "is_any_array_kind": mojom.IsAnyArrayKind,
292 "is_enum_kind": mojom.IsEnumKind, 292 "is_enum_kind": mojom.IsEnumKind,
293 "is_move_only_kind": mojom.IsMoveOnlyKind, 293 "is_move_only_kind": mojom.IsMoveOnlyKind,
294 "is_any_handle_kind": mojom.IsAnyHandleKind, 294 "is_any_handle_kind": mojom.IsAnyHandleKind,
295 "is_interface_kind": mojom.IsInterfaceKind, 295 "is_interface_kind": mojom.IsInterfaceKind,
296 "is_interface_request_kind": mojom.IsInterfaceRequestKind, 296 "is_interface_request_kind": mojom.IsInterfaceRequestKind,
297 "is_nullable_kind": mojom.IsNullableKind, 297 "is_nullable_kind": mojom.IsNullableKind,
298 "is_object_kind": mojom.IsObjectKind, 298 "is_object_kind": mojom.IsObjectKind,
299 "is_string_kind": mojom.IsStringKind, 299 "is_string_kind": mojom.IsStringKind,
300 "is_struct_kind": mojom.IsStructKind,
300 "is_struct_with_handles": IsStructWithHandles, 301 "is_struct_with_handles": IsStructWithHandles,
301 "struct_size": lambda ps: ps.GetTotalSize() + _HEADER_SIZE, 302 "struct_size": lambda ps: ps.GetTotalSize() + _HEADER_SIZE,
302 "struct_from_method": generator.GetStructFromMethod, 303 "struct_from_method": generator.GetStructFromMethod,
303 "response_struct_from_method": generator.GetResponseStructFromMethod, 304 "response_struct_from_method": generator.GetResponseStructFromMethod,
304 "stylize_method": generator.StudlyCapsToCamel, 305 "stylize_method": generator.StudlyCapsToCamel,
305 "to_all_caps": generator.CamelCaseToAllCaps, 306 "to_all_caps": generator.CamelCaseToAllCaps,
306 } 307 }
307 308
308 def GetJinjaExports(self): 309 def GetJinjaExports(self):
309 return { 310 return {
(...skipping 17 matching lines...) Expand all
327 328
328 @UseJinja("cpp_templates/module.cc.tmpl", filters=cpp_filters) 329 @UseJinja("cpp_templates/module.cc.tmpl", filters=cpp_filters)
329 def GenerateModuleSource(self): 330 def GenerateModuleSource(self):
330 return self.GetJinjaExports() 331 return self.GetJinjaExports()
331 332
332 def GenerateFiles(self, args): 333 def GenerateFiles(self, args):
333 self.Write(self.GenerateModuleHeader(), "%s.h" % self.module.name) 334 self.Write(self.GenerateModuleHeader(), "%s.h" % self.module.name)
334 self.Write(self.GenerateModuleInternalHeader(), 335 self.Write(self.GenerateModuleInternalHeader(),
335 "%s-internal.h" % self.module.name) 336 "%s-internal.h" % self.module.name)
336 self.Write(self.GenerateModuleSource(), "%s.cc" % self.module.name) 337 self.Write(self.GenerateModuleSource(), "%s.cc" % self.module.name)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698