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

Unified Diff: third_party/WebKit/Source/platform/inspector_protocol/CodeGenerator.py

Issue 2012753003: DevTools: consolidate protocol generators for front-end, backend and type builder. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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: third_party/WebKit/Source/platform/inspector_protocol/CodeGenerator.py
diff --git a/third_party/WebKit/Source/platform/inspector_protocol/CodeGenerator.py b/third_party/WebKit/Source/platform/inspector_protocol/CodeGenerator.py
index 57bd6cea47911adae46fbe1d9a00ff449bff0395..8952a946e41123b5b0f9d1a695d8ab266c849384 100644
--- a/third_party/WebKit/Source/platform/inspector_protocol/CodeGenerator.py
+++ b/third_party/WebKit/Source/platform/inspector_protocol/CodeGenerator.py
@@ -88,6 +88,30 @@ def output_file(file_name):
return open(file_name, "w")
+def topsort_domains():
+ domains = {}
+ for domain in json_api["domains"]:
+ domains[domain["domain"]] = domain
+
+ processed = set()
+ result = []
+
+ def process(name):
+ if name in processed:
+ return
+ domain = domains[name]
+ deps = []
+ if "depends" in domain:
+ for dep in domain["depends"]:
+ process(dep)
+ result.append(domain)
+ processed.add(name)
+
+ for domain in json_api["domains"]:
+ process(domain["domain"])
+ json_api["domains"] = result
+
+
def patch_full_qualified_refs():
def patch_full_qualified_refs_in_domain(json, domain_name):
if isinstance(json, list):
@@ -239,6 +263,7 @@ def create_type_definitions():
else:
type_definitions[domain["domain"] + "." + type["id"]] = create_primitive_type_definition(type["type"])
+topsort_domains()
patch_full_qualified_refs()
create_type_definitions()
@@ -305,7 +330,5 @@ def generate(class_name):
jinja_env = initialize_jinja_env(output_dirname)
-generate("Backend")
generate("Dispatcher")
-generate("Frontend")
generate("TypeBuilder")

Powered by Google App Engine
This is Rietveld 408576698