| OLD | NEW |
| 1 // This file is generated | 1 // This file is generated |
| 2 | 2 |
| 3 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | 3 // Copyright (c) 2016 The Chromium Authors. All rights reserved. |
| 4 // Use of this source code is governed by a BSD-style license that can be | 4 // Use of this source code is governed by a BSD-style license that can be |
| 5 // found in the LICENSE file. | 5 // found in the LICENSE file. |
| 6 | 6 |
| 7 #include "platform/inspector_protocol/{{class_name}}.h" | 7 #include "platform/inspector_protocol/{{class_name}}.h" |
| 8 | 8 |
| 9 #include "wtf/text/CString.h" | 9 #include "wtf/text/CString.h" |
| 10 #include "wtf/text/WTFString.h" | 10 #include "wtf/text/WTFString.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 {% if "handlers" in event and not ("renderer" in event["handlers"]) %}{% con
tinue %}{% endif %} | 25 {% if "handlers" in event and not ("renderer" in event["handlers"]) %}{% con
tinue %}{% endif %} |
| 26 void Frontend::{{domain.domain}}::{{event.name}}( | 26 void Frontend::{{domain.domain}}::{{event.name}}( |
| 27 {%- for parameter in event.parameters %} | 27 {%- for parameter in event.parameters %} |
| 28 {% if "optional" in parameter -%} | 28 {% if "optional" in parameter -%} |
| 29 const Maybe<{{resolve_type(parameter).raw_type}}>& | 29 const Maybe<{{resolve_type(parameter).raw_type}}>& |
| 30 {%- else -%} | 30 {%- else -%} |
| 31 {{resolve_type(parameter).pass_type}} | 31 {{resolve_type(parameter).pass_type}} |
| 32 {%- endif %} {{parameter.name}}{%- if not loop.last -%}, {% endif -%} | 32 {%- endif %} {{parameter.name}}{%- if not loop.last -%}, {% endif -%} |
| 33 {% endfor -%}) | 33 {% endfor -%}) |
| 34 { | 34 { |
| 35 RefPtr<JSONObject> jsonMessage = JSONObject::create(); | 35 RefPtr<protocol::DictionaryValue> jsonMessage = DictionaryValue::create(); |
| 36 jsonMessage->setString("method", "{{domain.domain}}.{{event.name}}"); | 36 jsonMessage->setString("method", "{{domain.domain}}.{{event.name}}"); |
| 37 RefPtr<JSONObject> paramsObject = JSONObject::create(); | 37 RefPtr<protocol::DictionaryValue> paramsObject = DictionaryValue::create(); |
| 38 {% for parameter in event.parameters %} | 38 {% for parameter in event.parameters %} |
| 39 {% if "optional" in parameter %} | 39 {% if "optional" in parameter %} |
| 40 if ({{parameter.name}}.isJust()) | 40 if ({{parameter.name}}.isJust()) |
| 41 paramsObject->setValue("{{parameter.name}}", toValue({{parameter.name}}.
fromJust())); | 41 paramsObject->setValue("{{parameter.name}}", toValue({{parameter.name}}.
fromJust())); |
| 42 {% else %} | 42 {% else %} |
| 43 paramsObject->setValue("{{parameter.name}}", toValue({{parameter.name}})); | 43 paramsObject->setValue("{{parameter.name}}", toValue({{parameter.name}})); |
| 44 {% endif %} | 44 {% endif %} |
| 45 {% endfor %} | 45 {% endfor %} |
| 46 jsonMessage->setObject("params", paramsObject); | 46 jsonMessage->setObject("params", paramsObject); |
| 47 if (m_frontendChannel) | 47 if (m_frontendChannel) |
| 48 m_frontendChannel->sendProtocolNotification(jsonMessage.release()); | 48 m_frontendChannel->sendProtocolNotification(jsonMessage.release()); |
| 49 } | 49 } |
| 50 {% endfor %} | 50 {% endfor %} |
| 51 {% endfor %} | 51 {% endfor %} |
| 52 | 52 |
| 53 } // namespace protocol | 53 } // namespace protocol |
| 54 } // namespace blink | 54 } // namespace blink |
| OLD | NEW |