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

Unified Diff: content/browser/devtools/protocol/devtools_protocol_handler_generator.py

Issue 658163003: [DevTools] Added browser protocol to handler generator (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@singleUse
Patch Set: Created 6 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/devtools/protocol/devtools_protocol_handler_generator.py
diff --git a/content/browser/devtools/protocol/devtools_protocol_handler_generator.py b/content/browser/devtools/protocol/devtools_protocol_handler_generator.py
index c8fc7f3f1b13c20acb509ba5c40c9a71edb4ba15..373b5a398b829bfd31e7357e45b5ee82f905eea3 100755
--- a/content/browser/devtools/protocol/devtools_protocol_handler_generator.py
+++ b/content/browser/devtools/protocol/devtools_protocol_handler_generator.py
@@ -7,9 +7,10 @@ import sys
import string
import json
-input_json_path = sys.argv[1]
-output_cc_path = sys.argv[2]
-output_h_path = sys.argv[3]
+blink_protocol_path = sys.argv[1]
+browser_protocol_path = sys.argv[2]
+output_cc_path = sys.argv[3]
+output_h_path = sys.argv[4]
header = """\
// Copyright 2014 The Chromium Authors. All rights reserved.
@@ -419,7 +420,7 @@ tmpl_wrap_dict = string.Template("""\
tmpl_wrap_list = tmpl_wrap_dict;
tmpl_wrap_obj = string.Template("""\
- ${dict_var}->Set("${proto_param}", ${var_name});
+ ${dict_var}->Set("${proto_param}", ${var_name}.release());
dgozman 2014/10/17 13:11:28 Should this go to previous patch?
vkuzkokov 2014/10/17 15:53:17 Done.
""")
tmpl_typename = string.Template("devtools::${domain}::${declared_name}")
@@ -442,13 +443,16 @@ def Uncamelcase(s):
return result
types = {}
-json_api = json.loads(open(input_json_path, "r").read())
+blink_protocol = json.loads(open(blink_protocol_path, "r").read())
+browser_protocol = json.loads(open(browser_protocol_path, "r").read())
type_decls = []
type_impls = []
handler_methods = []
handler_method_impls = []
-for json_domain in json_api["domains"]:
+all_domains = blink_protocol["domains"] + browser_protocol["domains"]
+
+for json_domain in all_domains:
if "types" in json_domain:
for json_type in json_domain["types"]:
types["%s.%s" % (json_domain["domain"], json_type["id"])] = json_type
@@ -496,7 +500,7 @@ def ResolveRef(json, mapping):
json_type = types["%s.%s" % (domain_name, type_name)]
mapping["declared_name"] = Capitalize(type_name)
mapping["Domain"] = domain_name
- mapping["domain"] = Decapitalize(domain_name)
+ mapping["domain"] = Uncamelcase(domain_name)
dgozman 2014/10/17 13:11:28 ditto
vkuzkokov 2014/10/17 15:53:17 Done.
mapping["param_type"] = tmpl_typename.substitute(mapping)
if json_type.get("enum"):
# TODO(vkuzkokov) Implement. Approximate template:
@@ -608,10 +612,10 @@ fields = []
includes = []
fields_init = []
-for json_domain in json_api["domains"]:
+for json_domain in all_domains:
domain_map = {}
domain_map["Domain"] = json_domain["domain"]
- domain_map["domain"] = Decapitalize(json_domain["domain"])
+ domain_map["domain"] = Uncamelcase(json_domain["domain"])
dgozman 2014/10/17 13:11:28 ditto
vkuzkokov 2014/10/17 15:53:17 Done.
initializations = []
client_methods = []

Powered by Google App Engine
This is Rietveld 408576698