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

Unified Diff: Source/core/inspector/CodeGeneratorInspector.py

Issue 17030009: Inspector: wrapped inspector agent instances into factory-like wrappers (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Addressed comments Created 7 years, 6 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
« no previous file with comments | « no previous file | Source/core/inspector/CodeGeneratorInspectorStrings.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/inspector/CodeGeneratorInspector.py
diff --git a/Source/core/inspector/CodeGeneratorInspector.py b/Source/core/inspector/CodeGeneratorInspector.py
index a718464d083ae0fca3471e1db6b884a312604afe..ef23f9aa85ff0a4478798108988ccc5bf1ef18f1 100755
--- a/Source/core/inspector/CodeGeneratorInspector.py
+++ b/Source/core/inspector/CodeGeneratorInspector.py
@@ -1837,14 +1837,23 @@ class Generator:
if "commands" in json_domain:
for json_command in json_domain["commands"]:
Generator.process_command(json_command, domain_name, agent_field_name, agent_interface_name)
+
+ Generator.backend_agent_interface_list.append("\n class Factory {\n")
+ Generator.backend_agent_interface_list.append(" public:\n")
+ Generator.backend_agent_interface_list.append(" virtual %s* commandHandler() = 0;\n" % agent_interface_name)
+ Generator.backend_agent_interface_list.append(" protected:\n")
+ Generator.backend_agent_interface_list.append(" virtual ~Factory() { }\n")
+ Generator.backend_agent_interface_list.append(" };\n\n")
+ agent_controller_name = agent_interface_name + "::Factory"
+
Generator.backend_agent_interface_list.append("\n protected:\n")
Generator.backend_agent_interface_list.append(" virtual ~%s() { }\n" % agent_interface_name)
Generator.backend_agent_interface_list.append(" };\n\n")
Generator.backend_constructor_init_list.append(" , m_%s(0)" % agent_field_name)
- Generator.backend_virtual_setters_list.append(" virtual void registerAgent(%s* %s) = 0;" % (agent_interface_name, agent_field_name))
- Generator.backend_setters_list.append(" virtual void registerAgent(%s* %s) { ASSERT(!m_%s); m_%s = %s; }" % (agent_interface_name, agent_field_name, agent_field_name, agent_field_name, agent_field_name))
- Generator.backend_field_list.append(" %s* m_%s;" % (agent_interface_name, agent_field_name))
+ Generator.backend_virtual_setters_list.append(" virtual void registerAgent(%s* %s) = 0;" % (agent_controller_name, agent_field_name))
+ Generator.backend_setters_list.append(" virtual void registerAgent(%s* %s) { ASSERT(!m_%s); m_%s = %s; }" % (agent_controller_name, agent_field_name, agent_field_name, agent_field_name, agent_field_name))
+ Generator.backend_field_list.append(" %s* m_%s;" % (agent_controller_name, agent_field_name))
@staticmethod
def process_event(json_event, domain_name, frontend_method_declaration_lines):
@@ -2056,6 +2065,7 @@ class Generator:
Generator.backend_method_implementation_list.append(Templates.backend_method.substitute(None,
domainName=domain_name, methodName=json_command_name,
agentField="m_" + agent_field_name,
+ handlerClass=agent_interface_name,
methodInCode=method_in_code,
methodOutCode=method_out_code,
agentCallParams="".join(agent_call_param_list),
« no previous file with comments | « no previous file | Source/core/inspector/CodeGeneratorInspectorStrings.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698