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

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

Issue 1517043004: [mojo] Add typemap and variant support to generators (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@pickle3
Patch Set: set proper upstream Created 5 years 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 -%}
6 {%- set variant_path = "%s-%s"|format(module.path, variant) -%}
7 {%- else -%}
8 {%- set variant_path = module.path -%}
9 {%- endif %}
10
5 #if defined(__clang__) 11 #if defined(__clang__)
6 #pragma clang diagnostic push 12 #pragma clang diagnostic push
7 #pragma clang diagnostic ignored "-Wunused-private-field" 13 #pragma clang diagnostic ignored "-Wunused-private-field"
8 #elif defined(_MSC_VER) 14 #elif defined(_MSC_VER)
9 #pragma warning(push) 15 #pragma warning(push)
10 #pragma warning(disable:4056) 16 #pragma warning(disable:4056)
11 #pragma warning(disable:4065) 17 #pragma warning(disable:4065)
12 #pragma warning(disable:4756) 18 #pragma warning(disable:4756)
13 #endif 19 #endif
14 20
15 #include "{{module.path}}.h" 21 #include "{{variant_path}}.h"
16 22
17 #include <math.h> 23 #include <math.h>
18 24
19 #include "base/trace_event/trace_event.h" 25 #include "base/trace_event/trace_event.h"
20 #include "mojo/public/cpp/bindings/lib/array_serialization.h" 26 #include "mojo/public/cpp/bindings/lib/array_serialization.h"
21 #include "mojo/public/cpp/bindings/lib/bindings_serialization.h" 27 #include "mojo/public/cpp/bindings/lib/bindings_serialization.h"
22 #include "mojo/public/cpp/bindings/lib/bounds_checker.h" 28 #include "mojo/public/cpp/bindings/lib/bounds_checker.h"
23 #include "mojo/public/cpp/bindings/lib/map_data_internal.h" 29 #include "mojo/public/cpp/bindings/lib/map_data_internal.h"
24 #include "mojo/public/cpp/bindings/lib/map_serialization.h" 30 #include "mojo/public/cpp/bindings/lib/map_serialization.h"
25 #include "mojo/public/cpp/bindings/lib/message_builder.h" 31 #include "mojo/public/cpp/bindings/lib/message_builder.h"
26 #include "mojo/public/cpp/bindings/lib/string_serialization.h" 32 #include "mojo/public/cpp/bindings/lib/string_serialization.h"
27 #include "mojo/public/cpp/bindings/lib/validate_params.h" 33 #include "mojo/public/cpp/bindings/lib/validate_params.h"
28 #include "mojo/public/cpp/bindings/lib/validation_errors.h" 34 #include "mojo/public/cpp/bindings/lib/validation_errors.h"
29 #include "mojo/public/cpp/bindings/lib/validation_util.h" 35 #include "mojo/public/cpp/bindings/lib/validation_util.h"
30 #include "mojo/public/cpp/environment/lib/scoped_task_tracking.h" 36 #include "mojo/public/cpp/environment/lib/scoped_task_tracking.h"
31 #include "mojo/public/cpp/environment/logging.h" 37 #include "mojo/public/cpp/environment/logging.h"
32 #include "mojo/public/interfaces/bindings/interface_control_messages.mojom.h" 38 #include "mojo/public/interfaces/bindings/interface_control_messages.mojom.h"
33 39
34 {%- for namespace in namespaces_as_array %} 40 {%- for namespace in namespaces_as_array %}
35 namespace {{namespace}} { 41 namespace {{namespace}} {
36 {%- endfor %} 42 {%- endfor %}
43 {%- if variant %}
44 namespace {{variant}} {
45 {%- endif %}
37 46
38 {#--- Constants #} 47 {#--- Constants #}
39 {%- for constant in module.constants %} 48 {%- for constant in module.constants %}
40 {%- if not constant.kind|is_integral_kind %} 49 {%- if not constant.kind|is_integral_kind %}
41 const {{constant.kind|cpp_pod_type}} {{constant.name}} = {{constant|constant_val ue}}; 50 const {{constant.kind|cpp_pod_type}} {{constant.name}} = {{constant|constant_val ue}};
42 {%- endif %} 51 {%- endif %}
43 {%- endfor %} 52 {%- endfor %}
44 53
45 namespace internal { 54 namespace internal {
46 namespace { 55 namespace {
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 {#--- Struct Serialization Helpers #} 123 {#--- Struct Serialization Helpers #}
115 {%- for struct in structs %} 124 {%- for struct in structs %}
116 {%- include "struct_serialization_definition.tmpl" %} 125 {%- include "struct_serialization_definition.tmpl" %}
117 {%- endfor %} 126 {%- endfor %}
118 127
119 {#--- Union Serialization Helpers #} 128 {#--- Union Serialization Helpers #}
120 {%- for union in unions %} 129 {%- for union in unions %}
121 {%- include "union_serialization_definition.tmpl" %} 130 {%- include "union_serialization_definition.tmpl" %}
122 {%- endfor %} 131 {%- endfor %}
123 132
133 {%- if variant %}
134 } // namespace {{variant}}
135 {%- endif %}
124 {%- for namespace in namespaces_as_array|reverse %} 136 {%- for namespace in namespaces_as_array|reverse %}
125 } // namespace {{namespace}} 137 } // namespace {{namespace}}
126 {%- endfor %} 138 {%- endfor %}
127 139
128 #if defined(__clang__) 140 #if defined(__clang__)
129 #pragma clang diagnostic pop 141 #pragma clang diagnostic pop
130 #elif defined(_MSC_VER) 142 #elif defined(_MSC_VER)
131 #pragma warning(pop) 143 #pragma warning(pop)
132 #endif 144 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698