OLD | NEW |
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 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 import code | 5 import code |
6 import cpp_util | 6 import cpp_util |
7 from model import Platforms | 7 from model import Platforms |
8 from schema_util import CapitalizeFirstLetter | 8 from schema_util import CapitalizeFirstLetter |
9 from schema_util import JsFunctionNameToClassName | 9 from schema_util import JsFunctionNameToClassName |
10 | 10 |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 class _APICCGenerator(object): | 176 class _APICCGenerator(object): |
177 """Generates a code.Code object for the generated API .cc file""" | 177 """Generates a code.Code object for the generated API .cc file""" |
178 | 178 |
179 def __init__(self, cpp_bundle): | 179 def __init__(self, cpp_bundle): |
180 self._bundle = cpp_bundle | 180 self._bundle = cpp_bundle |
181 | 181 |
182 def Generate(self, _): # namespace not relevant, this is a bundle | 182 def Generate(self, _): # namespace not relevant, this is a bundle |
183 c = code.Code() | 183 c = code.Code() |
184 c.Append(cpp_util.CHROMIUM_LICENSE) | 184 c.Append(cpp_util.CHROMIUM_LICENSE) |
185 c.Append() | 185 c.Append() |
186 c.Append('#include "%s"' % (os.path.join(self._bundle._source_file_dir, | 186 c.Append('#include "%s"' % ( |
187 'generated_api.h'))) | 187 os.path.join(self._bundle._impl_dir, |
| 188 'generated_api_registration.h'))) |
188 c.Append() | 189 c.Append() |
189 for namespace in self._bundle._model.namespaces.values(): | 190 for namespace in self._bundle._model.namespaces.values(): |
190 namespace_name = namespace.unix_name.replace("experimental_", "") | 191 namespace_name = namespace.unix_name.replace("experimental_", "") |
191 implementation_header = namespace.compiler_options.get( | 192 implementation_header = namespace.compiler_options.get( |
192 "implemented_in", | 193 "implemented_in", |
193 "%s/%s/%s_api.h" % (self._bundle._impl_dir, | 194 "%s/%s/%s_api.h" % (self._bundle._impl_dir, |
194 namespace_name, | 195 namespace_name, |
195 namespace_name)) | 196 namespace_name)) |
196 if not os.path.exists( | 197 if not os.path.exists( |
197 os.path.join(self._bundle._root, | 198 os.path.join(self._bundle._root, |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 c.Eblock('}') | 313 c.Eblock('}') |
313 c.Append() | 314 c.Append() |
314 c.Append('// static') | 315 c.Append('// static') |
315 c.Sblock('bool GeneratedSchemas::IsGenerated(std::string name) {') | 316 c.Sblock('bool GeneratedSchemas::IsGenerated(std::string name) {') |
316 c.Append('return g_lazy_instance.Get().schemas.count(name) > 0;') | 317 c.Append('return g_lazy_instance.Get().schemas.count(name) > 0;') |
317 c.Eblock('}') | 318 c.Eblock('}') |
318 c.Append() | 319 c.Append() |
319 c.Concat(cpp_util.CloseNamespace(self._bundle._cpp_namespace)) | 320 c.Concat(cpp_util.CloseNamespace(self._bundle._cpp_namespace)) |
320 c.Append() | 321 c.Append() |
321 return c | 322 return c |
OLD | NEW |