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

Unified Diff: mojo/public/tools/bindings/generators/cpp_templates/wrapper_class_declaration.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_declaration.tmpl
diff --git a/mojo/public/tools/bindings/generators/cpp_templates/wrapper_class_declaration.tmpl b/mojo/public/tools/bindings/generators/cpp_templates/wrapper_class_declaration.tmpl
index 613c70d2dc8c23306a719e437acde5e93089629e..263bc9fff4c566fc4906e4c972c8b3ad346b9ef3 100644
--- a/mojo/public/tools/bindings/generators/cpp_templates/wrapper_class_declaration.tmpl
+++ b/mojo/public/tools/bindings/generators/cpp_templates/wrapper_class_declaration.tmpl
@@ -4,9 +4,6 @@ class {{struct.name}} {
public:
using Data_ = internal::{{struct.name}}_Data;
- // TODO(yzshen): Remove Reader.
- using Reader = {{struct.name}}_Reader;
-
{#--- Enums #}
{%- for enum in struct.enums -%}
{{enum_decl(enum)|indent(2)}}
@@ -61,47 +58,3 @@ class {{struct.name}} {
{%- endfor %}
};
-{# TODO(yzshen): Redo the Reader interface. #}
-{# NOTE: Generated Reader instances are intentionally cheap to copy and devoid
- of heap allocations. They should stay this way. #}
-// TODO(yzshen): Remove this.
-class {{struct.name}}_Reader {
- public:
- {{struct.name}}_Reader(internal::{{struct.name}}_Data* data,
- mojo::internal::SerializationContext* context);
-
-{%- for pf in struct.packed.packed_fields_in_ordinal_order %}
-{%- set kind = pf.field.kind -%}
-{%- set name = pf.field.name -%}
-{%- if kind|is_nullable_kind %}
- bool has_{{name}}() const;
-{%- endif %}
-{%- if kind|is_struct_kind and not kind|is_native_only_kind %}
- {{kind|get_name_for_kind}}_Reader {{name}}() const;
-{%- elif kind|is_string_kind %}
- base::StringPiece {{name}}() const;
-{%- elif kind|is_union_kind %}
- // TODO(rockot): Support reading unions. ({{name}}() omitted)
-{%- elif kind|is_object_kind %}
- // TODO(rockot): Support reading other object kinds. ({{name}}() omitted)
-{%- elif kind|is_any_handle_kind %}
- // TODO(rockot): Support reading handles. ({{name}}() omitted)
-{%- elif kind|is_interface_kind %}
- // TODO(rockot): Support reading interfaces. ({{name}}() omitted)
-{%- elif kind|is_interface_request_kind %}
- // TODO(rockot): Support reading interface requests. ({{name}}() omitted)
-{%- elif kind|is_associated_kind %}
- // TODO(rockot): Support reading associated kinds. ({{name}}() omitted)
-{%- elif kind|is_enum_kind %}
- {{kind|cpp_result_type}} {{name}}() const {
- return static_cast<{{kind|cpp_result_type}}>(data_->{{name}});
- }
-{%- else %}
- {{kind|cpp_result_type}} {{name}}() const { return data_->{{name}}; }
-{%- endif %}
-{%- endfor %}
-
- private:
- internal::{{struct.name}}_Data* data_;
- mojo::internal::SerializationContext* context_;
-};

Powered by Google App Engine
This is Rietveld 408576698