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, typepkg, package) }} | 8 {{ enum_def(enum, typepkg, package) }} |
9 {%- endfor %} | 9 {%- endfor %} |
10 | 10 |
11 {% if should_gen_mojom_types -%} | 11 {% if should_gen_mojom_types -%} |
12 {{ mojom_type_macros.writeMojomTypeDef(interface, typepkg, package) }} | 12 {{ mojom_type_macros.writeMojomTypeDef(interface, typepkg, package) }} |
13 {%- endif %} | 13 {%- endif %} |
14 | 14 |
15 class _{{interface|name}}ServiceDescription implements {{descpkg}}ServiceDescrip
tion { | 15 class _{{interface|name}}ServiceDescription implements {{descpkg}}ServiceDescrip
tion { |
16 {%- if should_gen_mojom_types %} | 16 {%- if should_gen_mojom_types %} |
17 dynamic getTopLevelInterface([Function responseFactory]) => | 17 dynamic getTopLevelInterface([Function responseFactory]) => |
18 _{{interface|mojom_type_identifier|lower_camel}}(); | 18 responseFactory(_{{interface|mojom_type_identifier|lower_camel}}()); |
19 | 19 |
20 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => | 20 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => |
21 getAllMojomTypeDefinitions()[typeKey]; | 21 responseFactory(getAllMojomTypeDefinitions()[typeKey]); |
22 | 22 |
23 dynamic getAllTypeDefinitions([Function responseFactory]) => | 23 dynamic getAllTypeDefinitions([Function responseFactory]) => |
24 getAllMojomTypeDefinitions(); | 24 responseFactory(getAllMojomTypeDefinitions()); |
25 {%- else %} | 25 {%- else %} |
26 dynamic getTopLevelInterface([Function responseFactory]) => null; | 26 dynamic getTopLevelInterface([Function responseFactory]) => |
| 27 responseFactory(null); |
27 | 28 |
28 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => null; | 29 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => |
| 30 responseFactory(null); |
29 | 31 |
30 dynamic getAllTypeDefinitions([Function responseFactory]) => null; | 32 dynamic getAllTypeDefinitions([Function responseFactory]) => |
| 33 responseFactory(null); |
31 {%- endif %} | 34 {%- endif %} |
32 } | 35 } |
33 | 36 |
34 abstract class {{interface|name}} { | 37 abstract class {{interface|name}} { |
35 {%- if interface.service_name %} | 38 {%- if interface.service_name %} |
36 static const String serviceName = "{{interface.service_name}}"; | 39 static const String serviceName = "{{interface.service_name}}"; |
37 {%- else %} | 40 {%- else %} |
38 static const String serviceName = null; | 41 static const String serviceName = null; |
39 {%- endif %} | 42 {%- endif %} |
40 | 43 |
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 _impl = d; | 321 _impl = d; |
319 } | 322 } |
320 | 323 |
321 String toString() { | 324 String toString() { |
322 var superString = super.toString(); | 325 var superString = super.toString(); |
323 return "{{interface|name}}Stub($superString)"; | 326 return "{{interface|name}}Stub($superString)"; |
324 } | 327 } |
325 | 328 |
326 int get version => {{interface.version}}; | 329 int get version => {{interface.version}}; |
327 | 330 |
328 {{descpkg}}ServiceDescription get serviceDescription => | 331 static {{descpkg}}ServiceDescription _cachedServiceDescription; |
329 new _{{interface|name}}ServiceDescription(); | 332 static {{descpkg}}ServiceDescription get serviceDescription { |
| 333 if (_cachedServiceDescription == null) { |
| 334 _cachedServiceDescription = new _{{interface|name}}ServiceDescription(); |
| 335 } |
| 336 return _cachedServiceDescription; |
| 337 } |
330 } | 338 } |
OLD | NEW |