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

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

Issue 1033223007: [Extension API Extern Generation] Support inline object definitions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Presubmit fix Created 5 years, 8 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
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 os 5 import os
6 6
7 from code import Code 7 from code import Code
8 from model import PropertyType 8 from model import PropertyType
9 import cpp_util 9 import cpp_util
10 import schema_util 10 import schema_util
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 def _GenerateEvent(self, event): 282 def _GenerateEvent(self, event):
283 """Generates the namespaces for an event. 283 """Generates the namespaces for an event.
284 """ 284 """
285 c = Code() 285 c = Code()
286 # TODO(kalman): use event.unix_name not Classname. 286 # TODO(kalman): use event.unix_name not Classname.
287 event_namespace = cpp_util.Classname(event.name) 287 event_namespace = cpp_util.Classname(event.name)
288 (c.Append('namespace %s {' % event_namespace) 288 (c.Append('namespace %s {' % event_namespace)
289 .Append() 289 .Append()
290 .Concat(self._GenerateEventNameConstant(event)) 290 .Concat(self._GenerateEventNameConstant(event))
291 .Concat(self._GenerateCreateCallbackArguments(event)) 291 .Concat(self._GenerateCreateCallbackArguments(event))
292 .Eblock('} // namespace %s' % event_namespace) 292 .Append('} // namespace %s' % event_namespace)
293 ) 293 )
294 return c 294 return c
295 295
296 def _GenerateFunction(self, function): 296 def _GenerateFunction(self, function):
297 """Generates the namespaces and structs for a function. 297 """Generates the namespaces and structs for a function.
298 """ 298 """
299 c = Code() 299 c = Code()
300 # TODO(kalman): Use function.unix_name not Classname here. 300 # TODO(kalman): Use function.unix_name not Classname here.
301 function_namespace = cpp_util.Classname(function.name) 301 function_namespace = cpp_util.Classname(function.name)
302 # Windows has a #define for SendMessage, so to avoid any issues, we need 302 # Windows has a #define for SendMessage, so to avoid any issues, we need
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 """Builds the parameter list for a function, given an array of parameters. 388 """Builds the parameter list for a function, given an array of parameters.
389 """ 389 """
390 # |error| is populated with warnings and/or errors found during parsing. 390 # |error| is populated with warnings and/or errors found during parsing.
391 # |error| being set does not necessarily imply failure and may be 391 # |error| being set does not necessarily imply failure and may be
392 # recoverable. 392 # recoverable.
393 # For example, optional properties may have failed to parse, but the 393 # For example, optional properties may have failed to parse, but the
394 # parser was able to continue. 394 # parser was able to continue.
395 if self._generate_error_messages: 395 if self._generate_error_messages:
396 params += ('base::string16* error',) 396 params += ('base::string16* error',)
397 return ', '.join(str(p) for p in params) 397 return ', '.join(str(p) for p in params)
OLDNEW
« no previous file with comments | « tools/json_schema_compiler/code_test.py ('k') | tools/json_schema_compiler/js_externs_generator.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698