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

Side by Side Diff: mojo/dart/packages/mojo/lib/mojo/bindings/types/service_describer.mojom.dart

Issue 2006093002: Dart: Futures -> Callbacks. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Merge Created 4 years, 6 months 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 // WARNING: DO NOT EDIT. This file was generated by a program. 1 // WARNING: DO NOT EDIT. This file was generated by a program.
2 // See $MOJO_SDK/tools/bindings/mojom_bindings_generator.py. 2 // See $MOJO_SDK/tools/bindings/mojom_bindings_generator.py.
3 3
4 library service_describer_mojom; 4 library service_describer_mojom;
5 import 'dart:async'; 5 import 'dart:async';
6 import 'package:mojo/bindings.dart' as bindings; 6 import 'package:mojo/bindings.dart' as bindings;
7 import 'package:mojo/core.dart' as core; 7 import 'package:mojo/core.dart' as core;
8 8
9 import 'package:mojo/mojo/bindings/types/mojom_types.mojom.dart' as mojom_types_ mojom; 9 import 'package:mojo/mojo/bindings/types/mojom_types.mojom.dart' as mojom_types_ mojom;
10 10
11 11
12 12
13 class _ServiceDescriberDescribeServiceParams extends bindings.Struct { 13 class _ServiceDescriberDescribeServiceParams extends bindings.Struct {
14 static const List<bindings.StructDataHeader> kVersions = const [ 14 static const List<bindings.StructDataHeader> kVersions = const [
15 const bindings.StructDataHeader(24, 0) 15 const bindings.StructDataHeader(24, 0)
16 ]; 16 ];
17 String interfaceName = null; 17 String interfaceName = null;
18 ServiceDescriptionInterfaceRequest descriptionRequest = null; 18 ServiceDescriptionInterfaceRequest descriptionRequest = null;
19 19
20 _ServiceDescriberDescribeServiceParams() : super(kVersions.last.size); 20 _ServiceDescriberDescribeServiceParams() : super(kVersions.last.size);
21 21
22 _ServiceDescriberDescribeServiceParams.init(
23 String this.interfaceName,
24 ServiceDescriptionInterfaceRequest this.descriptionRequest
25 ) : super(kVersions.last.size);
26
22 static _ServiceDescriberDescribeServiceParams deserialize(bindings.Message mes sage) { 27 static _ServiceDescriberDescribeServiceParams deserialize(bindings.Message mes sage) {
23 var decoder = new bindings.Decoder(message); 28 var decoder = new bindings.Decoder(message);
24 var result = decode(decoder); 29 var result = decode(decoder);
25 if (decoder.excessHandles != null) { 30 if (decoder.excessHandles != null) {
26 decoder.excessHandles.forEach((h) => h.close()); 31 decoder.excessHandles.forEach((h) => h.close());
27 } 32 }
28 return result; 33 return result;
29 } 34 }
30 35
31 static _ServiceDescriberDescribeServiceParams decode(bindings.Decoder decoder0 ) { 36 static _ServiceDescriberDescribeServiceParams decode(bindings.Decoder decoder0 ) {
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 } 99 }
95 100
96 101
97 class _ServiceDescriptionGetTopLevelInterfaceParams extends bindings.Struct { 102 class _ServiceDescriptionGetTopLevelInterfaceParams extends bindings.Struct {
98 static const List<bindings.StructDataHeader> kVersions = const [ 103 static const List<bindings.StructDataHeader> kVersions = const [
99 const bindings.StructDataHeader(8, 0) 104 const bindings.StructDataHeader(8, 0)
100 ]; 105 ];
101 106
102 _ServiceDescriptionGetTopLevelInterfaceParams() : super(kVersions.last.size); 107 _ServiceDescriptionGetTopLevelInterfaceParams() : super(kVersions.last.size);
103 108
109 _ServiceDescriptionGetTopLevelInterfaceParams.init(
110 ) : super(kVersions.last.size);
111
104 static _ServiceDescriptionGetTopLevelInterfaceParams deserialize(bindings.Mess age message) { 112 static _ServiceDescriptionGetTopLevelInterfaceParams deserialize(bindings.Mess age message) {
105 var decoder = new bindings.Decoder(message); 113 var decoder = new bindings.Decoder(message);
106 var result = decode(decoder); 114 var result = decode(decoder);
107 if (decoder.excessHandles != null) { 115 if (decoder.excessHandles != null) {
108 decoder.excessHandles.forEach((h) => h.close()); 116 decoder.excessHandles.forEach((h) => h.close());
109 } 117 }
110 return result; 118 return result;
111 } 119 }
112 120
113 static _ServiceDescriptionGetTopLevelInterfaceParams decode(bindings.Decoder d ecoder0) { 121 static _ServiceDescriptionGetTopLevelInterfaceParams decode(bindings.Decoder d ecoder0) {
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 161
154 162
155 class ServiceDescriptionGetTopLevelInterfaceResponseParams extends bindings.Stru ct { 163 class ServiceDescriptionGetTopLevelInterfaceResponseParams extends bindings.Stru ct {
156 static const List<bindings.StructDataHeader> kVersions = const [ 164 static const List<bindings.StructDataHeader> kVersions = const [
157 const bindings.StructDataHeader(16, 0) 165 const bindings.StructDataHeader(16, 0)
158 ]; 166 ];
159 mojom_types_mojom.MojomInterface mojomInterface = null; 167 mojom_types_mojom.MojomInterface mojomInterface = null;
160 168
161 ServiceDescriptionGetTopLevelInterfaceResponseParams() : super(kVersions.last. size); 169 ServiceDescriptionGetTopLevelInterfaceResponseParams() : super(kVersions.last. size);
162 170
171 ServiceDescriptionGetTopLevelInterfaceResponseParams.init(
172 mojom_types_mojom.MojomInterface this.mojomInterface
173 ) : super(kVersions.last.size);
174
163 static ServiceDescriptionGetTopLevelInterfaceResponseParams deserialize(bindin gs.Message message) { 175 static ServiceDescriptionGetTopLevelInterfaceResponseParams deserialize(bindin gs.Message message) {
164 var decoder = new bindings.Decoder(message); 176 var decoder = new bindings.Decoder(message);
165 var result = decode(decoder); 177 var result = decode(decoder);
166 if (decoder.excessHandles != null) { 178 if (decoder.excessHandles != null) {
167 decoder.excessHandles.forEach((h) => h.close()); 179 decoder.excessHandles.forEach((h) => h.close());
168 } 180 }
169 return result; 181 return result;
170 } 182 }
171 183
172 static ServiceDescriptionGetTopLevelInterfaceResponseParams decode(bindings.De coder decoder0) { 184 static ServiceDescriptionGetTopLevelInterfaceResponseParams decode(bindings.De coder decoder0) {
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 238
227 239
228 class _ServiceDescriptionGetTypeDefinitionParams extends bindings.Struct { 240 class _ServiceDescriptionGetTypeDefinitionParams extends bindings.Struct {
229 static const List<bindings.StructDataHeader> kVersions = const [ 241 static const List<bindings.StructDataHeader> kVersions = const [
230 const bindings.StructDataHeader(16, 0) 242 const bindings.StructDataHeader(16, 0)
231 ]; 243 ];
232 String typeKey = null; 244 String typeKey = null;
233 245
234 _ServiceDescriptionGetTypeDefinitionParams() : super(kVersions.last.size); 246 _ServiceDescriptionGetTypeDefinitionParams() : super(kVersions.last.size);
235 247
248 _ServiceDescriptionGetTypeDefinitionParams.init(
249 String this.typeKey
250 ) : super(kVersions.last.size);
251
236 static _ServiceDescriptionGetTypeDefinitionParams deserialize(bindings.Message message) { 252 static _ServiceDescriptionGetTypeDefinitionParams deserialize(bindings.Message message) {
237 var decoder = new bindings.Decoder(message); 253 var decoder = new bindings.Decoder(message);
238 var result = decode(decoder); 254 var result = decode(decoder);
239 if (decoder.excessHandles != null) { 255 if (decoder.excessHandles != null) {
240 decoder.excessHandles.forEach((h) => h.close()); 256 decoder.excessHandles.forEach((h) => h.close());
241 } 257 }
242 return result; 258 return result;
243 } 259 }
244 260
245 static _ServiceDescriptionGetTypeDefinitionParams decode(bindings.Decoder deco der0) { 261 static _ServiceDescriptionGetTypeDefinitionParams decode(bindings.Decoder deco der0) {
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 314
299 315
300 class ServiceDescriptionGetTypeDefinitionResponseParams extends bindings.Struct { 316 class ServiceDescriptionGetTypeDefinitionResponseParams extends bindings.Struct {
301 static const List<bindings.StructDataHeader> kVersions = const [ 317 static const List<bindings.StructDataHeader> kVersions = const [
302 const bindings.StructDataHeader(24, 0) 318 const bindings.StructDataHeader(24, 0)
303 ]; 319 ];
304 mojom_types_mojom.UserDefinedType type = null; 320 mojom_types_mojom.UserDefinedType type = null;
305 321
306 ServiceDescriptionGetTypeDefinitionResponseParams() : super(kVersions.last.siz e); 322 ServiceDescriptionGetTypeDefinitionResponseParams() : super(kVersions.last.siz e);
307 323
324 ServiceDescriptionGetTypeDefinitionResponseParams.init(
325 mojom_types_mojom.UserDefinedType this.type
326 ) : super(kVersions.last.size);
327
308 static ServiceDescriptionGetTypeDefinitionResponseParams deserialize(bindings. Message message) { 328 static ServiceDescriptionGetTypeDefinitionResponseParams deserialize(bindings. Message message) {
309 var decoder = new bindings.Decoder(message); 329 var decoder = new bindings.Decoder(message);
310 var result = decode(decoder); 330 var result = decode(decoder);
311 if (decoder.excessHandles != null) { 331 if (decoder.excessHandles != null) {
312 decoder.excessHandles.forEach((h) => h.close()); 332 decoder.excessHandles.forEach((h) => h.close());
313 } 333 }
314 return result; 334 return result;
315 } 335 }
316 336
317 static ServiceDescriptionGetTypeDefinitionResponseParams decode(bindings.Decod er decoder0) { 337 static ServiceDescriptionGetTypeDefinitionResponseParams decode(bindings.Decod er decoder0) {
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 } 389 }
370 390
371 391
372 class _ServiceDescriptionGetAllTypeDefinitionsParams extends bindings.Struct { 392 class _ServiceDescriptionGetAllTypeDefinitionsParams extends bindings.Struct {
373 static const List<bindings.StructDataHeader> kVersions = const [ 393 static const List<bindings.StructDataHeader> kVersions = const [
374 const bindings.StructDataHeader(8, 0) 394 const bindings.StructDataHeader(8, 0)
375 ]; 395 ];
376 396
377 _ServiceDescriptionGetAllTypeDefinitionsParams() : super(kVersions.last.size); 397 _ServiceDescriptionGetAllTypeDefinitionsParams() : super(kVersions.last.size);
378 398
399 _ServiceDescriptionGetAllTypeDefinitionsParams.init(
400 ) : super(kVersions.last.size);
401
379 static _ServiceDescriptionGetAllTypeDefinitionsParams deserialize(bindings.Mes sage message) { 402 static _ServiceDescriptionGetAllTypeDefinitionsParams deserialize(bindings.Mes sage message) {
380 var decoder = new bindings.Decoder(message); 403 var decoder = new bindings.Decoder(message);
381 var result = decode(decoder); 404 var result = decode(decoder);
382 if (decoder.excessHandles != null) { 405 if (decoder.excessHandles != null) {
383 decoder.excessHandles.forEach((h) => h.close()); 406 decoder.excessHandles.forEach((h) => h.close());
384 } 407 }
385 return result; 408 return result;
386 } 409 }
387 410
388 static _ServiceDescriptionGetAllTypeDefinitionsParams decode(bindings.Decoder decoder0) { 411 static _ServiceDescriptionGetAllTypeDefinitionsParams decode(bindings.Decoder decoder0) {
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
428 451
429 452
430 class ServiceDescriptionGetAllTypeDefinitionsResponseParams extends bindings.Str uct { 453 class ServiceDescriptionGetAllTypeDefinitionsResponseParams extends bindings.Str uct {
431 static const List<bindings.StructDataHeader> kVersions = const [ 454 static const List<bindings.StructDataHeader> kVersions = const [
432 const bindings.StructDataHeader(16, 0) 455 const bindings.StructDataHeader(16, 0)
433 ]; 456 ];
434 Map<String, mojom_types_mojom.UserDefinedType> definitions = null; 457 Map<String, mojom_types_mojom.UserDefinedType> definitions = null;
435 458
436 ServiceDescriptionGetAllTypeDefinitionsResponseParams() : super(kVersions.last .size); 459 ServiceDescriptionGetAllTypeDefinitionsResponseParams() : super(kVersions.last .size);
437 460
461 ServiceDescriptionGetAllTypeDefinitionsResponseParams.init(
462 Map<String, mojom_types_mojom.UserDefinedType> this.definitions
463 ) : super(kVersions.last.size);
464
438 static ServiceDescriptionGetAllTypeDefinitionsResponseParams deserialize(bindi ngs.Message message) { 465 static ServiceDescriptionGetAllTypeDefinitionsResponseParams deserialize(bindi ngs.Message message) {
439 var decoder = new bindings.Decoder(message); 466 var decoder = new bindings.Decoder(message);
440 var result = decode(decoder); 467 var result = decode(decoder);
441 if (decoder.excessHandles != null) { 468 if (decoder.excessHandles != null) {
442 decoder.excessHandles.forEach((h) => h.close()); 469 decoder.excessHandles.forEach((h) => h.close());
443 } 470 }
444 return result; 471 return result;
445 } 472 }
446 473
447 static ServiceDescriptionGetAllTypeDefinitionsResponseParams decode(bindings.D ecoder decoder0) { 474 static ServiceDescriptionGetAllTypeDefinitionsResponseParams decode(bindings.D ecoder decoder0) {
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
551 Map toJson() { 578 Map toJson() {
552 Map map = new Map(); 579 Map map = new Map();
553 map["definitions"] = definitions; 580 map["definitions"] = definitions;
554 return map; 581 return map;
555 } 582 }
556 } 583 }
557 584
558 const int _serviceDescriberMethodDescribeServiceName = 0; 585 const int _serviceDescriberMethodDescribeServiceName = 0;
559 586
560 class _ServiceDescriberServiceDescription implements ServiceDescription { 587 class _ServiceDescriberServiceDescription implements ServiceDescription {
561 dynamic getTopLevelInterface([Function responseFactory]) => 588 void getTopLevelInterface(Function responder) {
562 responseFactory(null); 589 responder(null);
590 }
563 591
564 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => 592 void getTypeDefinition(String typeKey, Function responder) {
565 responseFactory(null); 593 responder(null);
594 }
566 595
567 dynamic getAllTypeDefinitions([Function responseFactory]) => 596 void getAllTypeDefinitions(Function responder) {
568 responseFactory(null); 597 responder(null);
598 }
569 } 599 }
570 600
571 abstract class ServiceDescriber { 601 abstract class ServiceDescriber {
572 static const String serviceName = "mojo::bindings::types::ServiceDescriber"; 602 static const String serviceName = "mojo::bindings::types::ServiceDescriber";
573 603
574 static ServiceDescription _cachedServiceDescription; 604 static ServiceDescription _cachedServiceDescription;
575 static ServiceDescription get serviceDescription { 605 static ServiceDescription get serviceDescription {
576 if (_cachedServiceDescription == null) { 606 if (_cachedServiceDescription == null) {
577 _cachedServiceDescription = new _ServiceDescriberServiceDescription(); 607 _cachedServiceDescription = new _ServiceDescriberServiceDescription();
578 } 608 }
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
709 : super.fromHandle(handle, autoBegin: impl != null) { 739 : super.fromHandle(handle, autoBegin: impl != null) {
710 _impl = impl; 740 _impl = impl;
711 } 741 }
712 742
713 _ServiceDescriberStubControl.unbound([this._impl]) : super.unbound(); 743 _ServiceDescriberStubControl.unbound([this._impl]) : super.unbound();
714 744
715 String get serviceName => ServiceDescriber.serviceName; 745 String get serviceName => ServiceDescriber.serviceName;
716 746
717 747
718 748
719 dynamic handleMessage(bindings.ServiceMessage message) { 749 void handleMessage(bindings.ServiceMessage message) {
720 if (bindings.ControlMessageHandler.isControlMessage(message)) { 750 if (bindings.ControlMessageHandler.isControlMessage(message)) {
721 return bindings.ControlMessageHandler.handleMessage(this, 751 bindings.ControlMessageHandler.handleMessage(
722 0, 752 this, 0, message);
723 message); 753 return;
724 } 754 }
725 if (_impl == null) { 755 if (_impl == null) {
726 throw new core.MojoApiError("$this has no implementation set"); 756 throw new core.MojoApiError("$this has no implementation set");
727 } 757 }
728 switch (message.header.type) { 758 switch (message.header.type) {
729 case _serviceDescriberMethodDescribeServiceName: 759 case _serviceDescriberMethodDescribeServiceName:
730 var params = _ServiceDescriberDescribeServiceParams.deserialize( 760 var params = _ServiceDescriberDescribeServiceParams.deserialize(
731 message.payload); 761 message.payload);
732 _impl.describeService(params.interfaceName, params.descriptionRequest); 762 _impl.describeService(params.interfaceName, params.descriptionRequest);
733 break; 763 break;
734 default: 764 default:
735 throw new bindings.MojoCodecError("Unexpected message name"); 765 throw new bindings.MojoCodecError("Unexpected message name");
736 break; 766 break;
737 } 767 }
738 return null;
739 } 768 }
740 769
741 ServiceDescriber get impl => _impl; 770 ServiceDescriber get impl => _impl;
742 set impl(ServiceDescriber d) { 771 set impl(ServiceDescriber d) {
743 if (d == null) { 772 if (d == null) {
744 throw new core.MojoApiError("$this: Cannot set a null implementation"); 773 throw new core.MojoApiError("$this: Cannot set a null implementation");
745 } 774 }
746 if (isBound && (_impl == null)) { 775 if (isBound && (_impl == null)) {
747 beginHandlingEvents(); 776 beginHandlingEvents();
748 } 777 }
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
792 void describeService(String interfaceName, ServiceDescriptionInterfaceRequest descriptionRequest) { 821 void describeService(String interfaceName, ServiceDescriptionInterfaceRequest descriptionRequest) {
793 return impl.describeService(interfaceName, descriptionRequest); 822 return impl.describeService(interfaceName, descriptionRequest);
794 } 823 }
795 } 824 }
796 825
797 const int _serviceDescriptionMethodGetTopLevelInterfaceName = 0; 826 const int _serviceDescriptionMethodGetTopLevelInterfaceName = 0;
798 const int _serviceDescriptionMethodGetTypeDefinitionName = 1; 827 const int _serviceDescriptionMethodGetTypeDefinitionName = 1;
799 const int _serviceDescriptionMethodGetAllTypeDefinitionsName = 2; 828 const int _serviceDescriptionMethodGetAllTypeDefinitionsName = 2;
800 829
801 class _ServiceDescriptionServiceDescription implements ServiceDescription { 830 class _ServiceDescriptionServiceDescription implements ServiceDescription {
802 dynamic getTopLevelInterface([Function responseFactory]) => 831 void getTopLevelInterface(Function responder) {
803 responseFactory(null); 832 responder(null);
833 }
804 834
805 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => 835 void getTypeDefinition(String typeKey, Function responder) {
806 responseFactory(null); 836 responder(null);
837 }
807 838
808 dynamic getAllTypeDefinitions([Function responseFactory]) => 839 void getAllTypeDefinitions(Function responder) {
809 responseFactory(null); 840 responder(null);
841 }
810 } 842 }
811 843
812 abstract class ServiceDescription { 844 abstract class ServiceDescription {
813 static const String serviceName = null; 845 static const String serviceName = null;
814 846
815 static ServiceDescription _cachedServiceDescription; 847 static ServiceDescription _cachedServiceDescription;
816 static ServiceDescription get serviceDescription { 848 static ServiceDescription get serviceDescription {
817 if (_cachedServiceDescription == null) { 849 if (_cachedServiceDescription == null) {
818 _cachedServiceDescription = new _ServiceDescriptionServiceDescription(); 850 _cachedServiceDescription = new _ServiceDescriptionServiceDescription();
819 } 851 }
820 return _cachedServiceDescription; 852 return _cachedServiceDescription;
821 } 853 }
822 854
823 static ServiceDescriptionProxy connectToService( 855 static ServiceDescriptionProxy connectToService(
824 bindings.ServiceConnector s, String url, [String serviceName]) { 856 bindings.ServiceConnector s, String url, [String serviceName]) {
825 ServiceDescriptionProxy p = new ServiceDescriptionProxy.unbound(); 857 ServiceDescriptionProxy p = new ServiceDescriptionProxy.unbound();
826 String name = serviceName ?? ServiceDescription.serviceName; 858 String name = serviceName ?? ServiceDescription.serviceName;
827 if ((name == null) || name.isEmpty) { 859 if ((name == null) || name.isEmpty) {
828 throw new core.MojoApiError( 860 throw new core.MojoApiError(
829 "If an interface has no ServiceName, then one must be provided."); 861 "If an interface has no ServiceName, then one must be provided.");
830 } 862 }
831 s.connectToService(url, p, name); 863 s.connectToService(url, p, name);
832 return p; 864 return p;
833 } 865 }
834 dynamic getTopLevelInterface([Function responseFactory = null]); 866 void getTopLevelInterface(void callback(mojom_types_mojom.MojomInterface mojom Interface));
835 dynamic getTypeDefinition(String typeKey,[Function responseFactory = null]); 867 void getTypeDefinition(String typeKey,void callback(mojom_types_mojom.UserDefi nedType type));
836 dynamic getAllTypeDefinitions([Function responseFactory = null]); 868 void getAllTypeDefinitions(void callback(Map<String, mojom_types_mojom.UserDef inedType> definitions));
837 } 869 }
838 870
839 abstract class ServiceDescriptionInterface 871 abstract class ServiceDescriptionInterface
840 implements bindings.MojoInterface<ServiceDescription>, 872 implements bindings.MojoInterface<ServiceDescription>,
841 ServiceDescription { 873 ServiceDescription {
842 factory ServiceDescriptionInterface([ServiceDescription impl]) => 874 factory ServiceDescriptionInterface([ServiceDescription impl]) =>
843 new ServiceDescriptionStub.unbound(impl); 875 new ServiceDescriptionStub.unbound(impl);
844 876
845 factory ServiceDescriptionInterface.fromEndpoint( 877 factory ServiceDescriptionInterface.fromEndpoint(
846 core.MojoMessagePipeEndpoint endpoint, 878 core.MojoMessagePipeEndpoint endpoint,
(...skipping 29 matching lines...) Expand all
876 908
877 void handleResponse(bindings.ServiceMessage message) { 909 void handleResponse(bindings.ServiceMessage message) {
878 switch (message.header.type) { 910 switch (message.header.type) {
879 case _serviceDescriptionMethodGetTopLevelInterfaceName: 911 case _serviceDescriptionMethodGetTopLevelInterfaceName:
880 var r = ServiceDescriptionGetTopLevelInterfaceResponseParams.deserialize ( 912 var r = ServiceDescriptionGetTopLevelInterfaceResponseParams.deserialize (
881 message.payload); 913 message.payload);
882 if (!message.header.hasRequestId) { 914 if (!message.header.hasRequestId) {
883 proxyError("Expected a message with a valid request Id."); 915 proxyError("Expected a message with a valid request Id.");
884 return; 916 return;
885 } 917 }
886 Completer c = completerMap[message.header.requestId]; 918 Function callback = callbackMap[message.header.requestId];
887 if (c == null) { 919 if (callback == null) {
888 proxyError( 920 proxyError(
889 "Message had unknown request Id: ${message.header.requestId}"); 921 "Message had unknown request Id: ${message.header.requestId}");
890 return; 922 return;
891 } 923 }
892 completerMap.remove(message.header.requestId); 924 callbackMap.remove(message.header.requestId);
893 if (c.isCompleted) { 925 callback(r.mojomInterface );
894 proxyError("Response completer already completed");
895 return;
896 }
897 c.complete(r);
898 break; 926 break;
899 case _serviceDescriptionMethodGetTypeDefinitionName: 927 case _serviceDescriptionMethodGetTypeDefinitionName:
900 var r = ServiceDescriptionGetTypeDefinitionResponseParams.deserialize( 928 var r = ServiceDescriptionGetTypeDefinitionResponseParams.deserialize(
901 message.payload); 929 message.payload);
902 if (!message.header.hasRequestId) { 930 if (!message.header.hasRequestId) {
903 proxyError("Expected a message with a valid request Id."); 931 proxyError("Expected a message with a valid request Id.");
904 return; 932 return;
905 } 933 }
906 Completer c = completerMap[message.header.requestId]; 934 Function callback = callbackMap[message.header.requestId];
907 if (c == null) { 935 if (callback == null) {
908 proxyError( 936 proxyError(
909 "Message had unknown request Id: ${message.header.requestId}"); 937 "Message had unknown request Id: ${message.header.requestId}");
910 return; 938 return;
911 } 939 }
912 completerMap.remove(message.header.requestId); 940 callbackMap.remove(message.header.requestId);
913 if (c.isCompleted) { 941 callback(r.type );
914 proxyError("Response completer already completed");
915 return;
916 }
917 c.complete(r);
918 break; 942 break;
919 case _serviceDescriptionMethodGetAllTypeDefinitionsName: 943 case _serviceDescriptionMethodGetAllTypeDefinitionsName:
920 var r = ServiceDescriptionGetAllTypeDefinitionsResponseParams.deserializ e( 944 var r = ServiceDescriptionGetAllTypeDefinitionsResponseParams.deserializ e(
921 message.payload); 945 message.payload);
922 if (!message.header.hasRequestId) { 946 if (!message.header.hasRequestId) {
923 proxyError("Expected a message with a valid request Id."); 947 proxyError("Expected a message with a valid request Id.");
924 return; 948 return;
925 } 949 }
926 Completer c = completerMap[message.header.requestId]; 950 Function callback = callbackMap[message.header.requestId];
927 if (c == null) { 951 if (callback == null) {
928 proxyError( 952 proxyError(
929 "Message had unknown request Id: ${message.header.requestId}"); 953 "Message had unknown request Id: ${message.header.requestId}");
930 return; 954 return;
931 } 955 }
932 completerMap.remove(message.header.requestId); 956 callbackMap.remove(message.header.requestId);
933 if (c.isCompleted) { 957 callback(r.definitions );
934 proxyError("Response completer already completed");
935 return;
936 }
937 c.complete(r);
938 break; 958 break;
939 default: 959 default:
940 proxyError("Unexpected message type: ${message.header.type}"); 960 proxyError("Unexpected message type: ${message.header.type}");
941 close(immediate: true); 961 close(immediate: true);
942 break; 962 break;
943 } 963 }
944 } 964 }
945 965
946 @override 966 @override
947 String toString() { 967 String toString() {
(...skipping 24 matching lines...) Expand all
972 return newMockedProxy; 992 return newMockedProxy;
973 } 993 }
974 994
975 static ServiceDescriptionProxy newFromEndpoint( 995 static ServiceDescriptionProxy newFromEndpoint(
976 core.MojoMessagePipeEndpoint endpoint) { 996 core.MojoMessagePipeEndpoint endpoint) {
977 assert(endpoint.setDescription("For ServiceDescriptionProxy")); 997 assert(endpoint.setDescription("For ServiceDescriptionProxy"));
978 return new ServiceDescriptionProxy.fromEndpoint(endpoint); 998 return new ServiceDescriptionProxy.fromEndpoint(endpoint);
979 } 999 }
980 1000
981 1001
982 dynamic getTopLevelInterface([Function responseFactory = null]) { 1002 void getTopLevelInterface(void callback(mojom_types_mojom.MojomInterface mojom Interface)) {
983 if (impl != null) { 1003 if (impl != null) {
984 return new Future(() => impl.getTopLevelInterface(_ServiceDescriptionStubC ontrol._serviceDescriptionGetTopLevelInterfaceResponseParamsFactory)); 1004 impl.getTopLevelInterface(callback);
1005 return;
985 } 1006 }
986 var params = new _ServiceDescriptionGetTopLevelInterfaceParams(); 1007 var params = new _ServiceDescriptionGetTopLevelInterfaceParams();
987 return ctrl.sendMessageWithRequestId( 1008 ctrl.sendMessageWithRequestId(
988 params, 1009 params,
989 _serviceDescriptionMethodGetTopLevelInterfaceName, 1010 _serviceDescriptionMethodGetTopLevelInterfaceName,
990 -1, 1011 -1,
991 bindings.MessageHeader.kMessageExpectsResponse); 1012 bindings.MessageHeader.kMessageExpectsResponse,
1013 callback);
992 } 1014 }
993 dynamic getTypeDefinition(String typeKey,[Function responseFactory = null]) { 1015 void getTypeDefinition(String typeKey,void callback(mojom_types_mojom.UserDefi nedType type)) {
994 if (impl != null) { 1016 if (impl != null) {
995 return new Future(() => impl.getTypeDefinition(typeKey,_ServiceDescription StubControl._serviceDescriptionGetTypeDefinitionResponseParamsFactory)); 1017 impl.getTypeDefinition(typeKey,callback);
1018 return;
996 } 1019 }
997 var params = new _ServiceDescriptionGetTypeDefinitionParams(); 1020 var params = new _ServiceDescriptionGetTypeDefinitionParams();
998 params.typeKey = typeKey; 1021 params.typeKey = typeKey;
999 return ctrl.sendMessageWithRequestId( 1022 ctrl.sendMessageWithRequestId(
1000 params, 1023 params,
1001 _serviceDescriptionMethodGetTypeDefinitionName, 1024 _serviceDescriptionMethodGetTypeDefinitionName,
1002 -1, 1025 -1,
1003 bindings.MessageHeader.kMessageExpectsResponse); 1026 bindings.MessageHeader.kMessageExpectsResponse,
1027 callback);
1004 } 1028 }
1005 dynamic getAllTypeDefinitions([Function responseFactory = null]) { 1029 void getAllTypeDefinitions(void callback(Map<String, mojom_types_mojom.UserDef inedType> definitions)) {
1006 if (impl != null) { 1030 if (impl != null) {
1007 return new Future(() => impl.getAllTypeDefinitions(_ServiceDescriptionStub Control._serviceDescriptionGetAllTypeDefinitionsResponseParamsFactory)); 1031 impl.getAllTypeDefinitions(callback);
1032 return;
1008 } 1033 }
1009 var params = new _ServiceDescriptionGetAllTypeDefinitionsParams(); 1034 var params = new _ServiceDescriptionGetAllTypeDefinitionsParams();
1010 return ctrl.sendMessageWithRequestId( 1035 ctrl.sendMessageWithRequestId(
1011 params, 1036 params,
1012 _serviceDescriptionMethodGetAllTypeDefinitionsName, 1037 _serviceDescriptionMethodGetAllTypeDefinitionsName,
1013 -1, 1038 -1,
1014 bindings.MessageHeader.kMessageExpectsResponse); 1039 bindings.MessageHeader.kMessageExpectsResponse,
1040 callback);
1015 } 1041 }
1016 } 1042 }
1017 1043
1018 class _ServiceDescriptionStubControl 1044 class _ServiceDescriptionStubControl
1019 extends bindings.StubMessageHandler 1045 extends bindings.StubMessageHandler
1020 implements bindings.StubControl<ServiceDescription> { 1046 implements bindings.StubControl<ServiceDescription> {
1021 ServiceDescription _impl; 1047 ServiceDescription _impl;
1022 1048
1023 _ServiceDescriptionStubControl.fromEndpoint( 1049 _ServiceDescriptionStubControl.fromEndpoint(
1024 core.MojoMessagePipeEndpoint endpoint, [ServiceDescription impl]) 1050 core.MojoMessagePipeEndpoint endpoint, [ServiceDescription impl])
1025 : super.fromEndpoint(endpoint, autoBegin: impl != null) { 1051 : super.fromEndpoint(endpoint, autoBegin: impl != null) {
1026 _impl = impl; 1052 _impl = impl;
1027 } 1053 }
1028 1054
1029 _ServiceDescriptionStubControl.fromHandle( 1055 _ServiceDescriptionStubControl.fromHandle(
1030 core.MojoHandle handle, [ServiceDescription impl]) 1056 core.MojoHandle handle, [ServiceDescription impl])
1031 : super.fromHandle(handle, autoBegin: impl != null) { 1057 : super.fromHandle(handle, autoBegin: impl != null) {
1032 _impl = impl; 1058 _impl = impl;
1033 } 1059 }
1034 1060
1035 _ServiceDescriptionStubControl.unbound([this._impl]) : super.unbound(); 1061 _ServiceDescriptionStubControl.unbound([this._impl]) : super.unbound();
1036 1062
1037 String get serviceName => ServiceDescription.serviceName; 1063 String get serviceName => ServiceDescription.serviceName;
1038 1064
1039 1065
1040 static ServiceDescriptionGetTopLevelInterfaceResponseParams _serviceDescriptio nGetTopLevelInterfaceResponseParamsFactory(mojom_types_mojom.MojomInterface mojo mInterface) { 1066 Function _serviceDescriptionGetTopLevelInterfaceResponseParamsResponder(
1041 var result = new ServiceDescriptionGetTopLevelInterfaceResponseParams(); 1067 int requestId) {
1042 result.mojomInterface = mojomInterface; 1068 return (mojom_types_mojom.MojomInterface mojomInterface) {
1043 return result; 1069 var result = new ServiceDescriptionGetTopLevelInterfaceResponseParams();
1070 result.mojomInterface = mojomInterface;
1071 sendResponse(buildResponseWithId(
1072 result,
1073 _serviceDescriptionMethodGetTopLevelInterfaceName,
1074 requestId,
1075 bindings.MessageHeader.kMessageIsResponse));
1076 };
1044 } 1077 }
1045 static ServiceDescriptionGetTypeDefinitionResponseParams _serviceDescriptionGe tTypeDefinitionResponseParamsFactory(mojom_types_mojom.UserDefinedType type) { 1078 Function _serviceDescriptionGetTypeDefinitionResponseParamsResponder(
1046 var result = new ServiceDescriptionGetTypeDefinitionResponseParams(); 1079 int requestId) {
1047 result.type = type; 1080 return (mojom_types_mojom.UserDefinedType type) {
1048 return result; 1081 var result = new ServiceDescriptionGetTypeDefinitionResponseParams();
1082 result.type = type;
1083 sendResponse(buildResponseWithId(
1084 result,
1085 _serviceDescriptionMethodGetTypeDefinitionName,
1086 requestId,
1087 bindings.MessageHeader.kMessageIsResponse));
1088 };
1049 } 1089 }
1050 static ServiceDescriptionGetAllTypeDefinitionsResponseParams _serviceDescripti onGetAllTypeDefinitionsResponseParamsFactory(Map<String, mojom_types_mojom.UserD efinedType> definitions) { 1090 Function _serviceDescriptionGetAllTypeDefinitionsResponseParamsResponder(
1051 var result = new ServiceDescriptionGetAllTypeDefinitionsResponseParams(); 1091 int requestId) {
1052 result.definitions = definitions; 1092 return (Map<String, mojom_types_mojom.UserDefinedType> definitions) {
1053 return result; 1093 var result = new ServiceDescriptionGetAllTypeDefinitionsResponseParams();
1094 result.definitions = definitions;
1095 sendResponse(buildResponseWithId(
1096 result,
1097 _serviceDescriptionMethodGetAllTypeDefinitionsName,
1098 requestId,
1099 bindings.MessageHeader.kMessageIsResponse));
1100 };
1054 } 1101 }
1055 1102
1056 dynamic handleMessage(bindings.ServiceMessage message) { 1103 void handleMessage(bindings.ServiceMessage message) {
1057 if (bindings.ControlMessageHandler.isControlMessage(message)) { 1104 if (bindings.ControlMessageHandler.isControlMessage(message)) {
1058 return bindings.ControlMessageHandler.handleMessage(this, 1105 bindings.ControlMessageHandler.handleMessage(
1059 0, 1106 this, 0, message);
1060 message); 1107 return;
1061 } 1108 }
1062 if (_impl == null) { 1109 if (_impl == null) {
1063 throw new core.MojoApiError("$this has no implementation set"); 1110 throw new core.MojoApiError("$this has no implementation set");
1064 } 1111 }
1065 switch (message.header.type) { 1112 switch (message.header.type) {
1066 case _serviceDescriptionMethodGetTopLevelInterfaceName: 1113 case _serviceDescriptionMethodGetTopLevelInterfaceName:
1067 var response = _impl.getTopLevelInterface(_serviceDescriptionGetTopLevel InterfaceResponseParamsFactory); 1114 _impl.getTopLevelInterface(_serviceDescriptionGetTopLevelInterfaceRespon seParamsResponder(message.header.requestId));
1068 if (response is Future) {
1069 return response.then((response) {
1070 if (response != null) {
1071 return buildResponseWithId(
1072 response,
1073 _serviceDescriptionMethodGetTopLevelInterfaceName,
1074 message.header.requestId,
1075 bindings.MessageHeader.kMessageIsResponse);
1076 }
1077 });
1078 } else if (response != null) {
1079 return buildResponseWithId(
1080 response,
1081 _serviceDescriptionMethodGetTopLevelInterfaceName,
1082 message.header.requestId,
1083 bindings.MessageHeader.kMessageIsResponse);
1084 }
1085 break; 1115 break;
1086 case _serviceDescriptionMethodGetTypeDefinitionName: 1116 case _serviceDescriptionMethodGetTypeDefinitionName:
1087 var params = _ServiceDescriptionGetTypeDefinitionParams.deserialize( 1117 var params = _ServiceDescriptionGetTypeDefinitionParams.deserialize(
1088 message.payload); 1118 message.payload);
1089 var response = _impl.getTypeDefinition(params.typeKey,_serviceDescriptio nGetTypeDefinitionResponseParamsFactory); 1119 _impl.getTypeDefinition(params.typeKey, _serviceDescriptionGetTypeDefini tionResponseParamsResponder(message.header.requestId));
1090 if (response is Future) {
1091 return response.then((response) {
1092 if (response != null) {
1093 return buildResponseWithId(
1094 response,
1095 _serviceDescriptionMethodGetTypeDefinitionName,
1096 message.header.requestId,
1097 bindings.MessageHeader.kMessageIsResponse);
1098 }
1099 });
1100 } else if (response != null) {
1101 return buildResponseWithId(
1102 response,
1103 _serviceDescriptionMethodGetTypeDefinitionName,
1104 message.header.requestId,
1105 bindings.MessageHeader.kMessageIsResponse);
1106 }
1107 break; 1120 break;
1108 case _serviceDescriptionMethodGetAllTypeDefinitionsName: 1121 case _serviceDescriptionMethodGetAllTypeDefinitionsName:
1109 var response = _impl.getAllTypeDefinitions(_serviceDescriptionGetAllType DefinitionsResponseParamsFactory); 1122 _impl.getAllTypeDefinitions(_serviceDescriptionGetAllTypeDefinitionsResp onseParamsResponder(message.header.requestId));
1110 if (response is Future) {
1111 return response.then((response) {
1112 if (response != null) {
1113 return buildResponseWithId(
1114 response,
1115 _serviceDescriptionMethodGetAllTypeDefinitionsName,
1116 message.header.requestId,
1117 bindings.MessageHeader.kMessageIsResponse);
1118 }
1119 });
1120 } else if (response != null) {
1121 return buildResponseWithId(
1122 response,
1123 _serviceDescriptionMethodGetAllTypeDefinitionsName,
1124 message.header.requestId,
1125 bindings.MessageHeader.kMessageIsResponse);
1126 }
1127 break; 1123 break;
1128 default: 1124 default:
1129 throw new bindings.MojoCodecError("Unexpected message name"); 1125 throw new bindings.MojoCodecError("Unexpected message name");
1130 break; 1126 break;
1131 } 1127 }
1132 return null;
1133 } 1128 }
1134 1129
1135 ServiceDescription get impl => _impl; 1130 ServiceDescription get impl => _impl;
1136 set impl(ServiceDescription d) { 1131 set impl(ServiceDescription d) {
1137 if (d == null) { 1132 if (d == null) {
1138 throw new core.MojoApiError("$this: Cannot set a null implementation"); 1133 throw new core.MojoApiError("$this: Cannot set a null implementation");
1139 } 1134 }
1140 if (isBound && (_impl == null)) { 1135 if (isBound && (_impl == null)) {
1141 beginHandlingEvents(); 1136 beginHandlingEvents();
1142 } 1137 }
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
1176 core.MojoHandle handle, [ServiceDescription impl]) 1171 core.MojoHandle handle, [ServiceDescription impl])
1177 : super(new _ServiceDescriptionStubControl.fromHandle(handle, impl)); 1172 : super(new _ServiceDescriptionStubControl.fromHandle(handle, impl));
1178 1173
1179 static ServiceDescriptionStub newFromEndpoint( 1174 static ServiceDescriptionStub newFromEndpoint(
1180 core.MojoMessagePipeEndpoint endpoint) { 1175 core.MojoMessagePipeEndpoint endpoint) {
1181 assert(endpoint.setDescription("For ServiceDescriptionStub")); 1176 assert(endpoint.setDescription("For ServiceDescriptionStub"));
1182 return new ServiceDescriptionStub.fromEndpoint(endpoint); 1177 return new ServiceDescriptionStub.fromEndpoint(endpoint);
1183 } 1178 }
1184 1179
1185 1180
1186 dynamic getTopLevelInterface([Function responseFactory = null]) { 1181 void getTopLevelInterface(void callback(mojom_types_mojom.MojomInterface mojom Interface)) {
1187 return impl.getTopLevelInterface(responseFactory); 1182 return impl.getTopLevelInterface(callback);
1188 } 1183 }
1189 dynamic getTypeDefinition(String typeKey,[Function responseFactory = null]) { 1184 void getTypeDefinition(String typeKey,void callback(mojom_types_mojom.UserDefi nedType type)) {
1190 return impl.getTypeDefinition(typeKey,responseFactory); 1185 return impl.getTypeDefinition(typeKey,callback);
1191 } 1186 }
1192 dynamic getAllTypeDefinitions([Function responseFactory = null]) { 1187 void getAllTypeDefinitions(void callback(Map<String, mojom_types_mojom.UserDef inedType> definitions)) {
1193 return impl.getAllTypeDefinitions(responseFactory); 1188 return impl.getAllTypeDefinitions(callback);
1194 } 1189 }
1195 } 1190 }
1196 1191
1197 1192
1198 1193
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698