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

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

Issue 10435003: Add support for 'nocompile' to IDL schema compiler. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review fixes, and rebased Created 8 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « tools/json_schema_compiler/model.py ('k') | tools/json_schema_compiler/test/idl_basics.idl » ('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 7
8 import json 8 import json
9 import os 9 import os
10 import re 10 import re
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 def CapitalizeFirstLetter(self, value): 72 def CapitalizeFirstLetter(self, value):
73 return value[0].capitalize() + value[1:] 73 return value[0].capitalize() + value[1:]
74 74
75 def GenerateFunctionRegistry(self): 75 def GenerateFunctionRegistry(self):
76 c = code.Code() 76 c = code.Code()
77 c.Sblock("class GeneratedFunctionRegistry {") 77 c.Sblock("class GeneratedFunctionRegistry {")
78 c.Append("public:") 78 c.Append("public:")
79 c.Sblock("static void RegisterAll(ExtensionFunctionRegistry* registry) {") 79 c.Sblock("static void RegisterAll(ExtensionFunctionRegistry* registry) {")
80 for namespace in self._model.namespaces.values(): 80 for namespace in self._model.namespaces.values():
81 for function in namespace.functions.values(): 81 for function in namespace.functions.values():
82 if function.nocompile:
83 continue
82 namespace_name = self.CapitalizeFirstLetter(namespace.name.replace( 84 namespace_name = self.CapitalizeFirstLetter(namespace.name.replace(
83 "experimental.", "")) 85 "experimental.", ""))
84 function_name = namespace_name + self.CapitalizeFirstLetter( 86 function_name = namespace_name + self.CapitalizeFirstLetter(
85 function.name) 87 function.name)
86 c.Append("registry->RegisterFunction<%sFunction>();" % ( 88 c.Append("registry->RegisterFunction<%sFunction>();" % (
87 function_name)) 89 function_name))
88 c.Eblock("}") 90 c.Eblock("}")
89 c.Eblock("};") 91 c.Eblock("};")
90 c.Append() 92 c.Append()
91 return c 93 return c
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 for index, line in enumerate(lines): 137 for index, line in enumerate(lines):
136 line = ' "%s"' % line 138 line = ' "%s"' % line
137 if index == len(lines) - 1: 139 if index == len(lines) - 1:
138 line += ';' 140 line += ';'
139 c.Append(line) 141 c.Append(line)
140 c.Eblock('}') 142 c.Eblock('}')
141 c.Append() 143 c.Append()
142 c.Concat(self._cpp_type_generator.GetRootNamespaceEnd()) 144 c.Concat(self._cpp_type_generator.GetRootNamespaceEnd())
143 c.Append() 145 c.Append()
144 return c 146 return c
OLDNEW
« no previous file with comments | « tools/json_schema_compiler/model.py ('k') | tools/json_schema_compiler/test/idl_basics.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698