Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(140)

Side by Side Diff: third_party/WebKit/Source/platform/inspector_protocol/Frontend_cpp.template

Issue 1702673002: DevTools: migrate remote debugging protocol generators to jinja2. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // This file is generated
2
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
5 // found in the LICENSE file.
6
7 #include "platform/inspector_protocol/{{class_name}}.h"
8
9 #include "wtf/text/CString.h"
10 #include "wtf/text/WTFString.h"
11
12 namespace blink {
13 namespace protocol {
14
15 Frontend::Frontend(FrontendChannel* frontendChannel)
16 : m_frontendChannel(frontendChannel)
17 {% for domain in api.domains %}
18 , m_{{domain.domain | lower}}(frontendChannel)
19 {% endfor %}
20 {
21 }
22
23 {% for domain in api.domains %}
24 {% for event in domain.events %}
25 {% if "handlers" in event and not ("renderer" in event["handlers"]) %}{% con tinue %}{% endif %}
26 void Frontend::{{domain.domain}}::{{event.name}}(
27 {%- for parameter in event.parameters %}
28 {% if "optional" in parameter -%}
29 {{resolve_type(parameter).optional_pass_type}}
30 {%- else -%}
31 {{resolve_type(parameter).pass_type}}
32 {%- endif %} {{parameter.name}}{%- if not loop.last -%}, {% endif -%}
33 {% endfor -%})
34 {
35 RefPtr<JSONObject> jsonMessage = JSONObject::create();
36 jsonMessage->setString("method", "{{domain.domain}}.{{event.name}}");
37 RefPtr<JSONObject> paramsObject = JSONObject::create();
38 {% for parameter in event.parameters %}
39 {% if "optional" in parameter %}
40 {{resolve_type(parameter).optional_type}} opt_{{parameter.name}} = {{paramet er.name}};
41 if (hasValue(opt_{{parameter.name}}))
42 paramsObject->setValue("{{parameter.name}}", toValue({{resolve_type(para meter).from_optional_out % ("opt_" + parameter.name)}}));
43 {% else %}
44 paramsObject->setValue("{{parameter.name}}", toValue({{parameter.name}}));
45 {% endif %}
46 {% endfor %}
47 jsonMessage->setObject("params", paramsObject);
48 if (m_frontendChannel)
49 m_frontendChannel->sendProtocolNotification(jsonMessage.release());
50 }
51 {% endfor %}
52 {% endfor %}
53
54 } // namespace protocol
55 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698