• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
3// found in the LICENSE file.
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
11#if defined(__clang__)
12#pragma clang diagnostic push
13#pragma clang diagnostic ignored "-Wunused-private-field"
14#elif defined(_MSC_VER)
15#pragma warning(push)
16#pragma warning(disable:4056)
17#pragma warning(disable:4065)
18#pragma warning(disable:4756)
19#endif
20
21#include "{{variant_path}}.h"
22
23#include <math.h>
24#include <stdint.h>
25#include <utility>
26
27#include "base/logging.h"
28#include "base/run_loop.h"
29#include "mojo/public/cpp/bindings/lib/message_internal.h"
30#include "mojo/public/cpp/bindings/lib/serialization_util.h"
31#include "mojo/public/cpp/bindings/lib/unserialized_message_context.h"
32#include "mojo/public/cpp/bindings/lib/validate_params.h"
33#include "mojo/public/cpp/bindings/lib/validation_context.h"
34#include "mojo/public/cpp/bindings/lib/validation_errors.h"
35#include "mojo/public/interfaces/bindings/interface_control_messages.mojom.h"
36
37#include "{{module.path}}-shared-message-ids.h"
38
39{%- if for_blink %}
40#include "mojo/public/cpp/bindings/lib/wtf_serialization.h"
41{%- endif %}
42
43{%- for header in extra_traits_headers %}
44#include "{{header}}"
45{%- endfor %}
46
47{%- for namespace in namespaces_as_array %}
48namespace {{namespace}} {
49{%- endfor %}
50{%- if variant %}
51namespace {{variant}} {
52{%- endif %}
53
54{#--- Constants #}
55{%- for constant in module.constants %}
56{%-   if constant.kind|is_string_kind %}
57const char {{constant.name}}[] = {{constant|constant_value}};
58{%-   endif %}
59{%- endfor %}
60
61{#--- Struct Constants #}
62{%- for struct in structs %}
63{%-   for constant in struct.constants %}
64{%-     if constant.kind|is_string_kind %}
65const char {{struct.name}}::{{constant.name}}[] = {{constant|constant_value}};
66{%-     else %}
67constexpr {{constant.kind|cpp_pod_type}} {{struct.name}}::{{constant.name}};
68{%-     endif %}
69{%-   endfor %}
70{%- endfor %}
71
72{#--- Struct builder definitions #}
73{%- for struct in structs %}
74{%-   if not struct|is_native_only_kind %}
75{%-     include "wrapper_class_definition.tmpl" %}
76{%-   endif %}
77{%- endfor %}
78
79{#--- Union builder definitions #}
80{%- for union in unions %}
81{%-   include "wrapper_union_class_definition.tmpl" %}
82{%- endfor %}
83
84{#--- Interface definitions #}
85{%- for interface in interfaces %}
86{%-   include "interface_definition.tmpl" %}
87{%- endfor %}
88
89{%- if variant %}
90}  // namespace {{variant}}
91{%- endif %}
92{%- for namespace in namespaces_as_array|reverse %}
93}  // namespace {{namespace}}
94{%- endfor %}
95
96namespace mojo {
97
98{#--- Struct Serialization Helpers -#}
99{%  for struct in structs %}
100{%-   if not struct|is_native_only_kind %}
101{%      include "struct_traits_definition.tmpl" %}
102{%-   endif %}
103{%- endfor %}
104
105{#--- Union Serialization Helpers #}
106{%- for union in unions %}
107{%-   include "union_traits_definition.tmpl" %}
108{%- endfor %}
109
110}  // namespace mojo
111
112#if defined(__clang__)
113#pragma clang diagnostic pop
114#elif defined(_MSC_VER)
115#pragma warning(pop)
116#endif
117