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

Unified Diff: templates/Imported_h.template

Issue 2526603002: [inspector_protocol] Introduce protocol::Serializable (Closed)
Patch Set: minor fix Created 4 years, 1 month 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
« no previous file with comments | « lib/Values_h.template ('k') | templates/TypeBuilder_cpp.template » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: templates/Imported_h.template
diff --git a/templates/Imported_h.template b/templates/Imported_h.template
index afd56685845f6ab84fbcf3c0aa0a6af8d2247016..6c184a931cd9da7b3f754beb275eb02bb0f406b8 100644
--- a/templates/Imported_h.template
+++ b/templates/Imported_h.template
@@ -22,28 +22,28 @@ namespace {{namespace}} {
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 %}
« no previous file with comments | « lib/Values_h.template ('k') | templates/TypeBuilder_cpp.template » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698