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

Unified Diff: third_party/WebKit/Source/platform/inspector_protocol/Frontend_h.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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/platform/inspector_protocol/Frontend_h.template
diff --git a/third_party/WebKit/Source/platform/inspector_protocol/Frontend_h.template b/third_party/WebKit/Source/platform/inspector_protocol/Frontend_h.template
new file mode 100644
index 0000000000000000000000000000000000000000..d0a630c8f76e914bae0505f0c988b2a81b8b6c35
--- /dev/null
+++ b/third_party/WebKit/Source/platform/inspector_protocol/Frontend_h.template
@@ -0,0 +1,64 @@
+// This file is generated
+
+// Copyright (c) 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef {{class_name}}_h
+#define {{class_name}}_h
+
+
+#include "platform/inspector_protocol/FrontendChannel.h"
+#include "platform/inspector_protocol/TypeBuilder.h"
+
+namespace blink {
+namespace protocol {
+
+using ErrorString = String;
+
+class PLATFORM_EXPORT Frontend {
+public:
+ Frontend(FrontendChannel*);
+ FrontendChannel* channel() { return m_frontendChannel; }
+
+{% for domain in api.domains %}
+
+ class PLATFORM_EXPORT {{domain.domain}} {
+ public:
+ static {{domain.domain}}* from(Frontend* frontend) { return &(frontend->m_{{domain.domain | lower}}) ;}
+ {{domain.domain}}(FrontendChannel* frontendChannel) : m_frontendChannel(frontendChannel) { }
+ {% for event in domain.events %}
+ {% if "handlers" in event and not ("renderer" in event["handlers"]) %}{% continue %}{% endif %}
+ void {{event.name}}(
+ {%- for parameter in event.parameters -%}
+ {%- if "optional" in parameter -%}
+ {{resolve_type(parameter).optional_pass_type}}
+ {%- if resolve_type(parameter).nullable -%}
+ {{parameter.name}} = nullptr
+ {%- else -%}
+ {{parameter.name}} = {{resolve_type(parameter).optional_type}}()
+ {%- endif %}
+ {%- else -%}
+ {{resolve_type(parameter).pass_type}} {{parameter.name}}
+ {%- endif -%}{%- if not loop.last -%}, {% endif -%}
+ {%- endfor -%}
+ );
+ {% endfor %}
+
+ void flush() { m_frontendChannel->flush(); }
+ private:
+ FrontendChannel* m_frontendChannel;
+ };
+{% endfor %}
+
+private:
+ FrontendChannel* m_frontendChannel;
+{% for domain in api.domains %}
+ {{domain.domain}} m_{{domain.domain | lower}};
+{% endfor %}
+};
+
+} // namespace protocol
+} // namespace blink
+
+#endif // !defined({{class_name}}_h)

Powered by Google App Engine
This is Rietveld 408576698