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

Side by Side Diff: mojo/public/tools/bindings/generators/cpp_templates/struct_data_view_declaration.tmpl

Issue 2803023005: Switch base::Value typemapping to be by value instead of by unique_ptr.
Patch Set: Created 3 years, 8 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 unified diff | Download patch
« no previous file with comments | « mojo/common/values_struct_traits.cc ('k') | services/preferences/persistent_pref_store_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 class {{struct.name}}DataView { 1 class {{struct.name}}DataView {
2 public: 2 public:
3 {{struct.name}}DataView() {} 3 {{struct.name}}DataView() {}
4 4
5 {{struct.name}}DataView( 5 {{struct.name}}DataView(
6 internal::{{struct.name}}_Data* data, 6 internal::{{struct.name}}_Data* data,
7 mojo::internal::SerializationContext* context) 7 mojo::internal::SerializationContext* context)
8 {%- if struct|requires_context_for_data_view %} 8 {%- if struct|requires_context_for_data_view %}
9 : data_(data), context_(context) {} 9 : data_(data), context_(context) {}
10 {%- else %} 10 {%- else %}
(...skipping 10 matching lines...) Expand all
21 {{kind|cpp_data_view_type}}* output); 21 {{kind|cpp_data_view_type}}* output);
22 22
23 template <typename UserType> 23 template <typename UserType>
24 WARN_UNUSED_RESULT bool Read{{name|under_to_camel}}(UserType* output) { 24 WARN_UNUSED_RESULT bool Read{{name|under_to_camel}}(UserType* output) {
25 {%- if pf.min_version != 0 %} 25 {%- if pf.min_version != 0 %}
26 auto* pointer = data_->header_.version >= {{pf.min_version}} 26 auto* pointer = data_->header_.version >= {{pf.min_version}}
27 ? &data_->{{name}} : nullptr; 27 ? &data_->{{name}} : nullptr;
28 {%- else %} 28 {%- else %}
29 auto* pointer = &data_->{{name}}; 29 auto* pointer = &data_->{{name}};
30 {%- endif %} 30 {%- endif %}
31 if (pointer && pointer->is_null())
32 pointer = nullptr;
33
31 return mojo::internal::Deserialize<{{kind|unmapped_type_for_serializer}}>( 34 return mojo::internal::Deserialize<{{kind|unmapped_type_for_serializer}}>(
32 pointer, output, context_); 35 pointer, output, context_);
33 } 36 }
34 37
35 {%- elif kind|is_object_kind %} 38 {%- elif kind|is_object_kind %}
36 inline void Get{{name|under_to_camel}}DataView( 39 inline void Get{{name|under_to_camel}}DataView(
37 {{kind|cpp_data_view_type}}* output); 40 {{kind|cpp_data_view_type}}* output);
38 41
39 template <typename UserType> 42 template <typename UserType>
40 WARN_UNUSED_RESULT bool Read{{name|under_to_camel}}(UserType* output) { 43 WARN_UNUSED_RESULT bool Read{{name|under_to_camel}}(UserType* output) {
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 112
110 {%- endif %} 113 {%- endif %}
111 {%- endfor %} 114 {%- endfor %}
112 private: 115 private:
113 internal::{{struct.name}}_Data* data_ = nullptr; 116 internal::{{struct.name}}_Data* data_ = nullptr;
114 {%- if struct|requires_context_for_data_view %} 117 {%- if struct|requires_context_for_data_view %}
115 mojo::internal::SerializationContext* context_ = nullptr; 118 mojo::internal::SerializationContext* context_ = nullptr;
116 {%- endif %} 119 {%- endif %}
117 }; 120 };
118 121
OLDNEW
« no previous file with comments | « mojo/common/values_struct_traits.cc ('k') | services/preferences/persistent_pref_store_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698