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

Side by Side Diff: mojo/public/tools/bindings/generators/python_templates/module.py.tmpl

Issue 694463002: Revert of Update mojo sdk to rev e083961bf11fd0c94d40be8853761da529b6d444 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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 {% from "module_macros.tmpl" import enum_values %} 1 {% from "module_macros.tmpl" import enum_values %}
2 {% from "module_macros.tmpl" import struct_descriptor %}
3 # Copyright 2014 The Chromium Authors. All rights reserved. 2 # Copyright 2014 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 4 # found in the LICENSE file.
6 5
7 import mojo.bindings.descriptor as _descriptor 6 import mojo.bindings.descriptor as _descriptor
8 import mojo.bindings.reflection as _reflection 7 import mojo.bindings.reflection as _reflection
9 {% if imports %} 8 {% if imports %}
10 9
11 {% for import in imports %} 10 {% for import in imports %}
12 import {{import.python_module}} 11 import {{import.python_module}}
13 {% endfor %} 12 {% endfor %}
14 {% endif %} 13 {% endif %}
15 {#--- Constants #} 14 {#--- Constants #}
16 {% if module.constants %} 15 {% if module.constants %}
17 16
18 {% for constant in module.constants %} 17 {% for constant in module.constants %}
19 {{constant|name}} = {{constant.value|expression_to_text}} 18 {{constant|name}} = {{constant.value|expression_to_text}}
20 {% endfor %} 19 {% endfor %}
21 {% endif %} 20 {% endif %}
22 {% for enum in enums %} 21 {% for enum in module.enums %}
23 22
24 class {{enum|name}}(object): 23 class {{enum|name}}(object):
25 __metaclass__ = _reflection.MojoEnumType 24 __metaclass__ = _reflection.MojoEnumType
26 VALUES = {{enum_values(enum)|indent(2)}} 25 VALUES = {{enum_values(enum)|indent(2)}}
27 {% endfor %} 26 {% endfor %}
28 {% for struct in structs %} 27 {% for struct in module.structs %}
29 28
30 class {{struct|name}}(object): 29 class {{struct|name}}(object):
31 __metaclass__ = _reflection.MojoStructType 30 __metaclass__ = _reflection.MojoStructType
32 DESCRIPTOR = {{struct_descriptor(struct)|indent(2)}}
33 {% endfor %}
34 {% for interface in interfaces %}
35
36 class {{interface|name}}(object):
37 __metaclass__ = _reflection.MojoInterfaceType
38 DESCRIPTOR = { 31 DESCRIPTOR = {
39 {% if interface.client %} 32 {% if struct.constants %}
40 'client': {{interface.qualified_client|fully_qualified_name}}, 33 'constants': {
41 {% endif %} 34 {% for constant in struct.constants %}
42 'methods': [ 35 '{{constant|name}}': {{constant.value|expression_to_text}},
43 {% for method in interface.methods %} 36 {% endfor %}
44 { 37 },
45 'name': '{{method|name}}', 38 {% endif %}
46 'ordinal': {{method.ordinal}}, 39 {% if struct.enums %}
47 {% set request_struct = method|struct_from_method %} 40 'enums': {
48 'parameters': {{struct_descriptor(request_struct)|indent(8)}}, 41 {% for enum in struct.enums %}
49 {% if method.response_parameters != None %} 42 '{{enum|name}}': {{enum_values(enum)|indent(6)}},
50 {% set response_struct = method|response_struct_from_method %} 43 {% endfor %}
51 'responses': {{struct_descriptor(response_struct)|indent(8)}}, 44 },
52 {% endif %} 45 {% endif %}
53 }, 46 {% if struct.fields %}
54 {% endfor %} 47 'fields': [
48 {% for byte in struct.bytes %}
49 {% if byte.packed_fields %}
50 {{byte|field_group}},
51 {% endif %}
52 {% endfor %}
55 ], 53 ],
54 {% endif %}
56 } 55 }
57 {% endfor %} 56 {% endfor %}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698