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