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

Unified Diff: tools/json_schema_compiler/schema_bundle_generator.py

Issue 12181005: generated_api.h should have its body generated into generated_api.cc (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 7 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/json_schema_compiler/compiler.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/json_schema_compiler/schema_bundle_generator.py
diff --git a/tools/json_schema_compiler/schema_bundle_generator.py b/tools/json_schema_compiler/schema_bundle_generator.py
index e9fb9267935db4da8fd71daf6651e725e88edf46..23926dc297f3a1c8a5bc2eef6325fa62c7c00a26 100644
--- a/tools/json_schema_compiler/schema_bundle_generator.py
+++ b/tools/json_schema_compiler/schema_bundle_generator.py
@@ -83,7 +83,31 @@ class SchemaBundleGenerator(object):
c.Append('#include <string>')
c.Append()
c.Append('#include "base/basictypes.h"')
+ c.Append()
+ c.Append("class ExtensionFunctionRegistry;")
+ c.Append()
+ c.Concat(self._cpp_type_generator.GetRootNamespaceStart())
+ for namespace in self._model.namespaces.values():
+ c.Append("// TODO(miket): emit code for %s" % (namespace.unix_name))
not at google - send to devlin 2013/02/04 16:57:24 I don't know what this TODO means and it has no bu
+ c.Append()
+ c.Sblock('class GeneratedFunctionRegistry {')
+ c.Append(' public:')
+ c.Append('static void RegisterAll('
+ 'ExtensionFunctionRegistry* registry);')
not at google - send to devlin 2013/02/04 16:57:24 C++ indentation here needs fixing (and line above)
+ c.Eblock('};');
+ c.Append()
+ c.Concat(self._cpp_type_generator.GetRootNamespaceEnd())
+ c.Append()
+ return self.GenerateHeader('generated_api', c)
+ def GenerateAPICC(self):
+ """Generates a code.Code object for the generated API .cc file"""
+ c = code.Code()
+ c.Append(cpp_util.CHROMIUM_LICENSE)
+ c.Append()
+ c.Append('#include "%s"' % (os.path.join(SOURCE_BASE_PATH,
+ 'generated_api.h')))
+ c.Append()
for namespace in self._model.namespaces.values():
namespace_name = namespace.unix_name.replace("experimental_", "")
implementation_header = namespace.compiler_options.get(
@@ -105,19 +129,17 @@ class SchemaBundleGenerator(object):
if ifdefs is not None:
c.Append("#endif // %s" % ifdefs, indent_level=0)
-
c.Append()
- c.Append("class ExtensionFunctionRegistry;")
+ c.Append('#include '
+ '"chrome/browser/extensions/extension_function_registry.h"')
c.Append()
-
c.Concat(self._cpp_type_generator.GetRootNamespaceStart())
- for namespace in self._model.namespaces.values():
- c.Append("// TODO(miket): emit code for %s" % (namespace.unix_name))
c.Append()
- c.Concat(self.GenerateFunctionRegistry())
+ c.Concat(self.GenerateFunctionRegistryRegisterAll())
+ c.Append()
c.Concat(self._cpp_type_generator.GetRootNamespaceEnd())
c.Append()
- return self.GenerateHeader('generated_api', c)
+ return c
def _GetNamespaceFunctions(self, namespace):
functions = list(namespace.functions.values())
@@ -126,11 +148,11 @@ class SchemaBundleGenerator(object):
functions += list(type_.functions.values())
return functions
- def GenerateFunctionRegistry(self):
+ def GenerateFunctionRegistryRegisterAll(self):
not at google - send to devlin 2013/02/04 16:57:24 _GenerateFunctionRegistryRegisterAll
c = code.Code()
- c.Sblock("class GeneratedFunctionRegistry {")
- c.Append(" public:")
- c.Sblock("static void RegisterAll(ExtensionFunctionRegistry* registry) {")
+ c.Append('// static')
+ c.Sblock('void GeneratedFunctionRegistry::RegisterAll('
+ 'ExtensionFunctionRegistry* registry) {')
for namespace in self._model.namespaces.values():
namespace_ifdefs = self._GetPlatformIfdefs(namespace)
if namespace_ifdefs is not None:
@@ -155,8 +177,6 @@ class SchemaBundleGenerator(object):
if namespace_ifdefs is not None:
c.Append("#endif // %s" % namespace_ifdefs, indent_level=0)
c.Eblock("}")
- c.Eblock("};")
- c.Append()
return c
def GenerateSchemasHeader(self):
« no previous file with comments | « tools/json_schema_compiler/compiler.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698