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

Side by Side Diff: mojo/public/tools/bindings/generators/cpp_templates/module-shared.h.tmpl

Issue 2637393002: Make mojom-generated C++ string constants really constant. (Closed)
Patch Set: Created 3 years, 11 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 {%- set header_guard = "%s_SHARED_H_"|format( 5 {%- set header_guard = "%s_SHARED_H_"|format(
6 module.path|upper|replace("/","_")|replace(".","_")| 6 module.path|upper|replace("/","_")|replace(".","_")|
7 replace("-", "_")) %} 7 replace("-", "_")) %}
8 8
9 {%- macro mojom_type_traits(kind) %} 9 {%- macro mojom_type_traits(kind) %}
10 template <> 10 template <>
11 struct MojomTypeTraits<{{kind|get_qualified_name_for_kind}}DataView> { 11 struct MojomTypeTraits<{{kind|get_qualified_name_for_kind}}DataView> {
12 using Data = {{kind|get_qualified_name_for_kind(internal=True)}}; 12 using Data = {{kind|get_qualified_name_for_kind(internal=True)}};
13 {%- if kind|is_union_kind %} 13 {%- if kind|is_union_kind %}
14 using DataAsArrayElement = Data; 14 using DataAsArrayElement = Data;
15 static const MojomTypeCategory category = MojomTypeCategory::UNION; 15 static constexpr MojomTypeCategory category = MojomTypeCategory::UNION;
16 {%- else %} 16 {%- else %}
17 using DataAsArrayElement = Pointer<Data>; 17 using DataAsArrayElement = Pointer<Data>;
18 static const MojomTypeCategory category = MojomTypeCategory::STRUCT; 18 static constexpr MojomTypeCategory category = MojomTypeCategory::STRUCT;
19 {%- endif %} 19 {%- endif %}
20 }; 20 };
21 {%- endmacro %} 21 {%- endmacro %}
22 22
23 {%- macro namespace_begin() %} 23 {%- macro namespace_begin() %}
24 {%- for namespace in namespaces_as_array %} 24 {%- for namespace in namespaces_as_array %}
25 namespace {{namespace}} { 25 namespace {{namespace}} {
26 {%- endfor %} 26 {%- endfor %}
27 {%- endmacro %} 27 {%- endmacro %}
28 28
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 {%- endfor %} 203 {%- endfor %}
204 204
205 {%- for union in unions %} 205 {%- for union in unions %}
206 {% include "union_data_view_definition.tmpl" %} 206 {% include "union_data_view_definition.tmpl" %}
207 {%- endfor %} 207 {%- endfor %}
208 208
209 {{namespace_end()}} 209 {{namespace_end()}}
210 210
211 #endif // {{header_guard}} 211 #endif // {{header_guard}}
212 212
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698