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/trace_event/trace_event.h" 29 #include "mojo/public/cpp/bindings/lib/message_builder.h" 30 #include "mojo/public/cpp/bindings/lib/serialization_util.h" 31 #include "mojo/public/cpp/bindings/lib/validate_params.h" 32 #include "mojo/public/cpp/bindings/lib/validation_context.h" 33 #include "mojo/public/cpp/bindings/lib/validation_errors.h" 34 #include "mojo/public/interfaces/bindings/interface_control_messages.mojom.h" 35 36 {%- if for_blink %} 37 #include "mojo/public/cpp/bindings/lib/wtf_serialization.h" 38 {%- endif %} 39 40 {%- for header in extra_traits_headers %} 41 #include "{{header}}" 42 {%- endfor %} 43 44 {%- for namespace in namespaces_as_array %} 45 namespace {{namespace}} { 46 {%- endfor %} 47 {%- if variant %} 48 namespace {{variant}} { 49 {%- endif %} 50 51 {#--- Constants #} 52 {%- for constant in module.constants %} 53 {%- if constant.kind|is_string_kind %} 54 const char {{constant.name}}[] = {{constant|constant_value}}; 55 {%- endif %} 56 {%- endfor %} 57 58 {#--- Struct Constants #} 59 {%- for struct in structs %} 60 {%- for constant in struct.constants %} 61 {%- if constant.kind|is_string_kind %} 62 const char {{struct.name}}::{{constant.name}}[] = {{constant|constant_value}}; 63 {%- endif %} 64 {%- endfor %} 65 {%- endfor %} 66 67 {#--- Struct builder definitions #} 68 {%- for struct in structs %} 69 {%- if not struct|is_native_only_kind %} 70 {%- include "wrapper_class_definition.tmpl" %} 71 {%- endif %} 72 {%- endfor %} 73 74 {#--- Union builder definitions #} 75 {%- for union in unions %} 76 {%- include "wrapper_union_class_definition.tmpl" %} 77 {%- endfor %} 78 79 {#--- Interface definitions #} 80 {%- for interface in interfaces %} 81 {%- include "interface_definition.tmpl" %} 82 {%- endfor %} 83 84 {%- if variant %} 85 } // namespace {{variant}} 86 {%- endif %} 87 {%- for namespace in namespaces_as_array|reverse %} 88 } // namespace {{namespace}} 89 {%- endfor %} 90 91 namespace mojo { 92 93 {#--- Struct Serialization Helpers -#} 94 {% for struct in structs %} 95 {%- if not struct|is_native_only_kind %} 96 {% include "struct_traits_definition.tmpl" %} 97 {%- endif %} 98 {%- endfor %} 99 100 {#--- Union Serialization Helpers #} 101 {%- for union in unions %} 102 {%- include "union_traits_definition.tmpl" %} 103 {%- endfor %} 104 105 } // namespace mojo 106 107 #if defined(__clang__) 108 #pragma clang diagnostic pop 109 #elif defined(_MSC_VER) 110 #pragma warning(pop) 111 #endif 112