diff options
Diffstat (limited to 'deps/v8/third_party/inspector_protocol/templates/Imported_h.template')
-rw-r--r-- | deps/v8/third_party/inspector_protocol/templates/Imported_h.template | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/deps/v8/third_party/inspector_protocol/templates/Imported_h.template b/deps/v8/third_party/inspector_protocol/templates/Imported_h.template index c23b8fe87c..4c9d24bd5f 100644 --- a/deps/v8/third_party/inspector_protocol/templates/Imported_h.template +++ b/deps/v8/third_party/inspector_protocol/templates/Imported_h.template @@ -7,39 +7,43 @@ #ifndef {{"_".join(config.protocol.namespace)}}_{{domain.domain}}_imported_h #define {{"_".join(config.protocol.namespace)}}_{{domain.domain}}_imported_h -#include "{{config.protocol.package}}/Protocol.h" -#include {{format_include(config.imported.header if config.imported.header else "\"%s/%s.h\"" % (config.imported.package, domain.domain))}} +#include {{format_include(config.protocol.package, "Protocol")}} +{% if config.imported.header %} +#include {{format_include(config.imported.header)}} +{% else %} +#include {{format_include(config.imported.package, domain.domain)}} +{% endif %} {% for namespace in config.protocol.namespace %} namespace {{namespace}} { {% endfor %} {% for type in domain.types %} - {% if not (type.type == "object") or not ("properties" in type) or not (type.exported) %}{% continue %}{% endif %} + {% if not (type.type == "object") or not ("properties" in type) or not protocol.is_imported(domain.domain, type.id) %}{% continue %}{% endif %} template<> struct ValueConversions<{{"::".join(config.imported.namespace)}}::{{domain.domain}}::API::{{type.id}}> { - static std::unique_ptr<{{"::".join(config.imported.namespace)}}::{{domain.domain}}::API::{{type.id}}> parse(protocol::Value* value, ErrorSupport* errors) + static std::unique_ptr<{{"::".join(config.imported.namespace)}}::{{domain.domain}}::API::{{type.id}}> fromValue(protocol::Value* value, ErrorSupport* errors) { if (!value) { errors->addError("value expected"); return nullptr; } - String json = value->toJSONString(); + String json = value->serialize(); auto result = {{"::".join(config.imported.namespace)}}::{{domain.domain}}::API::{{type.id}}::fromJSONString({{config.imported.to_imported_string % "json"}}); if (!result) errors->addError("cannot parse"); return result; } - static std::unique_ptr<protocol::Value> serialize(const {{"::".join(config.imported.namespace)}}::{{domain.domain}}::API::{{type.id}}* value) + static std::unique_ptr<protocol::Value> toValue(const {{"::".join(config.imported.namespace)}}::{{domain.domain}}::API::{{type.id}}* value) { auto json = value->toJSONString(); return SerializedValue::create({{config.imported.from_imported_string % "std::move(json)"}}); } - static std::unique_ptr<protocol::Value> serialize(const std::unique_ptr<{{"::".join(config.imported.namespace)}}::{{domain.domain}}::API::{{type.id}}>& value) + static std::unique_ptr<protocol::Value> toValue(const std::unique_ptr<{{"::".join(config.imported.namespace)}}::{{domain.domain}}::API::{{type.id}}>& value) { - return serialize(value.get()); + return toValue(value.get()); } }; {% endfor %} |