| OLD | NEW |
| 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 |
| 11 #if defined(__clang__) | 11 #if defined(__clang__) |
| 12 #pragma clang diagnostic push | 12 #pragma clang diagnostic push |
| 13 #pragma clang diagnostic ignored "-Wunused-private-field" | 13 #pragma clang diagnostic ignored "-Wunused-private-field" |
| 14 #elif defined(_MSC_VER) | 14 #elif defined(_MSC_VER) |
| 15 #pragma warning(push) | 15 #pragma warning(push) |
| 16 #pragma warning(disable:4056) | 16 #pragma warning(disable:4056) |
| 17 #pragma warning(disable:4065) | 17 #pragma warning(disable:4065) |
| 18 #pragma warning(disable:4756) | 18 #pragma warning(disable:4756) |
| 19 #endif | 19 #endif |
| 20 | 20 |
| 21 #include "{{variant_path}}.h" | 21 #include "{{variant_path}}.h" |
| 22 | 22 |
| 23 #include <math.h> | 23 #include <math.h> |
| 24 #include <stdint.h> | 24 #include <stdint.h> |
| 25 #include <utility> | 25 #include <utility> |
| 26 | 26 |
| 27 #include "base/logging.h" | 27 #include "base/logging.h" |
| 28 #include "base/trace_event/trace_event.h" | 28 #include "base/trace_event/trace_event.h" |
| 29 #include "mojo/public/cpp/bindings/lib/map_data_internal.h" | |
| 30 #include "mojo/public/cpp/bindings/lib/message_builder.h" | 29 #include "mojo/public/cpp/bindings/lib/message_builder.h" |
| 31 #include "mojo/public/cpp/bindings/lib/serialization_util.h" | 30 #include "mojo/public/cpp/bindings/lib/serialization_util.h" |
| 32 #include "mojo/public/cpp/bindings/lib/validate_params.h" | 31 #include "mojo/public/cpp/bindings/lib/validate_params.h" |
| 33 #include "mojo/public/cpp/bindings/lib/validation_context.h" | 32 #include "mojo/public/cpp/bindings/lib/validation_context.h" |
| 34 #include "mojo/public/cpp/bindings/lib/validation_errors.h" | 33 #include "mojo/public/cpp/bindings/lib/validation_errors.h" |
| 35 #include "mojo/public/cpp/bindings/lib/validation_util.h" | |
| 36 #include "mojo/public/interfaces/bindings/interface_control_messages.mojom.h" | 34 #include "mojo/public/interfaces/bindings/interface_control_messages.mojom.h" |
| 37 | 35 |
| 38 {%- if for_blink %} | 36 {%- if for_blink %} |
| 39 #include "mojo/public/cpp/bindings/lib/wtf_serialization.h" | 37 #include "mojo/public/cpp/bindings/lib/wtf_serialization.h" |
| 40 {%- endif %} | 38 {%- endif %} |
| 41 | 39 |
| 42 {%- for header in extra_traits_headers %} | 40 {%- for header in extra_traits_headers %} |
| 43 #include "{{header}}" | 41 #include "{{header}}" |
| 44 {%- endfor %} | 42 {%- endfor %} |
| 45 | 43 |
| 46 {%- for namespace in namespaces_as_array %} | 44 {%- for namespace in namespaces_as_array %} |
| 47 namespace {{namespace}} { | 45 namespace {{namespace}} { |
| 48 {%- endfor %} | 46 {%- endfor %} |
| 49 {%- if variant %} | 47 {%- if variant %} |
| 50 namespace {{variant}} { | 48 namespace {{variant}} { |
| 51 {%- endif %} | 49 {%- endif %} |
| 52 | 50 |
| 53 {#--- Constants #} | 51 {#--- Constants #} |
| 54 {%- for constant in module.constants %} | 52 {%- for constant in module.constants %} |
| 55 {%- if not constant.kind|is_integral_kind %} | 53 {%- if not constant.kind|is_integral_kind %} |
| 56 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}}; |
| 57 {%- endif %} | 55 {%- endif %} |
| 58 {%- endfor %} | 56 {%- endfor %} |
| 59 | 57 |
| 60 namespace internal { | |
| 61 namespace { | |
| 62 | |
| 63 #pragma pack(push, 1) | |
| 64 | |
| 65 {#--- Interface parameter definitions #} | |
| 66 {%- for interface in interfaces %} | |
| 67 {%- for method in interface.methods %} | |
| 68 {%- set method_name = "k%s_%s_Name"|format(interface.name, method.name) %} | |
| 69 const uint32_t {{method_name}} = {{method.ordinal}}; | |
| 70 {% set struct = method.param_struct %} | |
| 71 {% include "struct_declaration.tmpl" %} | |
| 72 {%- include "struct_definition.tmpl" %} | |
| 73 {%- if method.response_parameters != None %} | |
| 74 {%- set struct = method.response_param_struct %} | |
| 75 {% include "struct_declaration.tmpl" %} | |
| 76 {%- include "struct_definition.tmpl" %} | |
| 77 {%- endif %} | |
| 78 {%- endfor %} | |
| 79 {%- endfor %} | |
| 80 | |
| 81 #pragma pack(pop) | |
| 82 | |
| 83 } // namespace | |
| 84 | |
| 85 {#--- Struct definitions #} | |
| 86 {% for struct in structs %} | |
| 87 {%- if not struct|is_native_only_kind %} | |
| 88 {%- include "struct_definition.tmpl" %} | |
| 89 {%- endif %} | |
| 90 {%- endfor %} | |
| 91 | |
| 92 {#--- Union definitions #} | |
| 93 {% for union in unions %} | |
| 94 {%- include "union_definition.tmpl" %} | |
| 95 {%- endfor %} | |
| 96 | |
| 97 } // namespace internal | |
| 98 | |
| 99 namespace { | 58 namespace { |
| 100 | 59 |
| 101 {#--- Interface parameter data view definitions #} | 60 {#--- Interface parameter data view definitions #} |
| 102 {%- for interface in interfaces %} | 61 {%- for interface in interfaces %} |
| 103 {%- for method in interface.methods %} | 62 {%- for method in interface.methods %} |
| 104 {% set struct = method.param_struct %} | 63 {% set struct = method.param_struct %} |
| 105 {% include "struct_data_view_declaration.tmpl" %} | 64 {% include "struct_data_view_declaration.tmpl" %} |
| 106 {% include "struct_data_view_definition.tmpl" %} | 65 {% include "struct_data_view_definition.tmpl" %} |
| 107 {%- if method.response_parameters != None %} | 66 {%- if method.response_parameters != None %} |
| 108 {%- set struct = method.response_param_struct %} | 67 {%- set struct = method.response_param_struct %} |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 {%- endfor %} | 123 {%- endfor %} |
| 165 | 124 |
| 166 } // namespace mojo | 125 } // namespace mojo |
| 167 | 126 |
| 168 | 127 |
| 169 #if defined(__clang__) | 128 #if defined(__clang__) |
| 170 #pragma clang diagnostic pop | 129 #pragma clang diagnostic pop |
| 171 #elif defined(_MSC_VER) | 130 #elif defined(_MSC_VER) |
| 172 #pragma warning(pop) | 131 #pragma warning(pop) |
| 173 #endif | 132 #endif |
| OLD | NEW |