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

Unified Diff: mojo/public/tools/bindings/generators/cpp_templates/struct_serialization_definition.tmpl

Issue 1358353002: * Change C++ serialization/deserialization to not be move-only operations (with the except of |Ha… (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: (*it).get() to it->, and other formatting Created 5 years, 3 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: mojo/public/tools/bindings/generators/cpp_templates/struct_serialization_definition.tmpl
diff --git a/mojo/public/tools/bindings/generators/cpp_templates/struct_serialization_definition.tmpl b/mojo/public/tools/bindings/generators/cpp_templates/struct_serialization_definition.tmpl
index fe25553846ccb00911dd711936e4a04398194d05..eb6fcec31ad08be1f29e6581358905a6eedba968 100644
--- a/mojo/public/tools/bindings/generators/cpp_templates/struct_serialization_definition.tmpl
+++ b/mojo/public/tools/bindings/generators/cpp_templates/struct_serialization_definition.tmpl
@@ -1,12 +1,10 @@
{%- import "struct_macros.tmpl" as struct_macros %}
-size_t GetSerializedSize_(const {{struct.name}}Ptr& input) {
- if (!input)
- return 0;
- {{struct_macros.get_serialized_size(struct, "input->%s")}}
+size_t GetSerializedSize_(const {{struct.name}}& input) {
+ {{struct_macros.get_serialized_size(struct, "input.%s")}}
return size;
}
-void Serialize_({{struct.name}}Ptr input, mojo::internal::Buffer* buf,
+void Serialize_({{struct.name}}* input, mojo::internal::Buffer* buf,
internal::{{struct.name}}_Data** output) {
if (input) {
{{struct_macros.serialize(struct, struct.name ~ " struct", "input->%s", "result", "buf")|indent(2)}}
@@ -17,12 +15,8 @@ void Serialize_({{struct.name}}Ptr input, mojo::internal::Buffer* buf,
}
void Deserialize_(internal::{{struct.name}}_Data* input,
- {{struct.name}}Ptr* output) {
+ {{struct.name}}* result) {
if (input) {
- {{struct.name}}Ptr result({{struct.name}}::New());
{{struct_macros.deserialize(struct, "input", "result->%s")|indent(2)}}
- *output = result.Pass();
- } else {
- output->reset();
}
}

Powered by Google App Engine
This is Rietveld 408576698