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

Unified Diff: third_party/WebKit/Source/platform/inspector_protocol/Imported_h.template

Issue 2159633002: [DevTools] Generate public versions of protocol classes to be exposed in v8_inspector/public. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: removed extra files Created 4 years, 5 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/Imported_h.template
diff --git a/third_party/WebKit/Source/platform/inspector_protocol/Imported_h.template b/third_party/WebKit/Source/platform/inspector_protocol/Imported_h.template
new file mode 100644
index 0000000000000000000000000000000000000000..a9abdad172642e5dd007e940c851573622975685
--- /dev/null
+++ b/third_party/WebKit/Source/platform/inspector_protocol/Imported_h.template
@@ -0,0 +1,49 @@
+// 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 protocol_{{domain.domain}}_imported_h
+#define protocol_{{domain.domain}}_imported_h
+
+#include "platform/inspector_protocol/ErrorSupport.h"
+#include "platform/inspector_protocol/ValueConversions.h"
+#include "platform/inspector_protocol/Values.h"
+#include "{{include_package}}/{{domain.domain}}.h"
+
+namespace blink {
+namespace protocol {
+ {% for type in domain.types %}
+ {% if not (type.type == "object") or not ("properties" in type) or not (type.exported) %}{% continue %}{% endif %}
+
+template<>
+struct ValueConversions<{{domain.domain}}::API::{{type.id}}> {
+ static std::unique_ptr<{{domain.domain}}::API::{{type.id}}> parse(protocol::Value* value, ErrorSupport* errors)
+ {
+ if (!value) {
+ errors->addError("value expected");
+ return nullptr;
+ }
+ std::unique_ptr<{{domain.domain}}::API::{{type.id}}> result = {{domain.domain}}::API::{{type.id}}::fromJSONString(value->toJSONString());
+ if (!result)
+ errors->addError("cannot parse");
+ return result;
+ }
+
+ static std::unique_ptr<protocol::Value> serialize({{domain.domain}}::API::{{type.id}}* value)
+ {
+ return SerializedValue::create(value->toJSONString());
+ }
+
+ static std::unique_ptr<protocol::Value> serialize(const std::unique_ptr<{{domain.domain}}::API::{{type.id}}>& value)
+ {
+ return SerializedValue::create(value->toJSONString());
+ }
+};
+ {% endfor %}
+
+} // namespace protocol
+} // namespace blink
+
+#endif // !defined(protocol_{{domain.domain}}_imported_h)

Powered by Google App Engine
This is Rietveld 408576698