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..31eca8a9305d98e5824de08e5c920ba771527e48 |
--- /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}}::Exported::{{type.id}}> { |
+ static std::unique_ptr<{{domain.domain}}::Exported::{{type.id}}> parse(protocol::Value* value, ErrorSupport* errors) |
+ { |
+ if (!value) { |
+ errors->addError("value expected"); |
+ return nullptr; |
+ } |
+ std::unique_ptr<{{domain.domain}}::Exported::{{type.id}}> result = {{domain.domain}}::Exported::{{type.id}}::fromJSONString(value->toJSONString()); |
+ if (!result) |
+ errors->addError("cannot parse"); |
+ return result; |
+ } |
+ |
+ static std::unique_ptr<protocol::Value> serialize({{domain.domain}}::Exported::{{type.id}}* value) |
+ { |
+ return SerializedValue::create(value->toJSONString()); |
+ } |
+ |
+ static std::unique_ptr<protocol::Value> serialize(const std::unique_ptr<{{domain.domain}}::Exported::{{type.id}}>& value) |
+ { |
+ return SerializedValue::create(value->toJSONString()); |
+ } |
+}; |
+ {% endfor %} |
+ |
+} // namespace protocol |
+} // namespace blink |
+ |
+#endif // !defined(protocol_{{domain.domain}}_imported_h) |