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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 def _GenerateFunctionRegistryRegisterAll(self): | 118 def _GenerateFunctionRegistryRegisterAll(self): |
119 c = code.Code() | 119 c = code.Code() |
120 c.Append('// static') | 120 c.Append('// static') |
121 c.Sblock('void GeneratedFunctionRegistry::RegisterAll(' | 121 c.Sblock('void GeneratedFunctionRegistry::RegisterAll(' |
122 'ExtensionFunctionRegistry* registry) {') | 122 'ExtensionFunctionRegistry* registry) {') |
123 for namespace in self._model.namespaces.values(): | 123 for namespace in self._model.namespaces.values(): |
124 namespace_ifdefs = self._GetPlatformIfdefs(namespace) | 124 namespace_ifdefs = self._GetPlatformIfdefs(namespace) |
125 if namespace_ifdefs is not None: | 125 if namespace_ifdefs is not None: |
126 c.Append("#if %s" % namespace_ifdefs, indent_level=0) | 126 c.Append("#if %s" % namespace_ifdefs, indent_level=0) |
127 | 127 |
128 namespace_name = CapitalizeFirstLetter(namespace.name.replace( | |
129 "experimental.", "")) | |
130 for function in namespace.functions.values(): | 128 for function in namespace.functions.values(): |
131 if function.nocompile: | 129 if function.nocompile: |
132 continue | 130 continue |
133 c.Concat(self._GenerateRegisterFunctions(namespace.name, function)) | 131 c.Concat(self._GenerateRegisterFunctions(namespace.name, function)) |
134 | 132 |
135 for type_ in namespace.types.values(): | 133 for type_ in namespace.types.values(): |
136 for function in type_.functions.values(): | 134 for function in type_.functions.values(): |
137 if function.nocompile: | 135 if function.nocompile: |
138 continue | 136 continue |
139 namespace_types_name = JsFunctionNameToClassName( | 137 namespace_types_name = JsFunctionNameToClassName( |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 c.Eblock('}') | 311 c.Eblock('}') |
314 c.Append() | 312 c.Append() |
315 c.Append('// static') | 313 c.Append('// static') |
316 c.Sblock('bool GeneratedSchemas::IsGenerated(std::string name) {') | 314 c.Sblock('bool GeneratedSchemas::IsGenerated(std::string name) {') |
317 c.Append('return g_lazy_instance.Get().schemas.count(name) > 0;') | 315 c.Append('return g_lazy_instance.Get().schemas.count(name) > 0;') |
318 c.Eblock('}') | 316 c.Eblock('}') |
319 c.Append() | 317 c.Append() |
320 c.Concat(cpp_util.CloseNamespace(self._bundle._cpp_namespace)) | 318 c.Concat(cpp_util.CloseNamespace(self._bundle._cpp_namespace)) |
321 c.Append() | 319 c.Append() |
322 return c | 320 return c |
OLD | NEW |