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

Side by Side Diff: mojo/dart/packages/mojo_services/lib/contacts/contacts.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 contacts_mojom; 4 library contacts_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 import 'package:mojo/mojo/bindings/types/service_describer.mojom.dart' as servic e_describer; 8 import 'package:mojo/mojo/bindings/types/service_describer.mojom.dart' as servic e_describer;
9 9
10 10
11 11
12 class Contact extends bindings.Struct { 12 class Contact extends bindings.Struct {
13 static const List<bindings.StructDataHeader> kVersions = const [ 13 static const List<bindings.StructDataHeader> kVersions = const [
14 const bindings.StructDataHeader(24, 0) 14 const bindings.StructDataHeader(24, 0)
15 ]; 15 ];
16 int id = 0; 16 int id = 0;
17 String name = null; 17 String name = null;
18 18
19 Contact() : super(kVersions.last.size); 19 Contact() : super(kVersions.last.size);
20 20
21 Contact.init(
22 int this.id,
23 String this.name
24 ) : super(kVersions.last.size);
25
21 static Contact deserialize(bindings.Message message) { 26 static Contact deserialize(bindings.Message message) {
22 var decoder = new bindings.Decoder(message); 27 var decoder = new bindings.Decoder(message);
23 var result = decode(decoder); 28 var result = decode(decoder);
24 if (decoder.excessHandles != null) { 29 if (decoder.excessHandles != null) {
25 decoder.excessHandles.forEach((h) => h.close()); 30 decoder.excessHandles.forEach((h) => h.close());
26 } 31 }
27 return result; 32 return result;
28 } 33 }
29 34
30 static Contact decode(bindings.Decoder decoder0) { 35 static Contact decode(bindings.Decoder decoder0) {
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 101
97 102
98 class _ContactsServiceGetCountParams extends bindings.Struct { 103 class _ContactsServiceGetCountParams extends bindings.Struct {
99 static const List<bindings.StructDataHeader> kVersions = const [ 104 static const List<bindings.StructDataHeader> kVersions = const [
100 const bindings.StructDataHeader(16, 0) 105 const bindings.StructDataHeader(16, 0)
101 ]; 106 ];
102 String filter = null; 107 String filter = null;
103 108
104 _ContactsServiceGetCountParams() : super(kVersions.last.size); 109 _ContactsServiceGetCountParams() : super(kVersions.last.size);
105 110
111 _ContactsServiceGetCountParams.init(
112 String this.filter
113 ) : super(kVersions.last.size);
114
106 static _ContactsServiceGetCountParams deserialize(bindings.Message message) { 115 static _ContactsServiceGetCountParams deserialize(bindings.Message message) {
107 var decoder = new bindings.Decoder(message); 116 var decoder = new bindings.Decoder(message);
108 var result = decode(decoder); 117 var result = decode(decoder);
109 if (decoder.excessHandles != null) { 118 if (decoder.excessHandles != null) {
110 decoder.excessHandles.forEach((h) => h.close()); 119 decoder.excessHandles.forEach((h) => h.close());
111 } 120 }
112 return result; 121 return result;
113 } 122 }
114 123
115 static _ContactsServiceGetCountParams decode(bindings.Decoder decoder0) { 124 static _ContactsServiceGetCountParams decode(bindings.Decoder decoder0) {
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 177
169 178
170 class ContactsServiceGetCountResponseParams extends bindings.Struct { 179 class ContactsServiceGetCountResponseParams extends bindings.Struct {
171 static const List<bindings.StructDataHeader> kVersions = const [ 180 static const List<bindings.StructDataHeader> kVersions = const [
172 const bindings.StructDataHeader(16, 0) 181 const bindings.StructDataHeader(16, 0)
173 ]; 182 ];
174 int count = 0; 183 int count = 0;
175 184
176 ContactsServiceGetCountResponseParams() : super(kVersions.last.size); 185 ContactsServiceGetCountResponseParams() : super(kVersions.last.size);
177 186
187 ContactsServiceGetCountResponseParams.init(
188 int this.count
189 ) : super(kVersions.last.size);
190
178 static ContactsServiceGetCountResponseParams deserialize(bindings.Message mess age) { 191 static ContactsServiceGetCountResponseParams deserialize(bindings.Message mess age) {
179 var decoder = new bindings.Decoder(message); 192 var decoder = new bindings.Decoder(message);
180 var result = decode(decoder); 193 var result = decode(decoder);
181 if (decoder.excessHandles != null) { 194 if (decoder.excessHandles != null) {
182 decoder.excessHandles.forEach((h) => h.close()); 195 decoder.excessHandles.forEach((h) => h.close());
183 } 196 }
184 return result; 197 return result;
185 } 198 }
186 199
187 static ContactsServiceGetCountResponseParams decode(bindings.Decoder decoder0) { 200 static ContactsServiceGetCountResponseParams decode(bindings.Decoder decoder0) {
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 class _ContactsServiceGetParams extends bindings.Struct { 255 class _ContactsServiceGetParams extends bindings.Struct {
243 static const List<bindings.StructDataHeader> kVersions = const [ 256 static const List<bindings.StructDataHeader> kVersions = const [
244 const bindings.StructDataHeader(24, 0) 257 const bindings.StructDataHeader(24, 0)
245 ]; 258 ];
246 String filter = null; 259 String filter = null;
247 int offset = 0; 260 int offset = 0;
248 int limit = 0; 261 int limit = 0;
249 262
250 _ContactsServiceGetParams() : super(kVersions.last.size); 263 _ContactsServiceGetParams() : super(kVersions.last.size);
251 264
265 _ContactsServiceGetParams.init(
266 String this.filter,
267 int this.offset,
268 int this.limit
269 ) : super(kVersions.last.size);
270
252 static _ContactsServiceGetParams deserialize(bindings.Message message) { 271 static _ContactsServiceGetParams deserialize(bindings.Message message) {
253 var decoder = new bindings.Decoder(message); 272 var decoder = new bindings.Decoder(message);
254 var result = decode(decoder); 273 var result = decode(decoder);
255 if (decoder.excessHandles != null) { 274 if (decoder.excessHandles != null) {
256 decoder.excessHandles.forEach((h) => h.close()); 275 decoder.excessHandles.forEach((h) => h.close());
257 } 276 }
258 return result; 277 return result;
259 } 278 }
260 279
261 static _ContactsServiceGetParams decode(bindings.Decoder decoder0) { 280 static _ContactsServiceGetParams decode(bindings.Decoder decoder0) {
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 359
341 360
342 class ContactsServiceGetResponseParams extends bindings.Struct { 361 class ContactsServiceGetResponseParams extends bindings.Struct {
343 static const List<bindings.StructDataHeader> kVersions = const [ 362 static const List<bindings.StructDataHeader> kVersions = const [
344 const bindings.StructDataHeader(16, 0) 363 const bindings.StructDataHeader(16, 0)
345 ]; 364 ];
346 List<Contact> contacts = null; 365 List<Contact> contacts = null;
347 366
348 ContactsServiceGetResponseParams() : super(kVersions.last.size); 367 ContactsServiceGetResponseParams() : super(kVersions.last.size);
349 368
369 ContactsServiceGetResponseParams.init(
370 List<Contact> this.contacts
371 ) : super(kVersions.last.size);
372
350 static ContactsServiceGetResponseParams deserialize(bindings.Message message) { 373 static ContactsServiceGetResponseParams deserialize(bindings.Message message) {
351 var decoder = new bindings.Decoder(message); 374 var decoder = new bindings.Decoder(message);
352 var result = decode(decoder); 375 var result = decode(decoder);
353 if (decoder.excessHandles != null) { 376 if (decoder.excessHandles != null) {
354 decoder.excessHandles.forEach((h) => h.close()); 377 decoder.excessHandles.forEach((h) => h.close());
355 } 378 }
356 return result; 379 return result;
357 } 380 }
358 381
359 static ContactsServiceGetResponseParams decode(bindings.Decoder decoder0) { 382 static ContactsServiceGetResponseParams decode(bindings.Decoder decoder0) {
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
428 451
429 452
430 class _ContactsServiceGetEmailsParams extends bindings.Struct { 453 class _ContactsServiceGetEmailsParams extends bindings.Struct {
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 int id = 0; 457 int id = 0;
435 458
436 _ContactsServiceGetEmailsParams() : super(kVersions.last.size); 459 _ContactsServiceGetEmailsParams() : super(kVersions.last.size);
437 460
461 _ContactsServiceGetEmailsParams.init(
462 int this.id
463 ) : super(kVersions.last.size);
464
438 static _ContactsServiceGetEmailsParams deserialize(bindings.Message message) { 465 static _ContactsServiceGetEmailsParams deserialize(bindings.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 _ContactsServiceGetEmailsParams decode(bindings.Decoder decoder0) { 474 static _ContactsServiceGetEmailsParams decode(bindings.Decoder decoder0) {
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
500 527
501 528
502 class ContactsServiceGetEmailsResponseParams extends bindings.Struct { 529 class ContactsServiceGetEmailsResponseParams extends bindings.Struct {
503 static const List<bindings.StructDataHeader> kVersions = const [ 530 static const List<bindings.StructDataHeader> kVersions = const [
504 const bindings.StructDataHeader(16, 0) 531 const bindings.StructDataHeader(16, 0)
505 ]; 532 ];
506 List<String> emails = null; 533 List<String> emails = null;
507 534
508 ContactsServiceGetEmailsResponseParams() : super(kVersions.last.size); 535 ContactsServiceGetEmailsResponseParams() : super(kVersions.last.size);
509 536
537 ContactsServiceGetEmailsResponseParams.init(
538 List<String> this.emails
539 ) : super(kVersions.last.size);
540
510 static ContactsServiceGetEmailsResponseParams deserialize(bindings.Message mes sage) { 541 static ContactsServiceGetEmailsResponseParams deserialize(bindings.Message mes sage) {
511 var decoder = new bindings.Decoder(message); 542 var decoder = new bindings.Decoder(message);
512 var result = decode(decoder); 543 var result = decode(decoder);
513 if (decoder.excessHandles != null) { 544 if (decoder.excessHandles != null) {
514 decoder.excessHandles.forEach((h) => h.close()); 545 decoder.excessHandles.forEach((h) => h.close());
515 } 546 }
516 return result; 547 return result;
517 } 548 }
518 549
519 static ContactsServiceGetEmailsResponseParams decode(bindings.Decoder decoder0 ) { 550 static ContactsServiceGetEmailsResponseParams decode(bindings.Decoder decoder0 ) {
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
588 619
589 class _ContactsServiceGetPhotoParams extends bindings.Struct { 620 class _ContactsServiceGetPhotoParams extends bindings.Struct {
590 static const List<bindings.StructDataHeader> kVersions = const [ 621 static const List<bindings.StructDataHeader> kVersions = const [
591 const bindings.StructDataHeader(24, 0) 622 const bindings.StructDataHeader(24, 0)
592 ]; 623 ];
593 int id = 0; 624 int id = 0;
594 bool highResolution = false; 625 bool highResolution = false;
595 626
596 _ContactsServiceGetPhotoParams() : super(kVersions.last.size); 627 _ContactsServiceGetPhotoParams() : super(kVersions.last.size);
597 628
629 _ContactsServiceGetPhotoParams.init(
630 int this.id,
631 bool this.highResolution
632 ) : super(kVersions.last.size);
633
598 static _ContactsServiceGetPhotoParams deserialize(bindings.Message message) { 634 static _ContactsServiceGetPhotoParams deserialize(bindings.Message message) {
599 var decoder = new bindings.Decoder(message); 635 var decoder = new bindings.Decoder(message);
600 var result = decode(decoder); 636 var result = decode(decoder);
601 if (decoder.excessHandles != null) { 637 if (decoder.excessHandles != null) {
602 decoder.excessHandles.forEach((h) => h.close()); 638 decoder.excessHandles.forEach((h) => h.close());
603 } 639 }
604 return result; 640 return result;
605 } 641 }
606 642
607 static _ContactsServiceGetPhotoParams decode(bindings.Decoder decoder0) { 643 static _ContactsServiceGetPhotoParams decode(bindings.Decoder decoder0) {
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
673 709
674 710
675 class ContactsServiceGetPhotoResponseParams extends bindings.Struct { 711 class ContactsServiceGetPhotoResponseParams extends bindings.Struct {
676 static const List<bindings.StructDataHeader> kVersions = const [ 712 static const List<bindings.StructDataHeader> kVersions = const [
677 const bindings.StructDataHeader(16, 0) 713 const bindings.StructDataHeader(16, 0)
678 ]; 714 ];
679 String photoUrl = null; 715 String photoUrl = null;
680 716
681 ContactsServiceGetPhotoResponseParams() : super(kVersions.last.size); 717 ContactsServiceGetPhotoResponseParams() : super(kVersions.last.size);
682 718
719 ContactsServiceGetPhotoResponseParams.init(
720 String this.photoUrl
721 ) : super(kVersions.last.size);
722
683 static ContactsServiceGetPhotoResponseParams deserialize(bindings.Message mess age) { 723 static ContactsServiceGetPhotoResponseParams deserialize(bindings.Message mess age) {
684 var decoder = new bindings.Decoder(message); 724 var decoder = new bindings.Decoder(message);
685 var result = decode(decoder); 725 var result = decode(decoder);
686 if (decoder.excessHandles != null) { 726 if (decoder.excessHandles != null) {
687 decoder.excessHandles.forEach((h) => h.close()); 727 decoder.excessHandles.forEach((h) => h.close());
688 } 728 }
689 return result; 729 return result;
690 } 730 }
691 731
692 static ContactsServiceGetPhotoResponseParams decode(bindings.Decoder decoder0) { 732 static ContactsServiceGetPhotoResponseParams decode(bindings.Decoder decoder0) {
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
742 return map; 782 return map;
743 } 783 }
744 } 784 }
745 785
746 const int _contactsServiceMethodGetCountName = 0; 786 const int _contactsServiceMethodGetCountName = 0;
747 const int _contactsServiceMethodGetName = 1; 787 const int _contactsServiceMethodGetName = 1;
748 const int _contactsServiceMethodGetEmailsName = 2; 788 const int _contactsServiceMethodGetEmailsName = 2;
749 const int _contactsServiceMethodGetPhotoName = 3; 789 const int _contactsServiceMethodGetPhotoName = 3;
750 790
751 class _ContactsServiceServiceDescription implements service_describer.ServiceDes cription { 791 class _ContactsServiceServiceDescription implements service_describer.ServiceDes cription {
752 dynamic getTopLevelInterface([Function responseFactory]) => 792 void getTopLevelInterface(Function responder) {
753 responseFactory(null); 793 responder(null);
794 }
754 795
755 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => 796 void getTypeDefinition(String typeKey, Function responder) {
756 responseFactory(null); 797 responder(null);
798 }
757 799
758 dynamic getAllTypeDefinitions([Function responseFactory]) => 800 void getAllTypeDefinitions(Function responder) {
759 responseFactory(null); 801 responder(null);
802 }
760 } 803 }
761 804
762 abstract class ContactsService { 805 abstract class ContactsService {
763 static const String serviceName = "contacts::ContactsService"; 806 static const String serviceName = "contacts::ContactsService";
764 807
765 static service_describer.ServiceDescription _cachedServiceDescription; 808 static service_describer.ServiceDescription _cachedServiceDescription;
766 static service_describer.ServiceDescription get serviceDescription { 809 static service_describer.ServiceDescription get serviceDescription {
767 if (_cachedServiceDescription == null) { 810 if (_cachedServiceDescription == null) {
768 _cachedServiceDescription = new _ContactsServiceServiceDescription(); 811 _cachedServiceDescription = new _ContactsServiceServiceDescription();
769 } 812 }
770 return _cachedServiceDescription; 813 return _cachedServiceDescription;
771 } 814 }
772 815
773 static ContactsServiceProxy connectToService( 816 static ContactsServiceProxy connectToService(
774 bindings.ServiceConnector s, String url, [String serviceName]) { 817 bindings.ServiceConnector s, String url, [String serviceName]) {
775 ContactsServiceProxy p = new ContactsServiceProxy.unbound(); 818 ContactsServiceProxy p = new ContactsServiceProxy.unbound();
776 String name = serviceName ?? ContactsService.serviceName; 819 String name = serviceName ?? ContactsService.serviceName;
777 if ((name == null) || name.isEmpty) { 820 if ((name == null) || name.isEmpty) {
778 throw new core.MojoApiError( 821 throw new core.MojoApiError(
779 "If an interface has no ServiceName, then one must be provided."); 822 "If an interface has no ServiceName, then one must be provided.");
780 } 823 }
781 s.connectToService(url, p, name); 824 s.connectToService(url, p, name);
782 return p; 825 return p;
783 } 826 }
784 dynamic getCount(String filter,[Function responseFactory = null]); 827 void getCount(String filter,void callback(int count));
785 dynamic get(String filter,int offset,int limit,[Function responseFactory = nul l]); 828 void get(String filter,int offset,int limit,void callback(List<Contact> contac ts));
786 dynamic getEmails(int id,[Function responseFactory = null]); 829 void getEmails(int id,void callback(List<String> emails));
787 dynamic getPhoto(int id,bool highResolution,[Function responseFactory = null]) ; 830 void getPhoto(int id,bool highResolution,void callback(String photoUrl));
788 } 831 }
789 832
790 abstract class ContactsServiceInterface 833 abstract class ContactsServiceInterface
791 implements bindings.MojoInterface<ContactsService>, 834 implements bindings.MojoInterface<ContactsService>,
792 ContactsService { 835 ContactsService {
793 factory ContactsServiceInterface([ContactsService impl]) => 836 factory ContactsServiceInterface([ContactsService impl]) =>
794 new ContactsServiceStub.unbound(impl); 837 new ContactsServiceStub.unbound(impl);
795 838
796 factory ContactsServiceInterface.fromEndpoint( 839 factory ContactsServiceInterface.fromEndpoint(
797 core.MojoMessagePipeEndpoint endpoint, 840 core.MojoMessagePipeEndpoint endpoint,
(...skipping 29 matching lines...) Expand all
827 870
828 void handleResponse(bindings.ServiceMessage message) { 871 void handleResponse(bindings.ServiceMessage message) {
829 switch (message.header.type) { 872 switch (message.header.type) {
830 case _contactsServiceMethodGetCountName: 873 case _contactsServiceMethodGetCountName:
831 var r = ContactsServiceGetCountResponseParams.deserialize( 874 var r = ContactsServiceGetCountResponseParams.deserialize(
832 message.payload); 875 message.payload);
833 if (!message.header.hasRequestId) { 876 if (!message.header.hasRequestId) {
834 proxyError("Expected a message with a valid request Id."); 877 proxyError("Expected a message with a valid request Id.");
835 return; 878 return;
836 } 879 }
837 Completer c = completerMap[message.header.requestId]; 880 Function callback = callbackMap[message.header.requestId];
838 if (c == null) { 881 if (callback == null) {
839 proxyError( 882 proxyError(
840 "Message had unknown request Id: ${message.header.requestId}"); 883 "Message had unknown request Id: ${message.header.requestId}");
841 return; 884 return;
842 } 885 }
843 completerMap.remove(message.header.requestId); 886 callbackMap.remove(message.header.requestId);
844 if (c.isCompleted) { 887 callback(r.count );
845 proxyError("Response completer already completed");
846 return;
847 }
848 c.complete(r);
849 break; 888 break;
850 case _contactsServiceMethodGetName: 889 case _contactsServiceMethodGetName:
851 var r = ContactsServiceGetResponseParams.deserialize( 890 var r = ContactsServiceGetResponseParams.deserialize(
852 message.payload); 891 message.payload);
853 if (!message.header.hasRequestId) { 892 if (!message.header.hasRequestId) {
854 proxyError("Expected a message with a valid request Id."); 893 proxyError("Expected a message with a valid request Id.");
855 return; 894 return;
856 } 895 }
857 Completer c = completerMap[message.header.requestId]; 896 Function callback = callbackMap[message.header.requestId];
858 if (c == null) { 897 if (callback == null) {
859 proxyError( 898 proxyError(
860 "Message had unknown request Id: ${message.header.requestId}"); 899 "Message had unknown request Id: ${message.header.requestId}");
861 return; 900 return;
862 } 901 }
863 completerMap.remove(message.header.requestId); 902 callbackMap.remove(message.header.requestId);
864 if (c.isCompleted) { 903 callback(r.contacts );
865 proxyError("Response completer already completed");
866 return;
867 }
868 c.complete(r);
869 break; 904 break;
870 case _contactsServiceMethodGetEmailsName: 905 case _contactsServiceMethodGetEmailsName:
871 var r = ContactsServiceGetEmailsResponseParams.deserialize( 906 var r = ContactsServiceGetEmailsResponseParams.deserialize(
872 message.payload); 907 message.payload);
873 if (!message.header.hasRequestId) { 908 if (!message.header.hasRequestId) {
874 proxyError("Expected a message with a valid request Id."); 909 proxyError("Expected a message with a valid request Id.");
875 return; 910 return;
876 } 911 }
877 Completer c = completerMap[message.header.requestId]; 912 Function callback = callbackMap[message.header.requestId];
878 if (c == null) { 913 if (callback == null) {
879 proxyError( 914 proxyError(
880 "Message had unknown request Id: ${message.header.requestId}"); 915 "Message had unknown request Id: ${message.header.requestId}");
881 return; 916 return;
882 } 917 }
883 completerMap.remove(message.header.requestId); 918 callbackMap.remove(message.header.requestId);
884 if (c.isCompleted) { 919 callback(r.emails );
885 proxyError("Response completer already completed");
886 return;
887 }
888 c.complete(r);
889 break; 920 break;
890 case _contactsServiceMethodGetPhotoName: 921 case _contactsServiceMethodGetPhotoName:
891 var r = ContactsServiceGetPhotoResponseParams.deserialize( 922 var r = ContactsServiceGetPhotoResponseParams.deserialize(
892 message.payload); 923 message.payload);
893 if (!message.header.hasRequestId) { 924 if (!message.header.hasRequestId) {
894 proxyError("Expected a message with a valid request Id."); 925 proxyError("Expected a message with a valid request Id.");
895 return; 926 return;
896 } 927 }
897 Completer c = completerMap[message.header.requestId]; 928 Function callback = callbackMap[message.header.requestId];
898 if (c == null) { 929 if (callback == null) {
899 proxyError( 930 proxyError(
900 "Message had unknown request Id: ${message.header.requestId}"); 931 "Message had unknown request Id: ${message.header.requestId}");
901 return; 932 return;
902 } 933 }
903 completerMap.remove(message.header.requestId); 934 callbackMap.remove(message.header.requestId);
904 if (c.isCompleted) { 935 callback(r.photoUrl );
905 proxyError("Response completer already completed");
906 return;
907 }
908 c.complete(r);
909 break; 936 break;
910 default: 937 default:
911 proxyError("Unexpected message type: ${message.header.type}"); 938 proxyError("Unexpected message type: ${message.header.type}");
912 close(immediate: true); 939 close(immediate: true);
913 break; 940 break;
914 } 941 }
915 } 942 }
916 943
917 @override 944 @override
918 String toString() { 945 String toString() {
(...skipping 24 matching lines...) Expand all
943 return newMockedProxy; 970 return newMockedProxy;
944 } 971 }
945 972
946 static ContactsServiceProxy newFromEndpoint( 973 static ContactsServiceProxy newFromEndpoint(
947 core.MojoMessagePipeEndpoint endpoint) { 974 core.MojoMessagePipeEndpoint endpoint) {
948 assert(endpoint.setDescription("For ContactsServiceProxy")); 975 assert(endpoint.setDescription("For ContactsServiceProxy"));
949 return new ContactsServiceProxy.fromEndpoint(endpoint); 976 return new ContactsServiceProxy.fromEndpoint(endpoint);
950 } 977 }
951 978
952 979
953 dynamic getCount(String filter,[Function responseFactory = null]) { 980 void getCount(String filter,void callback(int count)) {
954 if (impl != null) { 981 if (impl != null) {
955 return new Future(() => impl.getCount(filter,_ContactsServiceStubControl._ contactsServiceGetCountResponseParamsFactory)); 982 impl.getCount(filter,callback);
983 return;
956 } 984 }
957 var params = new _ContactsServiceGetCountParams(); 985 var params = new _ContactsServiceGetCountParams();
958 params.filter = filter; 986 params.filter = filter;
959 return ctrl.sendMessageWithRequestId( 987 ctrl.sendMessageWithRequestId(
960 params, 988 params,
961 _contactsServiceMethodGetCountName, 989 _contactsServiceMethodGetCountName,
962 -1, 990 -1,
963 bindings.MessageHeader.kMessageExpectsResponse); 991 bindings.MessageHeader.kMessageExpectsResponse,
992 callback);
964 } 993 }
965 dynamic get(String filter,int offset,int limit,[Function responseFactory = nul l]) { 994 void get(String filter,int offset,int limit,void callback(List<Contact> contac ts)) {
966 if (impl != null) { 995 if (impl != null) {
967 return new Future(() => impl.get(filter,offset,limit,_ContactsServiceStubC ontrol._contactsServiceGetResponseParamsFactory)); 996 impl.get(filter,offset,limit,callback);
997 return;
968 } 998 }
969 var params = new _ContactsServiceGetParams(); 999 var params = new _ContactsServiceGetParams();
970 params.filter = filter; 1000 params.filter = filter;
971 params.offset = offset; 1001 params.offset = offset;
972 params.limit = limit; 1002 params.limit = limit;
973 return ctrl.sendMessageWithRequestId( 1003 ctrl.sendMessageWithRequestId(
974 params, 1004 params,
975 _contactsServiceMethodGetName, 1005 _contactsServiceMethodGetName,
976 -1, 1006 -1,
977 bindings.MessageHeader.kMessageExpectsResponse); 1007 bindings.MessageHeader.kMessageExpectsResponse,
1008 callback);
978 } 1009 }
979 dynamic getEmails(int id,[Function responseFactory = null]) { 1010 void getEmails(int id,void callback(List<String> emails)) {
980 if (impl != null) { 1011 if (impl != null) {
981 return new Future(() => impl.getEmails(id,_ContactsServiceStubControl._con tactsServiceGetEmailsResponseParamsFactory)); 1012 impl.getEmails(id,callback);
1013 return;
982 } 1014 }
983 var params = new _ContactsServiceGetEmailsParams(); 1015 var params = new _ContactsServiceGetEmailsParams();
984 params.id = id; 1016 params.id = id;
985 return ctrl.sendMessageWithRequestId( 1017 ctrl.sendMessageWithRequestId(
986 params, 1018 params,
987 _contactsServiceMethodGetEmailsName, 1019 _contactsServiceMethodGetEmailsName,
988 -1, 1020 -1,
989 bindings.MessageHeader.kMessageExpectsResponse); 1021 bindings.MessageHeader.kMessageExpectsResponse,
1022 callback);
990 } 1023 }
991 dynamic getPhoto(int id,bool highResolution,[Function responseFactory = null]) { 1024 void getPhoto(int id,bool highResolution,void callback(String photoUrl)) {
992 if (impl != null) { 1025 if (impl != null) {
993 return new Future(() => impl.getPhoto(id,highResolution,_ContactsServiceSt ubControl._contactsServiceGetPhotoResponseParamsFactory)); 1026 impl.getPhoto(id,highResolution,callback);
1027 return;
994 } 1028 }
995 var params = new _ContactsServiceGetPhotoParams(); 1029 var params = new _ContactsServiceGetPhotoParams();
996 params.id = id; 1030 params.id = id;
997 params.highResolution = highResolution; 1031 params.highResolution = highResolution;
998 return ctrl.sendMessageWithRequestId( 1032 ctrl.sendMessageWithRequestId(
999 params, 1033 params,
1000 _contactsServiceMethodGetPhotoName, 1034 _contactsServiceMethodGetPhotoName,
1001 -1, 1035 -1,
1002 bindings.MessageHeader.kMessageExpectsResponse); 1036 bindings.MessageHeader.kMessageExpectsResponse,
1037 callback);
1003 } 1038 }
1004 } 1039 }
1005 1040
1006 class _ContactsServiceStubControl 1041 class _ContactsServiceStubControl
1007 extends bindings.StubMessageHandler 1042 extends bindings.StubMessageHandler
1008 implements bindings.StubControl<ContactsService> { 1043 implements bindings.StubControl<ContactsService> {
1009 ContactsService _impl; 1044 ContactsService _impl;
1010 1045
1011 _ContactsServiceStubControl.fromEndpoint( 1046 _ContactsServiceStubControl.fromEndpoint(
1012 core.MojoMessagePipeEndpoint endpoint, [ContactsService impl]) 1047 core.MojoMessagePipeEndpoint endpoint, [ContactsService impl])
1013 : super.fromEndpoint(endpoint, autoBegin: impl != null) { 1048 : super.fromEndpoint(endpoint, autoBegin: impl != null) {
1014 _impl = impl; 1049 _impl = impl;
1015 } 1050 }
1016 1051
1017 _ContactsServiceStubControl.fromHandle( 1052 _ContactsServiceStubControl.fromHandle(
1018 core.MojoHandle handle, [ContactsService impl]) 1053 core.MojoHandle handle, [ContactsService impl])
1019 : super.fromHandle(handle, autoBegin: impl != null) { 1054 : super.fromHandle(handle, autoBegin: impl != null) {
1020 _impl = impl; 1055 _impl = impl;
1021 } 1056 }
1022 1057
1023 _ContactsServiceStubControl.unbound([this._impl]) : super.unbound(); 1058 _ContactsServiceStubControl.unbound([this._impl]) : super.unbound();
1024 1059
1025 String get serviceName => ContactsService.serviceName; 1060 String get serviceName => ContactsService.serviceName;
1026 1061
1027 1062
1028 static ContactsServiceGetCountResponseParams _contactsServiceGetCountResponseP aramsFactory(int count) { 1063 Function _contactsServiceGetCountResponseParamsResponder(
1029 var result = new ContactsServiceGetCountResponseParams(); 1064 int requestId) {
1030 result.count = count; 1065 return (int count) {
1031 return result; 1066 var result = new ContactsServiceGetCountResponseParams();
1067 result.count = count;
1068 sendResponse(buildResponseWithId(
1069 result,
1070 _contactsServiceMethodGetCountName,
1071 requestId,
1072 bindings.MessageHeader.kMessageIsResponse));
1073 };
1032 } 1074 }
1033 static ContactsServiceGetResponseParams _contactsServiceGetResponseParamsFacto ry(List<Contact> contacts) { 1075 Function _contactsServiceGetResponseParamsResponder(
1034 var result = new ContactsServiceGetResponseParams(); 1076 int requestId) {
1035 result.contacts = contacts; 1077 return (List<Contact> contacts) {
1036 return result; 1078 var result = new ContactsServiceGetResponseParams();
1079 result.contacts = contacts;
1080 sendResponse(buildResponseWithId(
1081 result,
1082 _contactsServiceMethodGetName,
1083 requestId,
1084 bindings.MessageHeader.kMessageIsResponse));
1085 };
1037 } 1086 }
1038 static ContactsServiceGetEmailsResponseParams _contactsServiceGetEmailsRespons eParamsFactory(List<String> emails) { 1087 Function _contactsServiceGetEmailsResponseParamsResponder(
1039 var result = new ContactsServiceGetEmailsResponseParams(); 1088 int requestId) {
1040 result.emails = emails; 1089 return (List<String> emails) {
1041 return result; 1090 var result = new ContactsServiceGetEmailsResponseParams();
1091 result.emails = emails;
1092 sendResponse(buildResponseWithId(
1093 result,
1094 _contactsServiceMethodGetEmailsName,
1095 requestId,
1096 bindings.MessageHeader.kMessageIsResponse));
1097 };
1042 } 1098 }
1043 static ContactsServiceGetPhotoResponseParams _contactsServiceGetPhotoResponseP aramsFactory(String photoUrl) { 1099 Function _contactsServiceGetPhotoResponseParamsResponder(
1044 var result = new ContactsServiceGetPhotoResponseParams(); 1100 int requestId) {
1045 result.photoUrl = photoUrl; 1101 return (String photoUrl) {
1046 return result; 1102 var result = new ContactsServiceGetPhotoResponseParams();
1103 result.photoUrl = photoUrl;
1104 sendResponse(buildResponseWithId(
1105 result,
1106 _contactsServiceMethodGetPhotoName,
1107 requestId,
1108 bindings.MessageHeader.kMessageIsResponse));
1109 };
1047 } 1110 }
1048 1111
1049 dynamic handleMessage(bindings.ServiceMessage message) { 1112 void handleMessage(bindings.ServiceMessage message) {
1050 if (bindings.ControlMessageHandler.isControlMessage(message)) { 1113 if (bindings.ControlMessageHandler.isControlMessage(message)) {
1051 return bindings.ControlMessageHandler.handleMessage(this, 1114 bindings.ControlMessageHandler.handleMessage(
1052 0, 1115 this, 0, message);
1053 message); 1116 return;
1054 } 1117 }
1055 if (_impl == null) { 1118 if (_impl == null) {
1056 throw new core.MojoApiError("$this has no implementation set"); 1119 throw new core.MojoApiError("$this has no implementation set");
1057 } 1120 }
1058 switch (message.header.type) { 1121 switch (message.header.type) {
1059 case _contactsServiceMethodGetCountName: 1122 case _contactsServiceMethodGetCountName:
1060 var params = _ContactsServiceGetCountParams.deserialize( 1123 var params = _ContactsServiceGetCountParams.deserialize(
1061 message.payload); 1124 message.payload);
1062 var response = _impl.getCount(params.filter,_contactsServiceGetCountResp onseParamsFactory); 1125 _impl.getCount(params.filter, _contactsServiceGetCountResponseParamsResp onder(message.header.requestId));
1063 if (response is Future) {
1064 return response.then((response) {
1065 if (response != null) {
1066 return buildResponseWithId(
1067 response,
1068 _contactsServiceMethodGetCountName,
1069 message.header.requestId,
1070 bindings.MessageHeader.kMessageIsResponse);
1071 }
1072 });
1073 } else if (response != null) {
1074 return buildResponseWithId(
1075 response,
1076 _contactsServiceMethodGetCountName,
1077 message.header.requestId,
1078 bindings.MessageHeader.kMessageIsResponse);
1079 }
1080 break; 1126 break;
1081 case _contactsServiceMethodGetName: 1127 case _contactsServiceMethodGetName:
1082 var params = _ContactsServiceGetParams.deserialize( 1128 var params = _ContactsServiceGetParams.deserialize(
1083 message.payload); 1129 message.payload);
1084 var response = _impl.get(params.filter,params.offset,params.limit,_conta ctsServiceGetResponseParamsFactory); 1130 _impl.get(params.filter, params.offset, params.limit, _contactsServiceGe tResponseParamsResponder(message.header.requestId));
1085 if (response is Future) {
1086 return response.then((response) {
1087 if (response != null) {
1088 return buildResponseWithId(
1089 response,
1090 _contactsServiceMethodGetName,
1091 message.header.requestId,
1092 bindings.MessageHeader.kMessageIsResponse);
1093 }
1094 });
1095 } else if (response != null) {
1096 return buildResponseWithId(
1097 response,
1098 _contactsServiceMethodGetName,
1099 message.header.requestId,
1100 bindings.MessageHeader.kMessageIsResponse);
1101 }
1102 break; 1131 break;
1103 case _contactsServiceMethodGetEmailsName: 1132 case _contactsServiceMethodGetEmailsName:
1104 var params = _ContactsServiceGetEmailsParams.deserialize( 1133 var params = _ContactsServiceGetEmailsParams.deserialize(
1105 message.payload); 1134 message.payload);
1106 var response = _impl.getEmails(params.id,_contactsServiceGetEmailsRespon seParamsFactory); 1135 _impl.getEmails(params.id, _contactsServiceGetEmailsResponseParamsRespon der(message.header.requestId));
1107 if (response is Future) {
1108 return response.then((response) {
1109 if (response != null) {
1110 return buildResponseWithId(
1111 response,
1112 _contactsServiceMethodGetEmailsName,
1113 message.header.requestId,
1114 bindings.MessageHeader.kMessageIsResponse);
1115 }
1116 });
1117 } else if (response != null) {
1118 return buildResponseWithId(
1119 response,
1120 _contactsServiceMethodGetEmailsName,
1121 message.header.requestId,
1122 bindings.MessageHeader.kMessageIsResponse);
1123 }
1124 break; 1136 break;
1125 case _contactsServiceMethodGetPhotoName: 1137 case _contactsServiceMethodGetPhotoName:
1126 var params = _ContactsServiceGetPhotoParams.deserialize( 1138 var params = _ContactsServiceGetPhotoParams.deserialize(
1127 message.payload); 1139 message.payload);
1128 var response = _impl.getPhoto(params.id,params.highResolution,_contactsS erviceGetPhotoResponseParamsFactory); 1140 _impl.getPhoto(params.id, params.highResolution, _contactsServiceGetPhot oResponseParamsResponder(message.header.requestId));
1129 if (response is Future) {
1130 return response.then((response) {
1131 if (response != null) {
1132 return buildResponseWithId(
1133 response,
1134 _contactsServiceMethodGetPhotoName,
1135 message.header.requestId,
1136 bindings.MessageHeader.kMessageIsResponse);
1137 }
1138 });
1139 } else if (response != null) {
1140 return buildResponseWithId(
1141 response,
1142 _contactsServiceMethodGetPhotoName,
1143 message.header.requestId,
1144 bindings.MessageHeader.kMessageIsResponse);
1145 }
1146 break; 1141 break;
1147 default: 1142 default:
1148 throw new bindings.MojoCodecError("Unexpected message name"); 1143 throw new bindings.MojoCodecError("Unexpected message name");
1149 break; 1144 break;
1150 } 1145 }
1151 return null;
1152 } 1146 }
1153 1147
1154 ContactsService get impl => _impl; 1148 ContactsService get impl => _impl;
1155 set impl(ContactsService d) { 1149 set impl(ContactsService d) {
1156 if (d == null) { 1150 if (d == null) {
1157 throw new core.MojoApiError("$this: Cannot set a null implementation"); 1151 throw new core.MojoApiError("$this: Cannot set a null implementation");
1158 } 1152 }
1159 if (isBound && (_impl == null)) { 1153 if (isBound && (_impl == null)) {
1160 beginHandlingEvents(); 1154 beginHandlingEvents();
1161 } 1155 }
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
1195 core.MojoHandle handle, [ContactsService impl]) 1189 core.MojoHandle handle, [ContactsService impl])
1196 : super(new _ContactsServiceStubControl.fromHandle(handle, impl)); 1190 : super(new _ContactsServiceStubControl.fromHandle(handle, impl));
1197 1191
1198 static ContactsServiceStub newFromEndpoint( 1192 static ContactsServiceStub newFromEndpoint(
1199 core.MojoMessagePipeEndpoint endpoint) { 1193 core.MojoMessagePipeEndpoint endpoint) {
1200 assert(endpoint.setDescription("For ContactsServiceStub")); 1194 assert(endpoint.setDescription("For ContactsServiceStub"));
1201 return new ContactsServiceStub.fromEndpoint(endpoint); 1195 return new ContactsServiceStub.fromEndpoint(endpoint);
1202 } 1196 }
1203 1197
1204 1198
1205 dynamic getCount(String filter,[Function responseFactory = null]) { 1199 void getCount(String filter,void callback(int count)) {
1206 return impl.getCount(filter,responseFactory); 1200 return impl.getCount(filter,callback);
1207 } 1201 }
1208 dynamic get(String filter,int offset,int limit,[Function responseFactory = nul l]) { 1202 void get(String filter,int offset,int limit,void callback(List<Contact> contac ts)) {
1209 return impl.get(filter,offset,limit,responseFactory); 1203 return impl.get(filter,offset,limit,callback);
1210 } 1204 }
1211 dynamic getEmails(int id,[Function responseFactory = null]) { 1205 void getEmails(int id,void callback(List<String> emails)) {
1212 return impl.getEmails(id,responseFactory); 1206 return impl.getEmails(id,callback);
1213 } 1207 }
1214 dynamic getPhoto(int id,bool highResolution,[Function responseFactory = null]) { 1208 void getPhoto(int id,bool highResolution,void callback(String photoUrl)) {
1215 return impl.getPhoto(id,highResolution,responseFactory); 1209 return impl.getPhoto(id,highResolution,callback);
1216 } 1210 }
1217 } 1211 }
1218 1212
1219 1213
1220 1214
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698