| 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 "platform/inspector_protocol/String16.h" | 9 #include "platform/inspector_protocol/String16.h" |
| 10 | 10 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 {% if "handlers" in event and not ("renderer" in event["handlers"]) %}{% con
tinue %}{% endif %} | 24 {% if "handlers" in event and not ("renderer" in event["handlers"]) %}{% con
tinue %}{% endif %} |
| 25 void Frontend::{{domain.domain}}::{{event.name}}( | 25 void Frontend::{{domain.domain}}::{{event.name}}( |
| 26 {%- for parameter in event.parameters %} | 26 {%- for parameter in event.parameters %} |
| 27 {% if "optional" in parameter -%} | 27 {% if "optional" in parameter -%} |
| 28 const Maybe<{{resolve_type(parameter).raw_type}}>& | 28 const Maybe<{{resolve_type(parameter).raw_type}}>& |
| 29 {%- else -%} | 29 {%- else -%} |
| 30 {{resolve_type(parameter).pass_type}} | 30 {{resolve_type(parameter).pass_type}} |
| 31 {%- endif %} {{parameter.name}}{%- if not loop.last -%}, {% endif -%} | 31 {%- endif %} {{parameter.name}}{%- if not loop.last -%}, {% endif -%} |
| 32 {% endfor -%}) | 32 {% endfor -%}) |
| 33 { | 33 { |
| 34 OwnPtr<protocol::DictionaryValue> jsonMessage = DictionaryValue::create(); | 34 std::unique_ptr<protocol::DictionaryValue> jsonMessage = DictionaryValue::cr
eate(); |
| 35 jsonMessage->setString("method", "{{domain.domain}}.{{event.name}}"); | 35 jsonMessage->setString("method", "{{domain.domain}}.{{event.name}}"); |
| 36 OwnPtr<protocol::DictionaryValue> paramsObject = DictionaryValue::create(); | 36 std::unique_ptr<protocol::DictionaryValue> paramsObject = DictionaryValue::c
reate(); |
| 37 {% for parameter in event.parameters %} | 37 {% for parameter in event.parameters %} |
| 38 {% if "optional" in parameter %} | 38 {% if "optional" in parameter %} |
| 39 if ({{parameter.name}}.isJust()) | 39 if ({{parameter.name}}.isJust()) |
| 40 paramsObject->setValue("{{parameter.name}}", toValue({{parameter.name}}.
fromJust())); | 40 paramsObject->setValue("{{parameter.name}}", toValue({{parameter.name}}.
fromJust())); |
| 41 {% else %} | 41 {% else %} |
| 42 paramsObject->setValue("{{parameter.name}}", toValue({{resolve_type(paramete
r).to_raw_type % parameter.name}})); | 42 paramsObject->setValue("{{parameter.name}}", toValue({{resolve_type(paramete
r).to_raw_type % parameter.name}})); |
| 43 {% endif %} | 43 {% endif %} |
| 44 {% endfor %} | 44 {% endfor %} |
| 45 jsonMessage->setObject("params", std::move(paramsObject)); | 45 jsonMessage->setObject("params", std::move(paramsObject)); |
| 46 if (m_frontendChannel) | 46 if (m_frontendChannel) |
| 47 m_frontendChannel->sendProtocolNotification(jsonMessage->toJSONString())
; | 47 m_frontendChannel->sendProtocolNotification(jsonMessage->toJSONString())
; |
| 48 } | 48 } |
| 49 {% endfor %} | 49 {% endfor %} |
| 50 {% endfor %} | 50 {% endfor %} |
| 51 | 51 |
| 52 } // namespace protocol | 52 } // namespace protocol |
| 53 } // namespace blink | 53 } // namespace blink |
| OLD | NEW |