| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2011 Google Inc. All rights reserved. | 2 # Copyright (c) 2011 Google Inc. All rights reserved. |
| 3 # Copyright (c) 2012 Intel Corporation. All rights reserved. | 3 # Copyright (c) 2012 Intel Corporation. All rights reserved. |
| 4 # | 4 # |
| 5 # Redistribution and use in source and binary forms, with or without | 5 # Redistribution and use in source and binary forms, with or without |
| 6 # modification, are permitted provided that the following conditions are | 6 # modification, are permitted provided that the following conditions are |
| 7 # met: | 7 # met: |
| 8 # | 8 # |
| 9 # * Redistributions of source code must retain the above copyright | 9 # * Redistributions of source code must retain the above copyright |
| 10 # notice, this list of conditions and the following disclaimer. | 10 # notice, this list of conditions and the following disclaimer. |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 | 179 |
| 180 | 180 |
| 181 class Generator: | 181 class Generator: |
| 182 backend_js_domain_initializer_list = [] | 182 backend_js_domain_initializer_list = [] |
| 183 | 183 |
| 184 @staticmethod | 184 @staticmethod |
| 185 def go(): | 185 def go(): |
| 186 for json_domain in json_api["domains"]: | 186 for json_domain in json_api["domains"]: |
| 187 domain_name = json_domain["domain"] | 187 domain_name = json_domain["domain"] |
| 188 domain_name_lower = domain_name.lower() | 188 domain_name_lower = domain_name.lower() |
| 189 if domain_name_lower == "console": |
| 190 continue |
| 189 | 191 |
| 190 Generator.backend_js_domain_initializer_list.append("// %s.\n" % dom
ain_name) | 192 Generator.backend_js_domain_initializer_list.append("// %s.\n" % dom
ain_name) |
| 191 | 193 |
| 192 if "types" in json_domain: | 194 if "types" in json_domain: |
| 193 for json_type in json_domain["types"]: | 195 for json_type in json_domain["types"]: |
| 194 if "type" in json_type and json_type["type"] == "string" and
"enum" in json_type: | 196 if "type" in json_type and json_type["type"] == "string" and
"enum" in json_type: |
| 195 enum_name = "%s.%s" % (domain_name, json_type["id"]) | 197 enum_name = "%s.%s" % (domain_name, json_type["id"]) |
| 196 Generator.process_enum(json_type, enum_name) | 198 Generator.process_enum(json_type, enum_name) |
| 197 elif json_type["type"] == "object": | 199 elif json_type["type"] == "object": |
| 198 if "properties" in json_type: | 200 if "properties" in json_type: |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 Generator.backend_js_domain_initializer_list.append("InspectorBackend.re
gisterCommand(\"%s.%s\", [%s], %s, %s);\n" % (domain_name, json_command_name, js
_parameters_text, js_reply_list, has_error_data_param)) | 278 Generator.backend_js_domain_initializer_list.append("InspectorBackend.re
gisterCommand(\"%s.%s\", [%s], %s, %s);\n" % (domain_name, json_command_name, js
_parameters_text, js_reply_list, has_error_data_param)) |
| 277 | 279 |
| 278 Generator.go() | 280 Generator.go() |
| 279 | 281 |
| 280 backend_js_file = open(output_js_dirname + "/InspectorBackendCommands.js", "w") | 282 backend_js_file = open(output_js_dirname + "/InspectorBackendCommands.js", "w") |
| 281 | 283 |
| 282 backend_js_file.write(Templates.backend_js.substitute(None, | 284 backend_js_file.write(Templates.backend_js.substitute(None, |
| 283 domainInitializers="".join(Generator.backend_js_domain_initializer_list))) | 285 domainInitializers="".join(Generator.backend_js_domain_initializer_list))) |
| 284 | 286 |
| 285 backend_js_file.close() | 287 backend_js_file.close() |
| OLD | NEW |