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

Side by Side Diff: tools/json_schema_compiler/cpp_bundle_generator.py

Issue 506253003: Revert "Split bundle generation steps so that API registration is generated in browser, not common." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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
« no previous file with comments | « tools/json_schema_compiler/compiler.py ('k') | ui/accessibility/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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"' % ( 186 c.Append('#include "%s"' % (os.path.join(self._bundle._source_file_dir,
187 os.path.join(self._bundle._impl_dir, 187 'generated_api.h')))
188 'generated_api_registration.h')))
189 c.Append() 188 c.Append()
190 for namespace in self._bundle._model.namespaces.values(): 189 for namespace in self._bundle._model.namespaces.values():
191 namespace_name = namespace.unix_name.replace("experimental_", "") 190 namespace_name = namespace.unix_name.replace("experimental_", "")
192 implementation_header = namespace.compiler_options.get( 191 implementation_header = namespace.compiler_options.get(
193 "implemented_in", 192 "implemented_in",
194 "%s/%s/%s_api.h" % (self._bundle._impl_dir, 193 "%s/%s/%s_api.h" % (self._bundle._impl_dir,
195 namespace_name, 194 namespace_name,
196 namespace_name)) 195 namespace_name))
197 if not os.path.exists( 196 if not os.path.exists(
198 os.path.join(self._bundle._root, 197 os.path.join(self._bundle._root,
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 c.Eblock('}') 312 c.Eblock('}')
314 c.Append() 313 c.Append()
315 c.Append('// static') 314 c.Append('// static')
316 c.Sblock('bool GeneratedSchemas::IsGenerated(std::string name) {') 315 c.Sblock('bool GeneratedSchemas::IsGenerated(std::string name) {')
317 c.Append('return g_lazy_instance.Get().schemas.count(name) > 0;') 316 c.Append('return g_lazy_instance.Get().schemas.count(name) > 0;')
318 c.Eblock('}') 317 c.Eblock('}')
319 c.Append() 318 c.Append()
320 c.Concat(cpp_util.CloseNamespace(self._bundle._cpp_namespace)) 319 c.Concat(cpp_util.CloseNamespace(self._bundle._cpp_namespace))
321 c.Append() 320 c.Append()
322 return c 321 return c
OLDNEW
« no previous file with comments | « tools/json_schema_compiler/compiler.py ('k') | ui/accessibility/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698