OLD | NEW |
---|---|
1 {%- for method in interface.methods %} | 1 {%- for method in interface.methods %} |
2 const int _{{interface|name}}_{{method|name}}Name = {{method.ordinal}}; | 2 const int _{{interface|name}}_{{method|name}}Name = {{method.ordinal}}; |
3 {%- endfor %} | 3 {%- endfor %} |
4 | 4 |
5 {#--- Interface Enums #} | 5 {#--- Interface Enums #} |
6 {%- from "enum_definition.tmpl" import enum_def -%} | 6 {%- from "enum_definition.tmpl" import enum_def -%} |
7 {%- for enum in interface.enums %} | 7 {%- for enum in interface.enums %} |
8 {{ enum_def(enum) }} | 8 {{ enum_def(enum, typepkg, package) }} |
9 {%- endfor %} | 9 {%- endfor %} |
10 | 10 |
11 {{ mojom_type_macros.writeMojomTypeDef(interface, typepkg, package) }} | |
12 | |
13 class _{{interface|name}}ServiceDescription implements {{descpkg}}ServiceDescrip tion { | |
14 {% if should_gen_mojom_types -%} | |
15 dynamic getTopLevelInterface([Function responseFactory = null]) => | |
zra
2016/01/27 18:15:12
Here and below, `= null` isn't necessary. If no de
alexfandrianto
2016/01/28 03:45:13
Done.
| |
16 _{{interface|mojom_type_identifier|lower_camel}}(); | |
zra
2016/01/27 18:15:12
4 space indent on a continued line.
alexfandrianto
2016/01/28 03:45:12
Done.
| |
17 | |
18 dynamic getTypeDefinition(String typeKey, [Function responseFactory = null]) = > | |
zra
2016/01/27 18:15:12
Long line.
alexfandrianto
2016/01/28 03:45:13
Done.
| |
19 getAllMojomTypeDefinitions()[typeKey]; | |
20 | |
21 dynamic getAllTypeDefinitions([Function responseFactory = null]) => | |
22 getAllMojomTypeDefinitions(); | |
23 {%- else -%} | |
24 dynamic getTopLevelInterface([Function responseFactory = null]) => null; | |
25 | |
26 dynamic getTypeDefinition(String typeKey, [Function responseFactory = null]) = > | |
zra
2016/01/27 18:15:12
Long line.
alexfandrianto
2016/01/28 03:45:13
Done.
| |
27 null; | |
28 | |
29 dynamic getAllTypeDefinitions([Function responseFactory = null]) => null; | |
30 {%- endif %} | |
31 } | |
32 | |
11 abstract class {{interface|name}} { | 33 abstract class {{interface|name}} { |
12 {%- if interface.service_name %} | 34 {%- if interface.service_name %} |
13 static const String serviceName = "{{interface.service_name}}"; | 35 static const String serviceName = "{{interface.service_name}}"; |
14 {%- else %} | 36 {%- else %} |
15 static const String serviceName = null; | 37 static const String serviceName = null; |
16 {%- endif %} | 38 {%- endif %} |
17 | 39 |
18 {%- for method in interface.methods %} | 40 {%- for method in interface.methods %} |
19 {%- if method.response_parameters == None %} | 41 {%- if method.response_parameters == None %} |
20 void {{method|name}}( | 42 void {{method|name}}( |
(...skipping 25 matching lines...) Expand all Loading... | |
46 super.fromHandle(handle); | 68 super.fromHandle(handle); |
47 | 69 |
48 _{{interface|name}}ProxyImpl.unbound() : super.unbound(); | 70 _{{interface|name}}ProxyImpl.unbound() : super.unbound(); |
49 | 71 |
50 static _{{interface|name}}ProxyImpl newFromEndpoint( | 72 static _{{interface|name}}ProxyImpl newFromEndpoint( |
51 core.MojoMessagePipeEndpoint endpoint) { | 73 core.MojoMessagePipeEndpoint endpoint) { |
52 assert(endpoint.setDescription("For _{{interface|name}}ProxyImpl")); | 74 assert(endpoint.setDescription("For _{{interface|name}}ProxyImpl")); |
53 return new _{{interface|name}}ProxyImpl.fromEndpoint(endpoint); | 75 return new _{{interface|name}}ProxyImpl.fromEndpoint(endpoint); |
54 } | 76 } |
55 | 77 |
78 {{descpkg}}ServiceDescription get serviceDescription => | |
79 new _{{interface|name}}ServiceDescription(); | |
80 | |
56 void handleResponse(bindings.ServiceMessage message) { | 81 void handleResponse(bindings.ServiceMessage message) { |
57 switch (message.header.type) { | 82 switch (message.header.type) { |
58 {%- for method in interface.methods %} | 83 {%- for method in interface.methods %} |
59 {%- if method.response_parameters != None %} | 84 {%- if method.response_parameters != None %} |
60 {%- set response_struct = method.response_param_struct %} | 85 {%- set response_struct = method.response_param_struct %} |
61 case _{{interface|name}}_{{method|name}}Name: | 86 case _{{interface|name}}_{{method|name}}Name: |
62 var r = {{response_struct|name}}.deserialize( | 87 var r = {{response_struct|name}}.deserialize( |
63 message.payload); | 88 message.payload); |
64 if (!message.header.hasRequestId) { | 89 if (!message.header.hasRequestId) { |
65 proxyError("Expected a message with a valid request Id."); | 90 proxyError("Expected a message with a valid request Id."); |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
291 assert(_impl == null); | 316 assert(_impl == null); |
292 _impl = d; | 317 _impl = d; |
293 } | 318 } |
294 | 319 |
295 String toString() { | 320 String toString() { |
296 var superString = super.toString(); | 321 var superString = super.toString(); |
297 return "{{interface|name}}Stub($superString)"; | 322 return "{{interface|name}}Stub($superString)"; |
298 } | 323 } |
299 | 324 |
300 int get version => {{interface.version}}; | 325 int get version => {{interface.version}}; |
326 | |
327 {{descpkg}}ServiceDescription get serviceDescription => | |
328 new _{{interface|name}}ServiceDescription(); | |
301 } | 329 } |
OLD | NEW |