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

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

Issue 2259283003: Mojo C++ bindings: share DataView class between chromium and blink variants. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@92_change_traits_param
Patch Set: . Created 4 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 {%- if variant -%} 5 {%- if variant -%}
6 {%- set variant_path = "%s-%s"|format(module.path, variant) -%} 6 {%- set variant_path = "%s-%s"|format(module.path, variant) -%}
7 {%- else -%} 7 {%- else -%}
8 {%- set variant_path = module.path -%} 8 {%- set variant_path = module.path -%}
9 {%- endif %} 9 {%- endif %}
10 10
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 namespace {{variant}} { 48 namespace {{variant}} {
49 {%- endif %} 49 {%- endif %}
50 50
51 {#--- Constants #} 51 {#--- Constants #}
52 {%- for constant in module.constants %} 52 {%- for constant in module.constants %}
53 {%- if not constant.kind|is_integral_kind %} 53 {%- if not constant.kind|is_integral_kind %}
54 const {{constant.kind|cpp_pod_type}} {{constant.name}} = {{constant|constant_val ue}}; 54 const {{constant.kind|cpp_pod_type}} {{constant.name}} = {{constant|constant_val ue}};
55 {%- endif %} 55 {%- endif %}
56 {%- endfor %} 56 {%- endfor %}
57 57
58 namespace {
59
60 {#--- Interface parameter data view definitions #}
61 {%- for interface in interfaces %}
62 {%- for method in interface.methods %}
63 {% set struct = method.param_struct %}
64 {% include "struct_data_view_declaration.tmpl" %}
65 {% include "struct_data_view_definition.tmpl" %}
66 {%- if method.response_parameters != None %}
67 {%- set struct = method.response_param_struct %}
68 {% include "struct_data_view_declaration.tmpl" %}
69 {% include "struct_data_view_definition.tmpl" %}
70 {%- endif %}
71 {%- endfor %}
72 {%- endfor %}
73
74 } // namespace
75
76 {#--- Struct Constants #} 58 {#--- Struct Constants #}
77 {%- for struct in structs %} 59 {%- for struct in structs %}
78 {%- for constant in struct.constants %} 60 {%- for constant in struct.constants %}
79 {%- if constant.kind|is_integral_kind %} 61 {%- if constant.kind|is_integral_kind %}
80 const {{constant.kind|cpp_pod_type}} {{struct.name}}::{{constant.name}}; 62 const {{constant.kind|cpp_pod_type}} {{struct.name}}::{{constant.name}};
81 {%- else %} 63 {%- else %}
82 const {{constant.kind|cpp_pod_type}} {{struct.name}}::{{constant.name}} = {{cons tant|constant_value}}; 64 const {{constant.kind|cpp_pod_type}} {{struct.name}}::{{constant.name}} = {{cons tant|constant_value}};
83 {%- endif %} 65 {%- endif %}
84 {%- endfor %} 66 {%- endfor %}
85 {%- endfor %} 67 {%- endfor %}
(...skipping 20 matching lines...) Expand all
106 {%- endif %} 88 {%- endif %}
107 {%- for namespace in namespaces_as_array|reverse %} 89 {%- for namespace in namespaces_as_array|reverse %}
108 } // namespace {{namespace}} 90 } // namespace {{namespace}}
109 {%- endfor %} 91 {%- endfor %}
110 92
111 namespace mojo { 93 namespace mojo {
112 94
113 {#--- Struct Serialization Helpers -#} 95 {#--- Struct Serialization Helpers -#}
114 {% for struct in structs %} 96 {% for struct in structs %}
115 {%- if not struct|is_native_only_kind %} 97 {%- if not struct|is_native_only_kind %}
116 {% include "struct_serialization_definition.tmpl" %} 98 {% include "struct_traits_definition.tmpl" %}
117 {%- endif %} 99 {%- endif %}
118 {%- endfor %} 100 {%- endfor %}
119 101
120 {#--- Union Serialization Helpers #} 102 {#--- Union Serialization Helpers #}
121 {%- for union in unions %} 103 {%- for union in unions %}
122 {%- include "union_serialization_definition.tmpl" %} 104 {%- include "union_traits_definition.tmpl" %}
123 {%- endfor %} 105 {%- endfor %}
124 106
125 } // namespace mojo 107 } // namespace mojo
126 108
127
128 #if defined(__clang__) 109 #if defined(__clang__)
129 #pragma clang diagnostic pop 110 #pragma clang diagnostic pop
130 #elif defined(_MSC_VER) 111 #elif defined(_MSC_VER)
131 #pragma warning(pop) 112 #pragma warning(pop)
132 #endif 113 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698