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

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

Issue 1966933002: Mojo C++ bindings: switch the existing usage of StructTraits to use the new data view interface. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@26_reader
Patch Set: typeid() is not allowed :/ Created 4 years, 7 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/wrapper_class_definition.tmpl
diff --git a/mojo/public/tools/bindings/generators/cpp_templates/wrapper_class_definition.tmpl b/mojo/public/tools/bindings/generators/cpp_templates/wrapper_class_definition.tmpl
index 9eaf47735be75a6bff8c8f0f0bdcfd5fc4b7869c..2bd7ceb337dbfb7f7fef8fdc0158b68060132605 100644
--- a/mojo/public/tools/bindings/generators/cpp_templates/wrapper_class_definition.tmpl
+++ b/mojo/public/tools/bindings/generators/cpp_templates/wrapper_class_definition.tmpl
@@ -27,45 +27,3 @@
return rv;
}
{% endif %}
-
-{{struct.name}}_Reader::{{struct.name}}_Reader(
- internal::{{struct.name}}_Data* data,
- mojo::internal::SerializationContext* context)
- : data_(data), context_(context) { }
-
-{%- for pf in struct.packed.packed_fields_in_ordinal_order %}
-{%- set name = pf.field.name -%}
-{%- set kind = pf.field.kind %}
-{%- if kind|is_nullable_kind %}
-bool {{struct.name}}_Reader::has_{{name}}() const {
-{%- if kind|is_union_kind %}
- return !data_->{{name}}.is_null();
-{%- elif kind|is_object_kind %}
- return data_->{{name}}.ptr != nullptr;
-{%- elif kind|is_interface_kind %}
- return data_->{{name}}.handle.is_valid();
-{%- elif kind|is_interface_request_kind %}
- return data_->{{name}}.is_valid();
-{%- elif kind|is_associated_interface_kind %}
- return data_->{{name}}.interface_id == mojo::internal::kInvalidInterfaceId;
-{%- elif kind|is_associated_interface_request_kind %}
- return data_->{{name}} == mojo::internal::kInvalidInterfaceId;
-{%- elif kind|is_any_handle_kind %}
- return data_->{{name}}.is_valid();
-{%- else %}
- return !!data_->{{name}};
-{%- endif %}
-}
-{%- endif %}
-{%- if kind|is_struct_kind and not kind|is_native_only_kind %}
-{{kind|get_name_for_kind}}_Reader {{struct.name}}_Reader::{{name}}() const {
- return {{kind|get_name_for_kind}}_Reader(data_->{{name}}.ptr, context_);
-}
-{%- elif kind|is_string_kind %}
-base::StringPiece {{struct.name}}_Reader::{{name}}() const {
- DCHECK(data_->{{name}}.ptr);
- return base::StringPiece(data_->{{name}}.ptr->storage(),
- data_->{{name}}.ptr->size());
-}
-{%- endif %}
-{%- endfor %}

Powered by Google App Engine
This is Rietveld 408576698