Chromium Code Reviews| Index: Source/core/inspector/CodeGeneratorInspector.py |
| diff --git a/Source/core/inspector/CodeGeneratorInspector.py b/Source/core/inspector/CodeGeneratorInspector.py |
| index 1a146147a8006de2bb5eced699a3dce424fc9e0e..fe67667372595308c19b3eb6856ebdb7031a8676 100755 |
| --- a/Source/core/inspector/CodeGeneratorInspector.py |
| +++ b/Source/core/inspector/CodeGeneratorInspector.py |
| @@ -56,6 +56,8 @@ TYPES_WITH_OPEN_FIELD_LIST_SET = frozenset([ |
| # InspectorResourceAgent needs to update mime-type. |
| "Network.Response"]) |
| +DOMAINS_WITH_ENABLEMENT_CHECK = frozenset(["DOMDebugger", "Debugger"]) |
| + |
| cmdline_parser = optparse.OptionParser() |
| cmdline_parser.add_option("--output_dir") |
| @@ -1652,6 +1654,8 @@ 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) |
| + if domain_name in DOMAINS_WITH_ENABLEMENT_CHECK: |
| + Generator.backend_agent_interface_list.append("\n virtual bool checkEnabled(ErrorString*) = 0;\n") |
| 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") |
| @@ -1719,6 +1723,12 @@ class Generator: |
| method_out_code = "" |
| agent_call_param_list = ["&error"] |
| agent_call_params_declaration_list = [" ErrorString error;"] |
| + agent_enablement_check = "" |
| + if domain_name in DOMAINS_WITH_ENABLEMENT_CHECK and json_command["name"] != "enable": |
| + agent_enablement_check = " if (!m_" + agent_field_name + "->checkEnabled(&error)) {\n" |
| + agent_enablement_check += " reportProtocolError(callId, ServerError, error);\n" |
|
pfeldman
2015/05/05 14:00:13
- This is not a server error, this is rather illeg
|
| + agent_enablement_check += " return;\n" |
| + agent_enablement_check += " }\n" |
| send_response_call_params_list = ["error"] |
| request_message_param = "" |
| normal_response_cook_text = "" |
| @@ -1875,6 +1885,7 @@ class Generator: |
| methodCode="".join([method_in_code, method_out_code]), |
| agentCallParamsDeclaration="\n".join(agent_call_params_declaration_list), |
| agentCallParams=", ".join(agent_call_param_list), |
| + agentEnablementCheck=agent_enablement_check, |
| requestMessageObject=request_message_param, |
| responseCook=normal_response_cook_text, |
| sendResponseCallParams=", ".join(send_response_call_params_list), |