OLD | NEW |
---|---|
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2013 Google Inc. All rights reserved. | 2 # Copyright (c) 2013 Google Inc. All rights reserved. |
3 # | 3 # |
4 # Redistribution and use in source and binary forms, with or without | 4 # Redistribution and use in source and binary forms, with or without |
5 # modification, are permitted provided that the following conditions are | 5 # modification, are permitted provided that the following conditions are |
6 # met: | 6 # met: |
7 # | 7 # |
8 # * Redistributions of source code must retain the above copyright | 8 # * Redistributions of source code must retain the above copyright |
9 # notice, this list of conditions and the following disclaimer. | 9 # notice, this list of conditions and the following disclaimer. |
10 # * Redistributions in binary form must reproduce the above | 10 # * Redistributions in binary form must reproduce the above |
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
343 def to_str_value(self): | 343 def to_str_value(self): |
344 return self.value | 344 return self.value |
345 | 345 |
346 | 346 |
347 def generate_param_name(param_type): | 347 def generate_param_name(param_type): |
348 base_name = re.match("(const |PassRefPtr<)?(\w*)", param_type).group(2) | 348 base_name = re.match("(const |PassRefPtr<)?(\w*)", param_type).group(2) |
349 return "param" + base_name | 349 return "param" + base_name |
350 | 350 |
351 | 351 |
352 def agent_class_name(agent): | 352 def agent_class_name(agent): |
353 if agent == "Performance": | |
354 return "PerformanceMonitor" | |
alph
2017/02/24 23:05:53
Let's rename it instead?
pfeldman
2017/02/24 23:53:11
We need to make codegen more flexible.
| |
353 return "Inspector%sAgent" % agent | 355 return "Inspector%sAgent" % agent |
354 | 356 |
355 | 357 |
356 def agent_getter_signature(agent): | 358 def agent_getter_signature(agent): |
357 agent_class = agent_class_name(agent) | 359 agent_class = agent_class_name(agent) |
358 return agent_class, agent_class[0].lower() + agent_class[1:] | 360 return agent_class, agent_class[0].lower() + agent_class[1:] |
359 | 361 |
360 | 362 |
361 def include_header(name): | 363 def include_header(name): |
362 return "#include \"%s.h\"" % name | 364 return "#include \"%s.h\"" % name |
363 | 365 |
364 | 366 |
365 def include_inspector_header(name): | 367 def include_inspector_header(name): |
368 if name == "PerformanceMonitor": | |
369 return include_header("core/frame/" + name) | |
366 return include_header("core/inspector/" + name) | 370 return include_header("core/inspector/" + name) |
367 | 371 |
368 | 372 |
369 def generate_instrumenting_agents(used_agents): | 373 def generate_instrumenting_agents(used_agents): |
370 agents = list(used_agents) | 374 agents = list(used_agents) |
371 agents.sort() | 375 agents.sort() |
372 | 376 |
373 forward_list = [] | 377 forward_list = [] |
374 accessor_list = [] | 378 accessor_list = [] |
375 member_list = [] | 379 member_list = [] |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
461 if not output_dirpath: | 465 if not output_dirpath: |
462 raise Exception("Output directory must be specified") | 466 raise Exception("Output directory must be specified") |
463 except Exception: | 467 except Exception: |
464 # Work with python 2 and 3 http://docs.python.org/py3k/howto/pyporting.html | 468 # Work with python 2 and 3 http://docs.python.org/py3k/howto/pyporting.html |
465 exc = sys.exc_info()[1] | 469 exc = sys.exc_info()[1] |
466 sys.stderr.write("Failed to parse command-line arguments: %s\n\n" % exc) | 470 sys.stderr.write("Failed to parse command-line arguments: %s\n\n" % exc) |
467 sys.stderr.write("Usage: <script> --output_dir <output_dir> InspectorInstrum entation.idl\n") | 471 sys.stderr.write("Usage: <script> --output_dir <output_dir> InspectorInstrum entation.idl\n") |
468 exit(1) | 472 exit(1) |
469 | 473 |
470 generate(input_path, output_dirpath) | 474 generate(input_path, output_dirpath) |
OLD | NEW |