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 {% if should_gen_mojom_types -%} |
| 12 {{ mojom_type_macros.writeMojomTypeDef(interface, typepkg, package) }} |
| 13 {%- endif %} |
| 14 |
| 15 class _{{interface|name}}ServiceDescription implements {{descpkg}}ServiceDescrip
tion { |
| 16 {%- if should_gen_mojom_types %} |
| 17 dynamic getTopLevelInterface([Function responseFactory]) => |
| 18 _{{interface|mojom_type_identifier|lower_camel}}(); |
| 19 |
| 20 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => |
| 21 getAllMojomTypeDefinitions()[typeKey]; |
| 22 |
| 23 dynamic getAllTypeDefinitions([Function responseFactory]) => |
| 24 getAllMojomTypeDefinitions(); |
| 25 {%- else %} |
| 26 dynamic getTopLevelInterface([Function responseFactory]) => null; |
| 27 |
| 28 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => null; |
| 29 |
| 30 dynamic getAllTypeDefinitions([Function responseFactory]) => null; |
| 31 {%- endif %} |
| 32 } |
| 33 |
11 abstract class {{interface|name}} { | 34 abstract class {{interface|name}} { |
12 {%- if interface.service_name %} | 35 {%- if interface.service_name %} |
13 static const String serviceName = "{{interface.service_name}}"; | 36 static const String serviceName = "{{interface.service_name}}"; |
14 {%- else %} | 37 {%- else %} |
15 static const String serviceName = null; | 38 static const String serviceName = null; |
16 {%- endif %} | 39 {%- endif %} |
17 | 40 |
18 {%- for method in interface.methods %} | 41 {%- for method in interface.methods %} |
19 {%- if method.response_parameters == None %} | 42 {%- if method.response_parameters == None %} |
20 void {{method|name}}( | 43 void {{method|name}}( |
(...skipping 25 matching lines...) Expand all Loading... |
46 super.fromHandle(handle); | 69 super.fromHandle(handle); |
47 | 70 |
48 _{{interface|name}}ProxyImpl.unbound() : super.unbound(); | 71 _{{interface|name}}ProxyImpl.unbound() : super.unbound(); |
49 | 72 |
50 static _{{interface|name}}ProxyImpl newFromEndpoint( | 73 static _{{interface|name}}ProxyImpl newFromEndpoint( |
51 core.MojoMessagePipeEndpoint endpoint) { | 74 core.MojoMessagePipeEndpoint endpoint) { |
52 assert(endpoint.setDescription("For _{{interface|name}}ProxyImpl")); | 75 assert(endpoint.setDescription("For _{{interface|name}}ProxyImpl")); |
53 return new _{{interface|name}}ProxyImpl.fromEndpoint(endpoint); | 76 return new _{{interface|name}}ProxyImpl.fromEndpoint(endpoint); |
54 } | 77 } |
55 | 78 |
| 79 {{descpkg}}ServiceDescription get serviceDescription => |
| 80 new _{{interface|name}}ServiceDescription(); |
| 81 |
56 void handleResponse(bindings.ServiceMessage message) { | 82 void handleResponse(bindings.ServiceMessage message) { |
57 switch (message.header.type) { | 83 switch (message.header.type) { |
58 {%- for method in interface.methods %} | 84 {%- for method in interface.methods %} |
59 {%- if method.response_parameters != None %} | 85 {%- if method.response_parameters != None %} |
60 {%- set response_struct = method.response_param_struct %} | 86 {%- set response_struct = method.response_param_struct %} |
61 case _{{interface|name}}_{{method|name}}Name: | 87 case _{{interface|name}}_{{method|name}}Name: |
62 var r = {{response_struct|name}}.deserialize( | 88 var r = {{response_struct|name}}.deserialize( |
63 message.payload); | 89 message.payload); |
64 if (!message.header.hasRequestId) { | 90 if (!message.header.hasRequestId) { |
65 proxyError("Expected a message with a valid request Id."); | 91 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); | 317 assert(_impl == null); |
292 _impl = d; | 318 _impl = d; |
293 } | 319 } |
294 | 320 |
295 String toString() { | 321 String toString() { |
296 var superString = super.toString(); | 322 var superString = super.toString(); |
297 return "{{interface|name}}Stub($superString)"; | 323 return "{{interface|name}}Stub($superString)"; |
298 } | 324 } |
299 | 325 |
300 int get version => {{interface.version}}; | 326 int get version => {{interface.version}}; |
| 327 |
| 328 {{descpkg}}ServiceDescription get serviceDescription => |
| 329 new _{{interface|name}}ServiceDescription(); |
301 } | 330 } |
OLD | NEW |