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 namespace blink { | 9 namespace blink { |
10 namespace protocol { | 10 namespace protocol { |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 result->m_{{property.name}} = FromValue<{{resolve_type(property).raw_typ
e}}>::parse({{property.name}}Value, errors); | 73 result->m_{{property.name}} = FromValue<{{resolve_type(property).raw_typ
e}}>::parse({{property.name}}Value, errors); |
74 } | 74 } |
75 {% else %} | 75 {% else %} |
76 errors->setName("{{property.name}}"); | 76 errors->setName("{{property.name}}"); |
77 result->m_{{property.name}} = FromValue<{{resolve_type(property).raw_type}}>
::parse({{property.name}}Value, errors); | 77 result->m_{{property.name}} = FromValue<{{resolve_type(property).raw_type}}>
::parse({{property.name}}Value, errors); |
78 {% endif %} | 78 {% endif %} |
79 {% endfor %} | 79 {% endfor %} |
80 errors->pop(); | 80 errors->pop(); |
81 if (errors->hasErrors()) | 81 if (errors->hasErrors()) |
82 return nullptr; | 82 return nullptr; |
83 return result.release(); | 83 return result; |
84 } | 84 } |
85 | 85 |
86 PassOwnPtr<protocol::DictionaryValue> {{type.id}}::serialize() const | 86 PassOwnPtr<protocol::DictionaryValue> {{type.id}}::serialize() const |
87 { | 87 { |
88 OwnPtr<protocol::DictionaryValue> result = DictionaryValue::create(); | 88 OwnPtr<protocol::DictionaryValue> result = DictionaryValue::create(); |
89 {% for property in type.properties %} | 89 {% for property in type.properties %} |
90 {% if property.optional %} | 90 {% if property.optional %} |
91 if (m_{{property.name}}.isJust()) | 91 if (m_{{property.name}}.isJust()) |
92 result->setValue("{{property.name}}", toValue(m_{{property.name}}.fromJu
st())); | 92 result->setValue("{{property.name}}", toValue(m_{{property.name}}.fromJu
st())); |
93 {% else %} | 93 {% else %} |
94 result->setValue("{{property.name}}", toValue({{resolve_type(property).to_ra
w_type % ("m_" + property.name)}})); | 94 result->setValue("{{property.name}}", toValue({{resolve_type(property).to_ra
w_type % ("m_" + property.name)}})); |
95 {% endif %} | 95 {% endif %} |
96 {% endfor %} | 96 {% endfor %} |
97 return result.release(); | 97 return result; |
98 } | 98 } |
99 | 99 |
100 PassOwnPtr<{{type.id}}> {{type.id}}::clone() const | 100 PassOwnPtr<{{type.id}}> {{type.id}}::clone() const |
101 { | 101 { |
102 ErrorSupport errors; | 102 ErrorSupport errors; |
103 return parse(serialize().get(), &errors); | 103 return parse(serialize().get(), &errors); |
104 } | 104 } |
105 {% endfor %} | 105 {% endfor %} |
106 } // {{domain.domain}} | 106 } // {{domain.domain}} |
107 {% endfor %} | 107 {% endfor %} |
(...skipping 13 matching lines...) Expand all Loading... |
121 } // {{param.name | to_title_case}}Enum | 121 } // {{param.name | to_title_case}}Enum |
122 } // {{command.name | to_title_case }} | 122 } // {{command.name | to_title_case }} |
123 } // {{domain.domain}} | 123 } // {{domain.domain}} |
124 {% endif %} | 124 {% endif %} |
125 {% endfor %} | 125 {% endfor %} |
126 {% endfor %} | 126 {% endfor %} |
127 {% endfor %} | 127 {% endfor %} |
128 | 128 |
129 } // namespace protocol | 129 } // namespace protocol |
130 } // namespace blink | 130 } // namespace blink |
OLD | NEW |