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

Side by Side Diff: third_party/inspector_protocol/CodeGenerator.py

Issue 2479693002: Roll third_party/inspector_protocol to 2952a8eb5d99fbc194946526b57d67ed52093699 (Closed)
Patch Set: Created 4 years, 1 month 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 | « no previous file | third_party/inspector_protocol/README.chromium » ('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 2016 The Chromium Authors. All rights reserved. 1 # Copyright 2016 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.path 5 import os.path
6 import sys 6 import sys
7 import optparse 7 import optparse
8 import collections 8 import collections
9 import functools 9 import functools
10 try: 10 try:
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 322
323 323
324 def resolve_type(protocol, prop): 324 def resolve_type(protocol, prop):
325 if "$ref" in prop: 325 if "$ref" in prop:
326 return protocol.type_definitions[prop["$ref"]] 326 return protocol.type_definitions[prop["$ref"]]
327 if prop["type"] == "array": 327 if prop["type"] == "array":
328 return wrap_array_definition(resolve_type(protocol, prop["items"])) 328 return wrap_array_definition(resolve_type(protocol, prop["items"]))
329 return protocol.type_definitions[prop["type"]] 329 return protocol.type_definitions[prop["type"]]
330 330
331 331
332 def new_style(domain):
333 return True
334
335
336 def join_arrays(dict, keys): 332 def join_arrays(dict, keys):
337 result = [] 333 result = []
338 for key in keys: 334 for key in keys:
339 if key in dict: 335 if key in dict:
340 result += dict[key] 336 result += dict[key]
341 return result 337 return result
342 338
343 339
344 def has_disable(commands): 340 def has_disable(commands):
345 for command in commands: 341 for command in commands:
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 413
418 for domain in protocol.json_api["domains"]: 414 for domain in protocol.json_api["domains"]:
419 class_name = domain["domain"] 415 class_name = domain["domain"]
420 template_context = { 416 template_context = {
421 "config": config, 417 "config": config,
422 "domain": domain, 418 "domain": domain,
423 "join_arrays": join_arrays, 419 "join_arrays": join_arrays,
424 "resolve_type": functools.partial(resolve_type, protocol), 420 "resolve_type": functools.partial(resolve_type, protocol),
425 "type_definition": functools.partial(type_definition, protocol), 421 "type_definition": functools.partial(type_definition, protocol),
426 "has_disable": has_disable, 422 "has_disable": has_disable,
427 "format_include": format_include, 423 "format_include": format_include
428 "new_style": new_style,
429 } 424 }
430 425
431 if domain["domain"] in protocol.generate_domains: 426 if domain["domain"] in protocol.generate_domains:
432 outputs[os.path.join(config.protocol.output, class_name + ".h")] = h _template.render(template_context) 427 outputs[os.path.join(config.protocol.output, class_name + ".h")] = h _template.render(template_context)
433 outputs[os.path.join(config.protocol.output, class_name + ".cpp")] = cpp_template.render(template_context) 428 outputs[os.path.join(config.protocol.output, class_name + ".cpp")] = cpp_template.render(template_context)
434 if domain["has_exports"]: 429 if domain["has_exports"]:
435 outputs[os.path.join(config.exported.output, class_name + ".h")] = exported_template.render(template_context) 430 outputs[os.path.join(config.exported.output, class_name + ".h")] = exported_template.render(template_context)
436 if domain["domain"] in protocol.imported_domains and domain["has_exports "]: 431 if domain["domain"] in protocol.imported_domains and domain["has_exports "]:
437 outputs[os.path.join(config.protocol.output, class_name + ".h")] = i mported_template.render(template_context) 432 outputs[os.path.join(config.protocol.output, class_name + ".h")] = i mported_template.render(template_context)
438 433
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
494 if up_to_date: 489 if up_to_date:
495 sys.exit() 490 sys.exit()
496 491
497 for file_name, content in outputs.iteritems(): 492 for file_name, content in outputs.iteritems():
498 out_file = open(file_name, "w") 493 out_file = open(file_name, "w")
499 out_file.write(content) 494 out_file.write(content)
500 out_file.close() 495 out_file.close()
501 496
502 497
503 main() 498 main()
OLDNEW
« no previous file with comments | « no previous file | third_party/inspector_protocol/README.chromium » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698