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

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

Issue 2247083003: Mojo C++ bindings: extract code shared by different variants. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 4 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 // TODO(yzshen): Move code here. 5 #if defined(_MSC_VER)
6 #pragma warning(push)
7 #pragma warning(disable:4065)
8 #endif
9
10 #include "{{module.path}}-shared.h"
11
12 #include <utility>
13
14 #include "base/logging.h"
15 #include "mojo/public/cpp/bindings/lib/validate_params.h"
16 #include "mojo/public/cpp/bindings/lib/validation_context.h"
17 #include "mojo/public/cpp/bindings/lib/validation_errors.h"
18 #include "mojo/public/cpp/bindings/lib/validation_util.h"
19
20 {%- for header in extra_traits_headers %}
21 #include "{{header}}"
22 {%- endfor %}
23
24 {%- for namespace in namespaces_as_array %}
25 namespace {{namespace}} {
26 {%- endfor %}
27
28 namespace internal {
29
30 {#--- Union definitions #}
31 {%- for union in unions %}
32 {% include "union_definition.tmpl" %}
33 {%- endfor %}
34
35 {#--- Struct definitions #}
36 {%- for struct in structs %}
37 {%- if not struct|is_native_only_kind %}
38 {% include "struct_definition.tmpl" %}
39 {%- endif %}
40 {%- endfor %}
41
42 {#--- Interface parameter definitions #}
43 {%- for interface in interfaces %}
44 {%- for method in interface.methods %}
45 {%- set method_name = "k%s_%s_Name"|format(interface.name, method.name) %}
46 {%- set struct = method.param_struct %}
47 {% include "struct_definition.tmpl" %}
48 {%- if method.response_parameters != None %}
49 {%- set struct = method.response_param_struct %}
50 {% include "struct_definition.tmpl" %}
51 {%- endif %}
52 {%- endfor %}
53 {%- endfor %}
54
55 } // namespace internal
56
57 {%- for namespace in namespaces_as_array|reverse %}
58 } // namespace {{namespace}}
59 {%- endfor %}
60
61 #if defined(_MSC_VER)
62 #pragma warning(pop)
63 #endif
64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698