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

Side by Side Diff: mojo/dart/packages/mojo_services/lib/mojo/ui/views.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 views_mojom; 4 library views_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 import 'package:mojo/mojo/service_provider.mojom.dart' as service_provider_mojom ; 9 import 'package:mojo/mojo/service_provider.mojom.dart' as service_provider_mojom ;
10 import 'package:mojo_services/mojo/gfx/composition/scenes.mojom.dart' as scenes_ mojom; 10 import 'package:mojo_services/mojo/gfx/composition/scenes.mojom.dart' as scenes_ mojom;
11 import 'package:mojo_services/mojo/gfx/composition/scheduling.mojom.dart' as sch eduling_mojom; 11 import 'package:mojo_services/mojo/gfx/composition/scheduling.mojom.dart' as sch eduling_mojom;
12 import 'package:mojo_services/mojo/ui/view_containers.mojom.dart' as view_contai ners_mojom; 12 import 'package:mojo_services/mojo/ui/view_containers.mojom.dart' as view_contai ners_mojom;
13 import 'package:mojo_services/mojo/ui/view_properties.mojom.dart' as view_proper ties_mojom; 13 import 'package:mojo_services/mojo/ui/view_properties.mojom.dart' as view_proper ties_mojom;
14 import 'package:mojo_services/mojo/ui/view_token.mojom.dart' as view_token_mojom ; 14 import 'package:mojo_services/mojo/ui/view_token.mojom.dart' as view_token_mojom ;
15 15
16 16
17 17
18 class ViewInvalidation extends bindings.Struct { 18 class ViewInvalidation extends bindings.Struct {
19 static const List<bindings.StructDataHeader> kVersions = const [ 19 static const List<bindings.StructDataHeader> kVersions = const [
20 const bindings.StructDataHeader(32, 0) 20 const bindings.StructDataHeader(32, 0)
21 ]; 21 ];
22 view_properties_mojom.ViewProperties properties = null; 22 view_properties_mojom.ViewProperties properties = null;
23 int containerFlushToken = 0; 23 int containerFlushToken = 0;
24 int sceneVersion = 0; 24 int sceneVersion = 0;
25 scheduling_mojom.FrameInfo frameInfo = null; 25 scheduling_mojom.FrameInfo frameInfo = null;
26 26
27 ViewInvalidation() : super(kVersions.last.size); 27 ViewInvalidation() : super(kVersions.last.size);
28 28
29 ViewInvalidation.init(
30 view_properties_mojom.ViewProperties this.properties,
31 int this.containerFlushToken,
32 int this.sceneVersion,
33 scheduling_mojom.FrameInfo this.frameInfo
34 ) : super(kVersions.last.size);
35
29 static ViewInvalidation deserialize(bindings.Message message) { 36 static ViewInvalidation deserialize(bindings.Message message) {
30 var decoder = new bindings.Decoder(message); 37 var decoder = new bindings.Decoder(message);
31 var result = decode(decoder); 38 var result = decode(decoder);
32 if (decoder.excessHandles != null) { 39 if (decoder.excessHandles != null) {
33 decoder.excessHandles.forEach((h) => h.close()); 40 decoder.excessHandles.forEach((h) => h.close());
34 } 41 }
35 return result; 42 return result;
36 } 43 }
37 44
38 static ViewInvalidation decode(bindings.Decoder decoder0) { 45 static ViewInvalidation decode(bindings.Decoder decoder0) {
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 } 138 }
132 139
133 140
134 class _ViewGetTokenParams extends bindings.Struct { 141 class _ViewGetTokenParams extends bindings.Struct {
135 static const List<bindings.StructDataHeader> kVersions = const [ 142 static const List<bindings.StructDataHeader> kVersions = const [
136 const bindings.StructDataHeader(8, 0) 143 const bindings.StructDataHeader(8, 0)
137 ]; 144 ];
138 145
139 _ViewGetTokenParams() : super(kVersions.last.size); 146 _ViewGetTokenParams() : super(kVersions.last.size);
140 147
148 _ViewGetTokenParams.init(
149 ) : super(kVersions.last.size);
150
141 static _ViewGetTokenParams deserialize(bindings.Message message) { 151 static _ViewGetTokenParams deserialize(bindings.Message message) {
142 var decoder = new bindings.Decoder(message); 152 var decoder = new bindings.Decoder(message);
143 var result = decode(decoder); 153 var result = decode(decoder);
144 if (decoder.excessHandles != null) { 154 if (decoder.excessHandles != null) {
145 decoder.excessHandles.forEach((h) => h.close()); 155 decoder.excessHandles.forEach((h) => h.close());
146 } 156 }
147 return result; 157 return result;
148 } 158 }
149 159
150 static _ViewGetTokenParams decode(bindings.Decoder decoder0) { 160 static _ViewGetTokenParams decode(bindings.Decoder decoder0) {
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 200
191 201
192 class ViewGetTokenResponseParams extends bindings.Struct { 202 class ViewGetTokenResponseParams extends bindings.Struct {
193 static const List<bindings.StructDataHeader> kVersions = const [ 203 static const List<bindings.StructDataHeader> kVersions = const [
194 const bindings.StructDataHeader(16, 0) 204 const bindings.StructDataHeader(16, 0)
195 ]; 205 ];
196 view_token_mojom.ViewToken token = null; 206 view_token_mojom.ViewToken token = null;
197 207
198 ViewGetTokenResponseParams() : super(kVersions.last.size); 208 ViewGetTokenResponseParams() : super(kVersions.last.size);
199 209
210 ViewGetTokenResponseParams.init(
211 view_token_mojom.ViewToken this.token
212 ) : super(kVersions.last.size);
213
200 static ViewGetTokenResponseParams deserialize(bindings.Message message) { 214 static ViewGetTokenResponseParams deserialize(bindings.Message message) {
201 var decoder = new bindings.Decoder(message); 215 var decoder = new bindings.Decoder(message);
202 var result = decode(decoder); 216 var result = decode(decoder);
203 if (decoder.excessHandles != null) { 217 if (decoder.excessHandles != null) {
204 decoder.excessHandles.forEach((h) => h.close()); 218 decoder.excessHandles.forEach((h) => h.close());
205 } 219 }
206 return result; 220 return result;
207 } 221 }
208 222
209 static ViewGetTokenResponseParams decode(bindings.Decoder decoder0) { 223 static ViewGetTokenResponseParams decode(bindings.Decoder decoder0) {
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 277
264 278
265 class _ViewGetServiceProviderParams extends bindings.Struct { 279 class _ViewGetServiceProviderParams extends bindings.Struct {
266 static const List<bindings.StructDataHeader> kVersions = const [ 280 static const List<bindings.StructDataHeader> kVersions = const [
267 const bindings.StructDataHeader(16, 0) 281 const bindings.StructDataHeader(16, 0)
268 ]; 282 ];
269 service_provider_mojom.ServiceProviderInterfaceRequest serviceProvider = null; 283 service_provider_mojom.ServiceProviderInterfaceRequest serviceProvider = null;
270 284
271 _ViewGetServiceProviderParams() : super(kVersions.last.size); 285 _ViewGetServiceProviderParams() : super(kVersions.last.size);
272 286
287 _ViewGetServiceProviderParams.init(
288 service_provider_mojom.ServiceProviderInterfaceRequest this.serviceProvider
289 ) : super(kVersions.last.size);
290
273 static _ViewGetServiceProviderParams deserialize(bindings.Message message) { 291 static _ViewGetServiceProviderParams deserialize(bindings.Message message) {
274 var decoder = new bindings.Decoder(message); 292 var decoder = new bindings.Decoder(message);
275 var result = decode(decoder); 293 var result = decode(decoder);
276 if (decoder.excessHandles != null) { 294 if (decoder.excessHandles != null) {
277 decoder.excessHandles.forEach((h) => h.close()); 295 decoder.excessHandles.forEach((h) => h.close());
278 } 296 }
279 return result; 297 return result;
280 } 298 }
281 299
282 static _ViewGetServiceProviderParams decode(bindings.Decoder decoder0) { 300 static _ViewGetServiceProviderParams decode(bindings.Decoder decoder0) {
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 352
335 353
336 class _ViewCreateSceneParams extends bindings.Struct { 354 class _ViewCreateSceneParams extends bindings.Struct {
337 static const List<bindings.StructDataHeader> kVersions = const [ 355 static const List<bindings.StructDataHeader> kVersions = const [
338 const bindings.StructDataHeader(16, 0) 356 const bindings.StructDataHeader(16, 0)
339 ]; 357 ];
340 scenes_mojom.SceneInterfaceRequest scene = null; 358 scenes_mojom.SceneInterfaceRequest scene = null;
341 359
342 _ViewCreateSceneParams() : super(kVersions.last.size); 360 _ViewCreateSceneParams() : super(kVersions.last.size);
343 361
362 _ViewCreateSceneParams.init(
363 scenes_mojom.SceneInterfaceRequest this.scene
364 ) : super(kVersions.last.size);
365
344 static _ViewCreateSceneParams deserialize(bindings.Message message) { 366 static _ViewCreateSceneParams deserialize(bindings.Message message) {
345 var decoder = new bindings.Decoder(message); 367 var decoder = new bindings.Decoder(message);
346 var result = decode(decoder); 368 var result = decode(decoder);
347 if (decoder.excessHandles != null) { 369 if (decoder.excessHandles != null) {
348 decoder.excessHandles.forEach((h) => h.close()); 370 decoder.excessHandles.forEach((h) => h.close());
349 } 371 }
350 return result; 372 return result;
351 } 373 }
352 374
353 static _ViewCreateSceneParams decode(bindings.Decoder decoder0) { 375 static _ViewCreateSceneParams decode(bindings.Decoder decoder0) {
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 427
406 428
407 class _ViewGetContainerParams extends bindings.Struct { 429 class _ViewGetContainerParams extends bindings.Struct {
408 static const List<bindings.StructDataHeader> kVersions = const [ 430 static const List<bindings.StructDataHeader> kVersions = const [
409 const bindings.StructDataHeader(16, 0) 431 const bindings.StructDataHeader(16, 0)
410 ]; 432 ];
411 view_containers_mojom.ViewContainerInterfaceRequest container = null; 433 view_containers_mojom.ViewContainerInterfaceRequest container = null;
412 434
413 _ViewGetContainerParams() : super(kVersions.last.size); 435 _ViewGetContainerParams() : super(kVersions.last.size);
414 436
437 _ViewGetContainerParams.init(
438 view_containers_mojom.ViewContainerInterfaceRequest this.container
439 ) : super(kVersions.last.size);
440
415 static _ViewGetContainerParams deserialize(bindings.Message message) { 441 static _ViewGetContainerParams deserialize(bindings.Message message) {
416 var decoder = new bindings.Decoder(message); 442 var decoder = new bindings.Decoder(message);
417 var result = decode(decoder); 443 var result = decode(decoder);
418 if (decoder.excessHandles != null) { 444 if (decoder.excessHandles != null) {
419 decoder.excessHandles.forEach((h) => h.close()); 445 decoder.excessHandles.forEach((h) => h.close());
420 } 446 }
421 return result; 447 return result;
422 } 448 }
423 449
424 static _ViewGetContainerParams decode(bindings.Decoder decoder0) { 450 static _ViewGetContainerParams decode(bindings.Decoder decoder0) {
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
475 } 501 }
476 502
477 503
478 class _ViewInvalidateParams extends bindings.Struct { 504 class _ViewInvalidateParams extends bindings.Struct {
479 static const List<bindings.StructDataHeader> kVersions = const [ 505 static const List<bindings.StructDataHeader> kVersions = const [
480 const bindings.StructDataHeader(8, 0) 506 const bindings.StructDataHeader(8, 0)
481 ]; 507 ];
482 508
483 _ViewInvalidateParams() : super(kVersions.last.size); 509 _ViewInvalidateParams() : super(kVersions.last.size);
484 510
511 _ViewInvalidateParams.init(
512 ) : super(kVersions.last.size);
513
485 static _ViewInvalidateParams deserialize(bindings.Message message) { 514 static _ViewInvalidateParams deserialize(bindings.Message message) {
486 var decoder = new bindings.Decoder(message); 515 var decoder = new bindings.Decoder(message);
487 var result = decode(decoder); 516 var result = decode(decoder);
488 if (decoder.excessHandles != null) { 517 if (decoder.excessHandles != null) {
489 decoder.excessHandles.forEach((h) => h.close()); 518 decoder.excessHandles.forEach((h) => h.close());
490 } 519 }
491 return result; 520 return result;
492 } 521 }
493 522
494 static _ViewInvalidateParams decode(bindings.Decoder decoder0) { 523 static _ViewInvalidateParams decode(bindings.Decoder decoder0) {
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
534 563
535 564
536 class _ViewListenerOnInvalidationParams extends bindings.Struct { 565 class _ViewListenerOnInvalidationParams extends bindings.Struct {
537 static const List<bindings.StructDataHeader> kVersions = const [ 566 static const List<bindings.StructDataHeader> kVersions = const [
538 const bindings.StructDataHeader(16, 0) 567 const bindings.StructDataHeader(16, 0)
539 ]; 568 ];
540 ViewInvalidation invalidation = null; 569 ViewInvalidation invalidation = null;
541 570
542 _ViewListenerOnInvalidationParams() : super(kVersions.last.size); 571 _ViewListenerOnInvalidationParams() : super(kVersions.last.size);
543 572
573 _ViewListenerOnInvalidationParams.init(
574 ViewInvalidation this.invalidation
575 ) : super(kVersions.last.size);
576
544 static _ViewListenerOnInvalidationParams deserialize(bindings.Message message) { 577 static _ViewListenerOnInvalidationParams deserialize(bindings.Message message) {
545 var decoder = new bindings.Decoder(message); 578 var decoder = new bindings.Decoder(message);
546 var result = decode(decoder); 579 var result = decode(decoder);
547 if (decoder.excessHandles != null) { 580 if (decoder.excessHandles != null) {
548 decoder.excessHandles.forEach((h) => h.close()); 581 decoder.excessHandles.forEach((h) => h.close());
549 } 582 }
550 return result; 583 return result;
551 } 584 }
552 585
553 static _ViewListenerOnInvalidationParams decode(bindings.Decoder decoder0) { 586 static _ViewListenerOnInvalidationParams decode(bindings.Decoder decoder0) {
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
606 } 639 }
607 640
608 641
609 class ViewListenerOnInvalidationResponseParams extends bindings.Struct { 642 class ViewListenerOnInvalidationResponseParams extends bindings.Struct {
610 static const List<bindings.StructDataHeader> kVersions = const [ 643 static const List<bindings.StructDataHeader> kVersions = const [
611 const bindings.StructDataHeader(8, 0) 644 const bindings.StructDataHeader(8, 0)
612 ]; 645 ];
613 646
614 ViewListenerOnInvalidationResponseParams() : super(kVersions.last.size); 647 ViewListenerOnInvalidationResponseParams() : super(kVersions.last.size);
615 648
649 ViewListenerOnInvalidationResponseParams.init(
650 ) : super(kVersions.last.size);
651
616 static ViewListenerOnInvalidationResponseParams deserialize(bindings.Message m essage) { 652 static ViewListenerOnInvalidationResponseParams deserialize(bindings.Message m essage) {
617 var decoder = new bindings.Decoder(message); 653 var decoder = new bindings.Decoder(message);
618 var result = decode(decoder); 654 var result = decode(decoder);
619 if (decoder.excessHandles != null) { 655 if (decoder.excessHandles != null) {
620 decoder.excessHandles.forEach((h) => h.close()); 656 decoder.excessHandles.forEach((h) => h.close());
621 } 657 }
622 return result; 658 return result;
623 } 659 }
624 660
625 static ViewListenerOnInvalidationResponseParams decode(bindings.Decoder decode r0) { 661 static ViewListenerOnInvalidationResponseParams decode(bindings.Decoder decode r0) {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
663 } 699 }
664 } 700 }
665 701
666 const int _viewMethodGetTokenName = 0; 702 const int _viewMethodGetTokenName = 0;
667 const int _viewMethodGetServiceProviderName = 1; 703 const int _viewMethodGetServiceProviderName = 1;
668 const int _viewMethodCreateSceneName = 2; 704 const int _viewMethodCreateSceneName = 2;
669 const int _viewMethodGetContainerName = 3; 705 const int _viewMethodGetContainerName = 3;
670 const int _viewMethodInvalidateName = 4; 706 const int _viewMethodInvalidateName = 4;
671 707
672 class _ViewServiceDescription implements service_describer.ServiceDescription { 708 class _ViewServiceDescription implements service_describer.ServiceDescription {
673 dynamic getTopLevelInterface([Function responseFactory]) => 709 void getTopLevelInterface(Function responder) {
674 responseFactory(null); 710 responder(null);
711 }
675 712
676 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => 713 void getTypeDefinition(String typeKey, Function responder) {
677 responseFactory(null); 714 responder(null);
715 }
678 716
679 dynamic getAllTypeDefinitions([Function responseFactory]) => 717 void getAllTypeDefinitions(Function responder) {
680 responseFactory(null); 718 responder(null);
719 }
681 } 720 }
682 721
683 abstract class View { 722 abstract class View {
684 static const String serviceName = null; 723 static const String serviceName = null;
685 724
686 static service_describer.ServiceDescription _cachedServiceDescription; 725 static service_describer.ServiceDescription _cachedServiceDescription;
687 static service_describer.ServiceDescription get serviceDescription { 726 static service_describer.ServiceDescription get serviceDescription {
688 if (_cachedServiceDescription == null) { 727 if (_cachedServiceDescription == null) {
689 _cachedServiceDescription = new _ViewServiceDescription(); 728 _cachedServiceDescription = new _ViewServiceDescription();
690 } 729 }
691 return _cachedServiceDescription; 730 return _cachedServiceDescription;
692 } 731 }
693 732
694 static ViewProxy connectToService( 733 static ViewProxy connectToService(
695 bindings.ServiceConnector s, String url, [String serviceName]) { 734 bindings.ServiceConnector s, String url, [String serviceName]) {
696 ViewProxy p = new ViewProxy.unbound(); 735 ViewProxy p = new ViewProxy.unbound();
697 String name = serviceName ?? View.serviceName; 736 String name = serviceName ?? View.serviceName;
698 if ((name == null) || name.isEmpty) { 737 if ((name == null) || name.isEmpty) {
699 throw new core.MojoApiError( 738 throw new core.MojoApiError(
700 "If an interface has no ServiceName, then one must be provided."); 739 "If an interface has no ServiceName, then one must be provided.");
701 } 740 }
702 s.connectToService(url, p, name); 741 s.connectToService(url, p, name);
703 return p; 742 return p;
704 } 743 }
705 dynamic getToken([Function responseFactory = null]); 744 void getToken(void callback(view_token_mojom.ViewToken token));
706 void getServiceProvider(service_provider_mojom.ServiceProviderInterfaceRequest serviceProvider); 745 void getServiceProvider(service_provider_mojom.ServiceProviderInterfaceRequest serviceProvider);
707 void createScene(scenes_mojom.SceneInterfaceRequest scene); 746 void createScene(scenes_mojom.SceneInterfaceRequest scene);
708 void getContainer(view_containers_mojom.ViewContainerInterfaceRequest containe r); 747 void getContainer(view_containers_mojom.ViewContainerInterfaceRequest containe r);
709 void invalidate(); 748 void invalidate();
710 } 749 }
711 750
712 abstract class ViewInterface 751 abstract class ViewInterface
713 implements bindings.MojoInterface<View>, 752 implements bindings.MojoInterface<View>,
714 View { 753 View {
715 factory ViewInterface([View impl]) => 754 factory ViewInterface([View impl]) =>
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
749 788
750 void handleResponse(bindings.ServiceMessage message) { 789 void handleResponse(bindings.ServiceMessage message) {
751 switch (message.header.type) { 790 switch (message.header.type) {
752 case _viewMethodGetTokenName: 791 case _viewMethodGetTokenName:
753 var r = ViewGetTokenResponseParams.deserialize( 792 var r = ViewGetTokenResponseParams.deserialize(
754 message.payload); 793 message.payload);
755 if (!message.header.hasRequestId) { 794 if (!message.header.hasRequestId) {
756 proxyError("Expected a message with a valid request Id."); 795 proxyError("Expected a message with a valid request Id.");
757 return; 796 return;
758 } 797 }
759 Completer c = completerMap[message.header.requestId]; 798 Function callback = callbackMap[message.header.requestId];
760 if (c == null) { 799 if (callback == null) {
761 proxyError( 800 proxyError(
762 "Message had unknown request Id: ${message.header.requestId}"); 801 "Message had unknown request Id: ${message.header.requestId}");
763 return; 802 return;
764 } 803 }
765 completerMap.remove(message.header.requestId); 804 callbackMap.remove(message.header.requestId);
766 if (c.isCompleted) { 805 callback(r.token );
767 proxyError("Response completer already completed");
768 return;
769 }
770 c.complete(r);
771 break; 806 break;
772 default: 807 default:
773 proxyError("Unexpected message type: ${message.header.type}"); 808 proxyError("Unexpected message type: ${message.header.type}");
774 close(immediate: true); 809 close(immediate: true);
775 break; 810 break;
776 } 811 }
777 } 812 }
778 813
779 @override 814 @override
780 String toString() { 815 String toString() {
(...skipping 24 matching lines...) Expand all
805 return newMockedProxy; 840 return newMockedProxy;
806 } 841 }
807 842
808 static ViewProxy newFromEndpoint( 843 static ViewProxy newFromEndpoint(
809 core.MojoMessagePipeEndpoint endpoint) { 844 core.MojoMessagePipeEndpoint endpoint) {
810 assert(endpoint.setDescription("For ViewProxy")); 845 assert(endpoint.setDescription("For ViewProxy"));
811 return new ViewProxy.fromEndpoint(endpoint); 846 return new ViewProxy.fromEndpoint(endpoint);
812 } 847 }
813 848
814 849
815 dynamic getToken([Function responseFactory = null]) { 850 void getToken(void callback(view_token_mojom.ViewToken token)) {
816 if (impl != null) { 851 if (impl != null) {
817 return new Future(() => impl.getToken(_ViewStubControl._viewGetTokenRespon seParamsFactory)); 852 impl.getToken(callback);
853 return;
818 } 854 }
819 var params = new _ViewGetTokenParams(); 855 var params = new _ViewGetTokenParams();
820 return ctrl.sendMessageWithRequestId( 856 ctrl.sendMessageWithRequestId(
821 params, 857 params,
822 _viewMethodGetTokenName, 858 _viewMethodGetTokenName,
823 -1, 859 -1,
824 bindings.MessageHeader.kMessageExpectsResponse); 860 bindings.MessageHeader.kMessageExpectsResponse,
861 callback);
825 } 862 }
826 void getServiceProvider(service_provider_mojom.ServiceProviderInterfaceRequest serviceProvider) { 863 void getServiceProvider(service_provider_mojom.ServiceProviderInterfaceRequest serviceProvider) {
827 if (impl != null) { 864 if (impl != null) {
828 impl.getServiceProvider(serviceProvider); 865 impl.getServiceProvider(serviceProvider);
829 return; 866 return;
830 } 867 }
831 if (!ctrl.isBound) { 868 if (!ctrl.isBound) {
832 ctrl.proxyError("The Proxy is closed."); 869 ctrl.proxyError("The Proxy is closed.");
833 return; 870 return;
834 } 871 }
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
895 core.MojoHandle handle, [View impl]) 932 core.MojoHandle handle, [View impl])
896 : super.fromHandle(handle, autoBegin: impl != null) { 933 : super.fromHandle(handle, autoBegin: impl != null) {
897 _impl = impl; 934 _impl = impl;
898 } 935 }
899 936
900 _ViewStubControl.unbound([this._impl]) : super.unbound(); 937 _ViewStubControl.unbound([this._impl]) : super.unbound();
901 938
902 String get serviceName => View.serviceName; 939 String get serviceName => View.serviceName;
903 940
904 941
905 static ViewGetTokenResponseParams _viewGetTokenResponseParamsFactory(view_toke n_mojom.ViewToken token) { 942 Function _viewGetTokenResponseParamsResponder(
906 var result = new ViewGetTokenResponseParams(); 943 int requestId) {
907 result.token = token; 944 return (view_token_mojom.ViewToken token) {
908 return result; 945 var result = new ViewGetTokenResponseParams();
946 result.token = token;
947 sendResponse(buildResponseWithId(
948 result,
949 _viewMethodGetTokenName,
950 requestId,
951 bindings.MessageHeader.kMessageIsResponse));
952 };
909 } 953 }
910 954
911 dynamic handleMessage(bindings.ServiceMessage message) { 955 void handleMessage(bindings.ServiceMessage message) {
912 if (bindings.ControlMessageHandler.isControlMessage(message)) { 956 if (bindings.ControlMessageHandler.isControlMessage(message)) {
913 return bindings.ControlMessageHandler.handleMessage(this, 957 bindings.ControlMessageHandler.handleMessage(
914 0, 958 this, 0, message);
915 message); 959 return;
916 } 960 }
917 if (_impl == null) { 961 if (_impl == null) {
918 throw new core.MojoApiError("$this has no implementation set"); 962 throw new core.MojoApiError("$this has no implementation set");
919 } 963 }
920 switch (message.header.type) { 964 switch (message.header.type) {
921 case _viewMethodGetTokenName: 965 case _viewMethodGetTokenName:
922 var response = _impl.getToken(_viewGetTokenResponseParamsFactory); 966 _impl.getToken(_viewGetTokenResponseParamsResponder(message.header.reque stId));
923 if (response is Future) {
924 return response.then((response) {
925 if (response != null) {
926 return buildResponseWithId(
927 response,
928 _viewMethodGetTokenName,
929 message.header.requestId,
930 bindings.MessageHeader.kMessageIsResponse);
931 }
932 });
933 } else if (response != null) {
934 return buildResponseWithId(
935 response,
936 _viewMethodGetTokenName,
937 message.header.requestId,
938 bindings.MessageHeader.kMessageIsResponse);
939 }
940 break; 967 break;
941 case _viewMethodGetServiceProviderName: 968 case _viewMethodGetServiceProviderName:
942 var params = _ViewGetServiceProviderParams.deserialize( 969 var params = _ViewGetServiceProviderParams.deserialize(
943 message.payload); 970 message.payload);
944 _impl.getServiceProvider(params.serviceProvider); 971 _impl.getServiceProvider(params.serviceProvider);
945 break; 972 break;
946 case _viewMethodCreateSceneName: 973 case _viewMethodCreateSceneName:
947 var params = _ViewCreateSceneParams.deserialize( 974 var params = _ViewCreateSceneParams.deserialize(
948 message.payload); 975 message.payload);
949 _impl.createScene(params.scene); 976 _impl.createScene(params.scene);
950 break; 977 break;
951 case _viewMethodGetContainerName: 978 case _viewMethodGetContainerName:
952 var params = _ViewGetContainerParams.deserialize( 979 var params = _ViewGetContainerParams.deserialize(
953 message.payload); 980 message.payload);
954 _impl.getContainer(params.container); 981 _impl.getContainer(params.container);
955 break; 982 break;
956 case _viewMethodInvalidateName: 983 case _viewMethodInvalidateName:
957 _impl.invalidate(); 984 _impl.invalidate();
958 break; 985 break;
959 default: 986 default:
960 throw new bindings.MojoCodecError("Unexpected message name"); 987 throw new bindings.MojoCodecError("Unexpected message name");
961 break; 988 break;
962 } 989 }
963 return null;
964 } 990 }
965 991
966 View get impl => _impl; 992 View get impl => _impl;
967 set impl(View d) { 993 set impl(View d) {
968 if (d == null) { 994 if (d == null) {
969 throw new core.MojoApiError("$this: Cannot set a null implementation"); 995 throw new core.MojoApiError("$this: Cannot set a null implementation");
970 } 996 }
971 if (isBound && (_impl == null)) { 997 if (isBound && (_impl == null)) {
972 beginHandlingEvents(); 998 beginHandlingEvents();
973 } 999 }
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
1007 core.MojoHandle handle, [View impl]) 1033 core.MojoHandle handle, [View impl])
1008 : super(new _ViewStubControl.fromHandle(handle, impl)); 1034 : super(new _ViewStubControl.fromHandle(handle, impl));
1009 1035
1010 static ViewStub newFromEndpoint( 1036 static ViewStub newFromEndpoint(
1011 core.MojoMessagePipeEndpoint endpoint) { 1037 core.MojoMessagePipeEndpoint endpoint) {
1012 assert(endpoint.setDescription("For ViewStub")); 1038 assert(endpoint.setDescription("For ViewStub"));
1013 return new ViewStub.fromEndpoint(endpoint); 1039 return new ViewStub.fromEndpoint(endpoint);
1014 } 1040 }
1015 1041
1016 1042
1017 dynamic getToken([Function responseFactory = null]) { 1043 void getToken(void callback(view_token_mojom.ViewToken token)) {
1018 return impl.getToken(responseFactory); 1044 return impl.getToken(callback);
1019 } 1045 }
1020 void getServiceProvider(service_provider_mojom.ServiceProviderInterfaceRequest serviceProvider) { 1046 void getServiceProvider(service_provider_mojom.ServiceProviderInterfaceRequest serviceProvider) {
1021 return impl.getServiceProvider(serviceProvider); 1047 return impl.getServiceProvider(serviceProvider);
1022 } 1048 }
1023 void createScene(scenes_mojom.SceneInterfaceRequest scene) { 1049 void createScene(scenes_mojom.SceneInterfaceRequest scene) {
1024 return impl.createScene(scene); 1050 return impl.createScene(scene);
1025 } 1051 }
1026 void getContainer(view_containers_mojom.ViewContainerInterfaceRequest containe r) { 1052 void getContainer(view_containers_mojom.ViewContainerInterfaceRequest containe r) {
1027 return impl.getContainer(container); 1053 return impl.getContainer(container);
1028 } 1054 }
1029 void invalidate() { 1055 void invalidate() {
1030 return impl.invalidate(); 1056 return impl.invalidate();
1031 } 1057 }
1032 } 1058 }
1033 1059
1034 const int _viewListenerMethodOnInvalidationName = 0; 1060 const int _viewListenerMethodOnInvalidationName = 0;
1035 1061
1036 class _ViewListenerServiceDescription implements service_describer.ServiceDescri ption { 1062 class _ViewListenerServiceDescription implements service_describer.ServiceDescri ption {
1037 dynamic getTopLevelInterface([Function responseFactory]) => 1063 void getTopLevelInterface(Function responder) {
1038 responseFactory(null); 1064 responder(null);
1065 }
1039 1066
1040 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => 1067 void getTypeDefinition(String typeKey, Function responder) {
1041 responseFactory(null); 1068 responder(null);
1069 }
1042 1070
1043 dynamic getAllTypeDefinitions([Function responseFactory]) => 1071 void getAllTypeDefinitions(Function responder) {
1044 responseFactory(null); 1072 responder(null);
1073 }
1045 } 1074 }
1046 1075
1047 abstract class ViewListener { 1076 abstract class ViewListener {
1048 static const String serviceName = null; 1077 static const String serviceName = null;
1049 1078
1050 static service_describer.ServiceDescription _cachedServiceDescription; 1079 static service_describer.ServiceDescription _cachedServiceDescription;
1051 static service_describer.ServiceDescription get serviceDescription { 1080 static service_describer.ServiceDescription get serviceDescription {
1052 if (_cachedServiceDescription == null) { 1081 if (_cachedServiceDescription == null) {
1053 _cachedServiceDescription = new _ViewListenerServiceDescription(); 1082 _cachedServiceDescription = new _ViewListenerServiceDescription();
1054 } 1083 }
1055 return _cachedServiceDescription; 1084 return _cachedServiceDescription;
1056 } 1085 }
1057 1086
1058 static ViewListenerProxy connectToService( 1087 static ViewListenerProxy connectToService(
1059 bindings.ServiceConnector s, String url, [String serviceName]) { 1088 bindings.ServiceConnector s, String url, [String serviceName]) {
1060 ViewListenerProxy p = new ViewListenerProxy.unbound(); 1089 ViewListenerProxy p = new ViewListenerProxy.unbound();
1061 String name = serviceName ?? ViewListener.serviceName; 1090 String name = serviceName ?? ViewListener.serviceName;
1062 if ((name == null) || name.isEmpty) { 1091 if ((name == null) || name.isEmpty) {
1063 throw new core.MojoApiError( 1092 throw new core.MojoApiError(
1064 "If an interface has no ServiceName, then one must be provided."); 1093 "If an interface has no ServiceName, then one must be provided.");
1065 } 1094 }
1066 s.connectToService(url, p, name); 1095 s.connectToService(url, p, name);
1067 return p; 1096 return p;
1068 } 1097 }
1069 dynamic onInvalidation(ViewInvalidation invalidation,[Function responseFactory = null]); 1098 void onInvalidation(ViewInvalidation invalidation,void callback());
1070 } 1099 }
1071 1100
1072 abstract class ViewListenerInterface 1101 abstract class ViewListenerInterface
1073 implements bindings.MojoInterface<ViewListener>, 1102 implements bindings.MojoInterface<ViewListener>,
1074 ViewListener { 1103 ViewListener {
1075 factory ViewListenerInterface([ViewListener impl]) => 1104 factory ViewListenerInterface([ViewListener impl]) =>
1076 new ViewListenerStub.unbound(impl); 1105 new ViewListenerStub.unbound(impl);
1077 1106
1078 factory ViewListenerInterface.fromEndpoint( 1107 factory ViewListenerInterface.fromEndpoint(
1079 core.MojoMessagePipeEndpoint endpoint, 1108 core.MojoMessagePipeEndpoint endpoint,
(...skipping 29 matching lines...) Expand all
1109 1138
1110 void handleResponse(bindings.ServiceMessage message) { 1139 void handleResponse(bindings.ServiceMessage message) {
1111 switch (message.header.type) { 1140 switch (message.header.type) {
1112 case _viewListenerMethodOnInvalidationName: 1141 case _viewListenerMethodOnInvalidationName:
1113 var r = ViewListenerOnInvalidationResponseParams.deserialize( 1142 var r = ViewListenerOnInvalidationResponseParams.deserialize(
1114 message.payload); 1143 message.payload);
1115 if (!message.header.hasRequestId) { 1144 if (!message.header.hasRequestId) {
1116 proxyError("Expected a message with a valid request Id."); 1145 proxyError("Expected a message with a valid request Id.");
1117 return; 1146 return;
1118 } 1147 }
1119 Completer c = completerMap[message.header.requestId]; 1148 Function callback = callbackMap[message.header.requestId];
1120 if (c == null) { 1149 if (callback == null) {
1121 proxyError( 1150 proxyError(
1122 "Message had unknown request Id: ${message.header.requestId}"); 1151 "Message had unknown request Id: ${message.header.requestId}");
1123 return; 1152 return;
1124 } 1153 }
1125 completerMap.remove(message.header.requestId); 1154 callbackMap.remove(message.header.requestId);
1126 if (c.isCompleted) { 1155 callback();
1127 proxyError("Response completer already completed");
1128 return;
1129 }
1130 c.complete(r);
1131 break; 1156 break;
1132 default: 1157 default:
1133 proxyError("Unexpected message type: ${message.header.type}"); 1158 proxyError("Unexpected message type: ${message.header.type}");
1134 close(immediate: true); 1159 close(immediate: true);
1135 break; 1160 break;
1136 } 1161 }
1137 } 1162 }
1138 1163
1139 @override 1164 @override
1140 String toString() { 1165 String toString() {
(...skipping 24 matching lines...) Expand all
1165 return newMockedProxy; 1190 return newMockedProxy;
1166 } 1191 }
1167 1192
1168 static ViewListenerProxy newFromEndpoint( 1193 static ViewListenerProxy newFromEndpoint(
1169 core.MojoMessagePipeEndpoint endpoint) { 1194 core.MojoMessagePipeEndpoint endpoint) {
1170 assert(endpoint.setDescription("For ViewListenerProxy")); 1195 assert(endpoint.setDescription("For ViewListenerProxy"));
1171 return new ViewListenerProxy.fromEndpoint(endpoint); 1196 return new ViewListenerProxy.fromEndpoint(endpoint);
1172 } 1197 }
1173 1198
1174 1199
1175 dynamic onInvalidation(ViewInvalidation invalidation,[Function responseFactory = null]) { 1200 void onInvalidation(ViewInvalidation invalidation,void callback()) {
1176 if (impl != null) { 1201 if (impl != null) {
1177 return new Future(() => impl.onInvalidation(invalidation,_ViewListenerStub Control._viewListenerOnInvalidationResponseParamsFactory)); 1202 impl.onInvalidation(invalidation,callback);
1203 return;
1178 } 1204 }
1179 var params = new _ViewListenerOnInvalidationParams(); 1205 var params = new _ViewListenerOnInvalidationParams();
1180 params.invalidation = invalidation; 1206 params.invalidation = invalidation;
1181 return ctrl.sendMessageWithRequestId( 1207 ctrl.sendMessageWithRequestId(
1182 params, 1208 params,
1183 _viewListenerMethodOnInvalidationName, 1209 _viewListenerMethodOnInvalidationName,
1184 -1, 1210 -1,
1185 bindings.MessageHeader.kMessageExpectsResponse); 1211 bindings.MessageHeader.kMessageExpectsResponse,
1212 callback);
1186 } 1213 }
1187 } 1214 }
1188 1215
1189 class _ViewListenerStubControl 1216 class _ViewListenerStubControl
1190 extends bindings.StubMessageHandler 1217 extends bindings.StubMessageHandler
1191 implements bindings.StubControl<ViewListener> { 1218 implements bindings.StubControl<ViewListener> {
1192 ViewListener _impl; 1219 ViewListener _impl;
1193 1220
1194 _ViewListenerStubControl.fromEndpoint( 1221 _ViewListenerStubControl.fromEndpoint(
1195 core.MojoMessagePipeEndpoint endpoint, [ViewListener impl]) 1222 core.MojoMessagePipeEndpoint endpoint, [ViewListener impl])
1196 : super.fromEndpoint(endpoint, autoBegin: impl != null) { 1223 : super.fromEndpoint(endpoint, autoBegin: impl != null) {
1197 _impl = impl; 1224 _impl = impl;
1198 } 1225 }
1199 1226
1200 _ViewListenerStubControl.fromHandle( 1227 _ViewListenerStubControl.fromHandle(
1201 core.MojoHandle handle, [ViewListener impl]) 1228 core.MojoHandle handle, [ViewListener impl])
1202 : super.fromHandle(handle, autoBegin: impl != null) { 1229 : super.fromHandle(handle, autoBegin: impl != null) {
1203 _impl = impl; 1230 _impl = impl;
1204 } 1231 }
1205 1232
1206 _ViewListenerStubControl.unbound([this._impl]) : super.unbound(); 1233 _ViewListenerStubControl.unbound([this._impl]) : super.unbound();
1207 1234
1208 String get serviceName => ViewListener.serviceName; 1235 String get serviceName => ViewListener.serviceName;
1209 1236
1210 1237
1211 static ViewListenerOnInvalidationResponseParams _viewListenerOnInvalidationRes ponseParamsFactory() { 1238 Function _viewListenerOnInvalidationResponseParamsResponder(
1212 var result = new ViewListenerOnInvalidationResponseParams(); 1239 int requestId) {
1213 return result; 1240 return () {
1241 var result = new ViewListenerOnInvalidationResponseParams();
1242 sendResponse(buildResponseWithId(
1243 result,
1244 _viewListenerMethodOnInvalidationName,
1245 requestId,
1246 bindings.MessageHeader.kMessageIsResponse));
1247 };
1214 } 1248 }
1215 1249
1216 dynamic handleMessage(bindings.ServiceMessage message) { 1250 void handleMessage(bindings.ServiceMessage message) {
1217 if (bindings.ControlMessageHandler.isControlMessage(message)) { 1251 if (bindings.ControlMessageHandler.isControlMessage(message)) {
1218 return bindings.ControlMessageHandler.handleMessage(this, 1252 bindings.ControlMessageHandler.handleMessage(
1219 0, 1253 this, 0, message);
1220 message); 1254 return;
1221 } 1255 }
1222 if (_impl == null) { 1256 if (_impl == null) {
1223 throw new core.MojoApiError("$this has no implementation set"); 1257 throw new core.MojoApiError("$this has no implementation set");
1224 } 1258 }
1225 switch (message.header.type) { 1259 switch (message.header.type) {
1226 case _viewListenerMethodOnInvalidationName: 1260 case _viewListenerMethodOnInvalidationName:
1227 var params = _ViewListenerOnInvalidationParams.deserialize( 1261 var params = _ViewListenerOnInvalidationParams.deserialize(
1228 message.payload); 1262 message.payload);
1229 var response = _impl.onInvalidation(params.invalidation,_viewListenerOnI nvalidationResponseParamsFactory); 1263 _impl.onInvalidation(params.invalidation, _viewListenerOnInvalidationRes ponseParamsResponder(message.header.requestId));
1230 if (response is Future) {
1231 return response.then((response) {
1232 if (response != null) {
1233 return buildResponseWithId(
1234 response,
1235 _viewListenerMethodOnInvalidationName,
1236 message.header.requestId,
1237 bindings.MessageHeader.kMessageIsResponse);
1238 }
1239 });
1240 } else if (response != null) {
1241 return buildResponseWithId(
1242 response,
1243 _viewListenerMethodOnInvalidationName,
1244 message.header.requestId,
1245 bindings.MessageHeader.kMessageIsResponse);
1246 }
1247 break; 1264 break;
1248 default: 1265 default:
1249 throw new bindings.MojoCodecError("Unexpected message name"); 1266 throw new bindings.MojoCodecError("Unexpected message name");
1250 break; 1267 break;
1251 } 1268 }
1252 return null;
1253 } 1269 }
1254 1270
1255 ViewListener get impl => _impl; 1271 ViewListener get impl => _impl;
1256 set impl(ViewListener d) { 1272 set impl(ViewListener d) {
1257 if (d == null) { 1273 if (d == null) {
1258 throw new core.MojoApiError("$this: Cannot set a null implementation"); 1274 throw new core.MojoApiError("$this: Cannot set a null implementation");
1259 } 1275 }
1260 if (isBound && (_impl == null)) { 1276 if (isBound && (_impl == null)) {
1261 beginHandlingEvents(); 1277 beginHandlingEvents();
1262 } 1278 }
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
1296 core.MojoHandle handle, [ViewListener impl]) 1312 core.MojoHandle handle, [ViewListener impl])
1297 : super(new _ViewListenerStubControl.fromHandle(handle, impl)); 1313 : super(new _ViewListenerStubControl.fromHandle(handle, impl));
1298 1314
1299 static ViewListenerStub newFromEndpoint( 1315 static ViewListenerStub newFromEndpoint(
1300 core.MojoMessagePipeEndpoint endpoint) { 1316 core.MojoMessagePipeEndpoint endpoint) {
1301 assert(endpoint.setDescription("For ViewListenerStub")); 1317 assert(endpoint.setDescription("For ViewListenerStub"));
1302 return new ViewListenerStub.fromEndpoint(endpoint); 1318 return new ViewListenerStub.fromEndpoint(endpoint);
1303 } 1319 }
1304 1320
1305 1321
1306 dynamic onInvalidation(ViewInvalidation invalidation,[Function responseFactory = null]) { 1322 void onInvalidation(ViewInvalidation invalidation,void callback()) {
1307 return impl.onInvalidation(invalidation,responseFactory); 1323 return impl.onInvalidation(invalidation,callback);
1308 } 1324 }
1309 } 1325 }
1310 1326
1311 1327
1312 1328
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698