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

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

Issue 2635153002: Pref service: expose all read-only PrefStores through Mojo (Closed)
Patch Set: Remove debug print Created 3 years, 9 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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 145
146 def NamespaceToArray(namespace): 146 def NamespaceToArray(namespace):
147 return namespace.split(".") if namespace else [] 147 return namespace.split(".") if namespace else []
148 148
149 def GetNameForKind(kind, internal=False, flatten_nested_kind=False, 149 def GetNameForKind(kind, internal=False, flatten_nested_kind=False,
150 add_same_module_namespaces=False): 150 add_same_module_namespaces=False):
151 return _NameFormatter(kind, _variant).FormatForCpp( 151 return _NameFormatter(kind, _variant).FormatForCpp(
152 internal=internal, flatten_nested_kind=flatten_nested_kind, 152 internal=internal, flatten_nested_kind=flatten_nested_kind,
153 add_same_module_namespaces=add_same_module_namespaces) 153 add_same_module_namespaces=add_same_module_namespaces)
154 154
155 def GetQualifiedNameForKind(kind, internal=False, flatten_nested_kind=False): 155 def GetQualifiedNameForKind(kind, internal=False, flatten_nested_kind=False,
156 return _NameFormatter(kind, _variant).FormatForCpp( 156 include_variant=True):
157 internal=internal, add_same_module_namespaces=True, 157 return _NameFormatter(
158 flatten_nested_kind=flatten_nested_kind) 158 kind, _variant if include_variant else None).FormatForCpp(
159 internal=internal, add_same_module_namespaces=True,
160 flatten_nested_kind=flatten_nested_kind)
159 161
160 def GetFullMojomNameForKind(kind): 162 def GetFullMojomNameForKind(kind):
161 return _NameFormatter(kind, _variant).FormatForMojom() 163 return _NameFormatter(kind, _variant).FormatForMojom()
162 164
163 def IsTypemappedKind(kind): 165 def IsTypemappedKind(kind):
164 return hasattr(kind, "name") and \ 166 return hasattr(kind, "name") and \
165 GetFullMojomNameForKind(kind) in _current_typemap 167 GetFullMojomNameForKind(kind) in _current_typemap
166 168
167 def IsNativeOnlyKind(kind): 169 def IsNativeOnlyKind(kind):
168 return (mojom.IsStructKind(kind) or mojom.IsEnumKind(kind)) and \ 170 return (mojom.IsStructKind(kind) or mojom.IsEnumKind(kind)) and \
(...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after
729 global _use_once_callback 731 global _use_once_callback
730 _use_once_callback = self.use_once_callback 732 _use_once_callback = self.use_once_callback
731 global _variant 733 global _variant
732 _variant = self.variant 734 _variant = self.variant
733 suffix = "-%s" % self.variant if self.variant else "" 735 suffix = "-%s" % self.variant if self.variant else ""
734 self.Write(self.GenerateModuleHeader(), 736 self.Write(self.GenerateModuleHeader(),
735 self.MatchMojomFilePath("%s%s.h" % (self.module.name, suffix))) 737 self.MatchMojomFilePath("%s%s.h" % (self.module.name, suffix)))
736 self.Write( 738 self.Write(
737 self.GenerateModuleSource(), 739 self.GenerateModuleSource(),
738 self.MatchMojomFilePath("%s%s.cc" % (self.module.name, suffix))) 740 self.MatchMojomFilePath("%s%s.cc" % (self.module.name, suffix)))
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698