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

Side by Side Diff: third_party/WebKit/Source/devtools/scripts/CodeGeneratorFrontend.py

Issue 2214193002: [DevTools] Introduce unserializableValue in RemoteObject. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: hidden Created 4 years, 4 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 #!/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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 raise Exception("Output .js directory must be specified") 51 raise Exception("Output .js directory must be specified")
52 except Exception: 52 except Exception:
53 # Work with python 2 and 3 http://docs.python.org/py3k/howto/pyporting.html 53 # Work with python 2 and 3 http://docs.python.org/py3k/howto/pyporting.html
54 exc = sys.exc_info()[1] 54 exc = sys.exc_info()[1]
55 sys.stderr.write("Failed to parse command-line arguments: %s\n\n" % exc) 55 sys.stderr.write("Failed to parse command-line arguments: %s\n\n" % exc)
56 sys.stderr.write("Usage: <script> some.json --output_js_dir <output_js_dir>\ n") 56 sys.stderr.write("Usage: <script> some.json --output_js_dir <output_js_dir>\ n")
57 exit(1) 57 exit(1)
58 58
59 59
60 def fix_camel_case(name): 60 def fix_camel_case(name):
61 prefix = ""
62 if name[0] == "-":
63 prefix = "Negative"
64 name = name[1:]
61 refined = re.sub(r'-(\w)', lambda pat: pat.group(1).upper(), name) 65 refined = re.sub(r'-(\w)', lambda pat: pat.group(1).upper(), name)
62 refined = to_title_case(refined) 66 refined = to_title_case(refined)
63 return re.sub(r'(?i)HTML|XML|WML|API', lambda pat: pat.group(0).upper(), ref ined) 67 return prefix + re.sub(r'(?i)HTML|XML|WML|API', lambda pat: pat.group(0).upp er(), refined)
64 68
65 69
66 def to_title_case(name): 70 def to_title_case(name):
67 return name[:1].upper() + name[1:] 71 return name[:1].upper() + name[1:]
68 72
69 73
70 class RawTypes(object): 74 class RawTypes(object):
71 @staticmethod 75 @staticmethod
72 def get_js(json_type): 76 def get_js(json_type):
73 if json_type == "boolean": 77 if json_type == "boolean":
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
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)) 282 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))
279 283
280 Generator.go() 284 Generator.go()
281 285
282 backend_js_file = open(output_js_dirname + "/InspectorBackendCommands.js", "w") 286 backend_js_file = open(output_js_dirname + "/InspectorBackendCommands.js", "w")
283 287
284 backend_js_file.write(Templates.backend_js.substitute(None, 288 backend_js_file.write(Templates.backend_js.substitute(None,
285 domainInitializers="".join(Generator.backend_js_domain_initializer_list))) 289 domainInitializers="".join(Generator.backend_js_domain_initializer_list)))
286 290
287 backend_js_file.close() 291 backend_js_file.close()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698