| Index: Source/core/inspector/CodeGeneratorInspector.py
|
| diff --git a/Source/core/inspector/CodeGeneratorInspector.py b/Source/core/inspector/CodeGeneratorInspector.py
|
| index b703b6a565b98df3dd57a00c5de3c406e3b73e57..daae490e279aff91f4829138c7a2b984f1d6a7aa 100755
|
| --- a/Source/core/inspector/CodeGeneratorInspector.py
|
| +++ b/Source/core/inspector/CodeGeneratorInspector.py
|
| @@ -1902,7 +1902,7 @@ class Generator:
|
|
|
| Generator.method_name_enum_list.append(" %s," % cmd_enum_name)
|
| Generator.method_handler_list.append(" &InspectorBackendDispatcherImpl::%s_%s," % (domain_name, json_command_name))
|
| - Generator.backend_method_declaration_list.append(" void %s_%s(long callId, JSONObject* requestMessageObject);" % (domain_name, json_command_name))
|
| + Generator.backend_method_declaration_list.append(" void %s_%s(long callId, JSONObject* requestMessageObject, JSONArray* protocolErrors);" % (domain_name, json_command_name))
|
|
|
| backend_agent_interface_list = [] if "redirect" in json_command else Generator.backend_agent_interface_list
|
|
|
| @@ -1914,10 +1914,11 @@ class Generator:
|
|
|
| method_in_code = ""
|
| method_out_code = ""
|
| + result_object_declaration = ""
|
| agent_call_param_list = []
|
| + send_response_call_params_list = ["error"]
|
| request_message_param = ""
|
| normal_response_cook_text = ""
|
| - error_response_cook_text = ""
|
| error_type_binding = None
|
| if "error" in json_command:
|
| json_error = json_command["error"]
|
| @@ -1927,17 +1928,7 @@ class Generator:
|
| agent_call_param_list.append(", %serrorData" % error_type_model.get_command_return_pass_model().get_output_argument_prefix())
|
| backend_agent_interface_list.append(", %s errorData" % error_annotated_type)
|
| method_in_code += " %s errorData;\n" % error_type_model.get_command_return_pass_model().get_return_var_type()
|
| -
|
| - setter_argument = error_type_model.get_command_return_pass_model().get_output_to_raw_expression() % "errorData"
|
| - if error_type_binding.get_setter_value_expression_pattern():
|
| - setter_argument = error_type_binding.get_setter_value_expression_pattern() % setter_argument
|
| - error_assigment_value = error_type_binding.reduce_to_raw_type().get_constructor_pattern() % setter_argument
|
| -
|
| - cook = " resultErrorData = %s;\n" % error_assigment_value
|
| -
|
| - error_condition_pattern = error_type_model.get_command_return_pass_model().get_set_return_condition()
|
| - cook = (" if (%s)\n " % (error_condition_pattern % "errorData")) + cook
|
| - error_response_cook_text = " if (error.length()) {\n" + cook + " }\n"
|
| + send_response_call_params_list.append("errorData")
|
|
|
| if "parameters" in json_command:
|
| json_params = json_command["parameters"]
|
| @@ -1962,13 +1953,13 @@ class Generator:
|
|
|
| if optional:
|
| code = (" bool %s_valueFound = false;\n"
|
| - " %s in_%s = get%s(paramsContainerPtr, \"%s\", &%s_valueFound, protocolErrorsPtr);\n" %
|
| + " %s in_%s = get%s(paramsContainerPtr, \"%s\", &%s_valueFound, protocolErrors);\n" %
|
| (json_param_name, non_optional_type_model.get_command_return_pass_model().get_return_var_type(), json_param_name, getter_name, json_param_name, json_param_name))
|
| param = ", %s_valueFound ? &in_%s : 0" % (json_param_name, json_param_name)
|
| # FIXME: pass optional refptr-values as PassRefPtr
|
| formal_param_type_pattern = "const %s*"
|
| else:
|
| - code = (" %s in_%s = get%s(paramsContainerPtr, \"%s\", 0, protocolErrorsPtr);\n" %
|
| + code = (" %s in_%s = get%s(paramsContainerPtr, \"%s\", 0, protocolErrors);\n" %
|
| (non_optional_type_model.get_command_return_pass_model().get_return_var_type(), json_param_name, getter_name, json_param_name))
|
| param = ", in_%s" % json_param_name
|
| # FIXME: pass not-optional refptr-values as NonNullPassRefPtr
|
| @@ -2015,19 +2006,19 @@ class Generator:
|
| parameter=annotated_type + " errorData",
|
| argument=assigment_value))
|
|
|
| -
|
| -
|
| ad_hoc_type_output.append(callback_output)
|
|
|
| method_out_code += " RefPtr<" + agent_interface_name + "::" + callback_name + "> callback = adoptRef(new " + agent_interface_name + "::" + callback_name + "(this, callId));\n"
|
| agent_call_param_list.append(", callback")
|
| - normal_response_cook_text += " if (!error.length()) \n"
|
| - normal_response_cook_text += " return;\n"
|
| - normal_response_cook_text += " callback->disable();\n"
|
| + normal_response_cook_text += " if (!error.length()) \n"
|
| + normal_response_cook_text += " return;\n"
|
| + normal_response_cook_text += " callback->disable();\n"
|
| backend_agent_interface_list.append(", PassRefPtr<%s> callback" % callback_name)
|
| else:
|
| if "returns" in json_command:
|
| method_out_code += "\n"
|
| + result_object_declaration = "\n RefPtr<JSONObject> result = JSONObject::create();"
|
| + send_response_call_params_list.append("result")
|
| response_cook_list = []
|
| for json_return in json_command["returns"]:
|
|
|
| @@ -2052,12 +2043,12 @@ class Generator:
|
| if return_type_binding.get_setter_value_expression_pattern():
|
| setter_argument = return_type_binding.get_setter_value_expression_pattern() % setter_argument
|
|
|
| - cook = " result->set%s(\"%s\", %s);\n" % (setter_type, json_return_name,
|
| + cook = " result->set%s(\"%s\", %s);\n" % (setter_type, json_return_name,
|
| setter_argument)
|
|
|
| set_condition_pattern = type_model.get_command_return_pass_model().get_set_return_condition()
|
| if set_condition_pattern:
|
| - cook = (" if (%s)\n " % (set_condition_pattern % var_name)) + cook
|
| + cook = (" if (%s)\n " % (set_condition_pattern % var_name)) + cook
|
| annotated_type = type_model.get_command_return_pass_model().get_output_parameter_type()
|
|
|
| param_name = var_name
|
| @@ -2073,7 +2064,7 @@ class Generator:
|
| normal_response_cook_text += "".join(response_cook_list)
|
|
|
| if len(normal_response_cook_text) != 0:
|
| - normal_response_cook_text = " if (!error.length()) {\n" + normal_response_cook_text + " }"
|
| + normal_response_cook_text = " if (!error.length()) {\n" + normal_response_cook_text + " }"
|
|
|
| # Redirect to another agent's implementation.
|
| agent_field = "m_" + agent_field_name
|
| @@ -2084,12 +2075,11 @@ class Generator:
|
| Generator.backend_method_implementation_list.append(Templates.backend_method.substitute(None,
|
| domainName=domain_name, methodName=json_command_name,
|
| agentField=agent_field,
|
| - methodInCode=method_in_code,
|
| - methodOutCode=method_out_code,
|
| + methodCode="".join([method_in_code, method_out_code, result_object_declaration]),
|
| agentCallParams="".join(agent_call_param_list),
|
| requestMessageObject=request_message_param,
|
| responseCook=normal_response_cook_text,
|
| - errorCook=error_response_cook_text,
|
| + sendResponseCallParams=", ".join(send_response_call_params_list),
|
| commandNameIndex=cmd_enum_name))
|
| declaration_command_name = "%s.%s\\0" % (domain_name, json_command_name)
|
| Generator.backend_method_name_declaration_list.append(" \"%s\"" % declaration_command_name)
|
|
|