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

Side by Side Diff: mojo/dart/packages/mojo_services/lib/mojo/camera.mojom.dart

Issue 1983453002: Dart: Refactor Stubs (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Merge Created 4 years, 7 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 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 library camera_mojom; 5 library camera_mojom;
6 import 'dart:async'; 6 import 'dart:async';
7 import 'package:mojo/bindings.dart' as bindings; 7 import 'package:mojo/bindings.dart' as bindings;
8 import 'package:mojo/core.dart' as core; 8 import 'package:mojo/core.dart' as core;
9 import 'package:mojo/mojo/bindings/types/service_describer.mojom.dart' as servic e_describer; 9 import 'package:mojo/mojo/bindings/types/service_describer.mojom.dart' as servic e_describer;
10 10
(...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after
569 responseFactory(null); 569 responseFactory(null);
570 } 570 }
571 571
572 abstract class CameraRollService { 572 abstract class CameraRollService {
573 static const String serviceName = "mojo::CameraRollService"; 573 static const String serviceName = "mojo::CameraRollService";
574 void update(); 574 void update();
575 dynamic getCount([Function responseFactory = null]); 575 dynamic getCount([Function responseFactory = null]);
576 dynamic getPhoto(int index,[Function responseFactory = null]); 576 dynamic getPhoto(int index,[Function responseFactory = null]);
577 } 577 }
578 578
579 579 class _CameraRollServiceProxyControl
580 class _CameraRollServiceProxyControl extends bindings.ProxyMessageHandler 580 extends bindings.ProxyMessageHandler
581 implements bindings.ProxyControl { 581 implements bindings.ProxyControl {
582 _CameraRollServiceProxyControl.fromEndpoint( 582 _CameraRollServiceProxyControl.fromEndpoint(
583 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); 583 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint);
584 584
585 _CameraRollServiceProxyControl.fromHandle( 585 _CameraRollServiceProxyControl.fromHandle(
586 core.MojoHandle handle) : super.fromHandle(handle); 586 core.MojoHandle handle) : super.fromHandle(handle);
587 587
588 _CameraRollServiceProxyControl.unbound() : super.unbound(); 588 _CameraRollServiceProxyControl.unbound() : super.unbound();
589 589
590 service_describer.ServiceDescription get serviceDescription => 590 service_describer.ServiceDescription get serviceDescription =>
591 new _CameraRollServiceServiceDescription(); 591 new _CameraRollServiceServiceDescription();
592 592
593 String get serviceName => CameraRollService.serviceName; 593 String get serviceName => CameraRollService.serviceName;
594 594
595 @override
596 void handleResponse(bindings.ServiceMessage message) { 595 void handleResponse(bindings.ServiceMessage message) {
597 switch (message.header.type) { 596 switch (message.header.type) {
598 case _cameraRollServiceMethodGetCountName: 597 case _cameraRollServiceMethodGetCountName:
599 var r = CameraRollServiceGetCountResponseParams.deserialize( 598 var r = CameraRollServiceGetCountResponseParams.deserialize(
600 message.payload); 599 message.payload);
601 if (!message.header.hasRequestId) { 600 if (!message.header.hasRequestId) {
602 proxyError("Expected a message with a valid request Id."); 601 proxyError("Expected a message with a valid request Id.");
603 return; 602 return;
604 } 603 }
605 Completer c = completerMap[message.header.requestId]; 604 Completer c = completerMap[message.header.requestId];
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
642 } 641 }
643 } 642 }
644 643
645 @override 644 @override
646 String toString() { 645 String toString() {
647 var superString = super.toString(); 646 var superString = super.toString();
648 return "_CameraRollServiceProxyControl($superString)"; 647 return "_CameraRollServiceProxyControl($superString)";
649 } 648 }
650 } 649 }
651 650
652 651 class CameraRollServiceProxy
653 class CameraRollServiceProxy extends bindings.Proxy 652 extends bindings.Proxy
654 implements CameraRollService { 653 implements CameraRollService {
655 CameraRollServiceProxy.fromEndpoint( 654 CameraRollServiceProxy.fromEndpoint(
656 core.MojoMessagePipeEndpoint endpoint) 655 core.MojoMessagePipeEndpoint endpoint)
657 : super(new _CameraRollServiceProxyControl.fromEndpoint(endpoint)); 656 : super(new _CameraRollServiceProxyControl.fromEndpoint(endpoint));
658 657
659 CameraRollServiceProxy.fromHandle(core.MojoHandle handle) 658 CameraRollServiceProxy.fromHandle(core.MojoHandle handle)
660 : super(new _CameraRollServiceProxyControl.fromHandle(handle)); 659 : super(new _CameraRollServiceProxyControl.fromHandle(handle));
661 660
662 CameraRollServiceProxy.unbound() 661 CameraRollServiceProxy.unbound()
663 : super(new _CameraRollServiceProxyControl.unbound()); 662 : super(new _CameraRollServiceProxyControl.unbound());
664 663
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
697 var params = new _CameraRollServiceGetPhotoParams(); 696 var params = new _CameraRollServiceGetPhotoParams();
698 params.index = index; 697 params.index = index;
699 return ctrl.sendMessageWithRequestId( 698 return ctrl.sendMessageWithRequestId(
700 params, 699 params,
701 _cameraRollServiceMethodGetPhotoName, 700 _cameraRollServiceMethodGetPhotoName,
702 -1, 701 -1,
703 bindings.MessageHeader.kMessageExpectsResponse); 702 bindings.MessageHeader.kMessageExpectsResponse);
704 } 703 }
705 } 704 }
706 705
707 706 class _CameraRollServiceStubControl
708 class CameraRollServiceStub extends bindings.Stub { 707 extends bindings.StubMessageHandler
708 implements bindings.StubControl<CameraRollService> {
709 CameraRollService _impl; 709 CameraRollService _impl;
710 710
711 CameraRollServiceStub.fromEndpoint( 711 _CameraRollServiceStubControl.fromEndpoint(
712 core.MojoMessagePipeEndpoint endpoint, [CameraRollService impl]) 712 core.MojoMessagePipeEndpoint endpoint, [CameraRollService impl])
713 : super.fromEndpoint(endpoint, autoBegin: impl != null) { 713 : super.fromEndpoint(endpoint, autoBegin: impl != null) {
714 _impl = impl; 714 _impl = impl;
715 } 715 }
716 716
717 CameraRollServiceStub.fromHandle( 717 _CameraRollServiceStubControl.fromHandle(
718 core.MojoHandle handle, [CameraRollService impl]) 718 core.MojoHandle handle, [CameraRollService impl])
719 : super.fromHandle(handle, autoBegin: impl != null) { 719 : super.fromHandle(handle, autoBegin: impl != null) {
720 _impl = impl; 720 _impl = impl;
721 } 721 }
722 722
723 CameraRollServiceStub.unbound([this._impl]) : super.unbound(); 723 _CameraRollServiceStubControl.unbound([this._impl]) : super.unbound();
724
725 static CameraRollServiceStub newFromEndpoint(
726 core.MojoMessagePipeEndpoint endpoint) {
727 assert(endpoint.setDescription("For CameraRollServiceStub"));
728 return new CameraRollServiceStub.fromEndpoint(endpoint);
729 }
730 724
731 725
732 CameraRollServiceGetCountResponseParams _cameraRollServiceGetCountResponsePara msFactory(int numPhotos) { 726 CameraRollServiceGetCountResponseParams _cameraRollServiceGetCountResponsePara msFactory(int numPhotos) {
733 var result = new CameraRollServiceGetCountResponseParams(); 727 var result = new CameraRollServiceGetCountResponseParams();
734 result.numPhotos = numPhotos; 728 result.numPhotos = numPhotos;
735 return result; 729 return result;
736 } 730 }
737 CameraRollServiceGetPhotoResponseParams _cameraRollServiceGetPhotoResponsePara msFactory(Photo photo) { 731 CameraRollServiceGetPhotoResponseParams _cameraRollServiceGetPhotoResponsePara msFactory(Photo photo) {
738 var result = new CameraRollServiceGetPhotoResponseParams(); 732 var result = new CameraRollServiceGetPhotoResponseParams();
739 result.photo = photo; 733 result.photo = photo;
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
814 } 808 }
815 809
816 @override 810 @override
817 void bind(core.MojoMessagePipeEndpoint endpoint) { 811 void bind(core.MojoMessagePipeEndpoint endpoint) {
818 super.bind(endpoint); 812 super.bind(endpoint);
819 if (!isOpen && (_impl != null)) { 813 if (!isOpen && (_impl != null)) {
820 beginHandlingEvents(); 814 beginHandlingEvents();
821 } 815 }
822 } 816 }
823 817
818 @override
824 String toString() { 819 String toString() {
825 var superString = super.toString(); 820 var superString = super.toString();
826 return "CameraRollServiceStub($superString)"; 821 return "_CameraRollServiceStubControl($superString)";
827 } 822 }
828 823
829 int get version => 0; 824 int get version => 0;
830 825
831 static service_describer.ServiceDescription _cachedServiceDescription; 826 static service_describer.ServiceDescription _cachedServiceDescription;
832 static service_describer.ServiceDescription get serviceDescription { 827 static service_describer.ServiceDescription get serviceDescription {
833 if (_cachedServiceDescription == null) { 828 if (_cachedServiceDescription == null) {
834 _cachedServiceDescription = new _CameraRollServiceServiceDescription(); 829 _cachedServiceDescription = new _CameraRollServiceServiceDescription();
835 } 830 }
836 return _cachedServiceDescription; 831 return _cachedServiceDescription;
837 } 832 }
838 } 833 }
839 834
835 class CameraRollServiceStub
836 extends bindings.Stub<CameraRollService>
837 implements CameraRollService {
838 CameraRollServiceStub.fromEndpoint(
839 core.MojoMessagePipeEndpoint endpoint, [CameraRollService impl])
840 : super(new _CameraRollServiceStubControl.fromEndpoint(endpoint, impl));
841
842 CameraRollServiceStub.fromHandle(
843 core.MojoHandle handle, [CameraRollService impl])
844 : super(new _CameraRollServiceStubControl.fromHandle(handle, impl));
845
846 CameraRollServiceStub.unbound([CameraRollService impl])
847 : super(new _CameraRollServiceStubControl.unbound(impl));
848
849 static CameraRollServiceStub newFromEndpoint(
850 core.MojoMessagePipeEndpoint endpoint) {
851 assert(endpoint.setDescription("For CameraRollServiceStub"));
852 return new CameraRollServiceStub.fromEndpoint(endpoint);
853 }
854
855 static service_describer.ServiceDescription get serviceDescription =>
856 _CameraRollServiceStubControl.serviceDescription;
857
858
859 void update() {
860 return impl.update();
861 }
862 dynamic getCount([Function responseFactory = null]) {
863 return impl.getCount(responseFactory);
864 }
865 dynamic getPhoto(int index,[Function responseFactory = null]) {
866 return impl.getPhoto(index,responseFactory);
867 }
868 }
869
840 const int _cameraServiceMethodGetLatestFrameName = 0; 870 const int _cameraServiceMethodGetLatestFrameName = 0;
841 871
842 class _CameraServiceServiceDescription implements service_describer.ServiceDescr iption { 872 class _CameraServiceServiceDescription implements service_describer.ServiceDescr iption {
843 dynamic getTopLevelInterface([Function responseFactory]) => 873 dynamic getTopLevelInterface([Function responseFactory]) =>
844 responseFactory(null); 874 responseFactory(null);
845 875
846 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => 876 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) =>
847 responseFactory(null); 877 responseFactory(null);
848 878
849 dynamic getAllTypeDefinitions([Function responseFactory]) => 879 dynamic getAllTypeDefinitions([Function responseFactory]) =>
850 responseFactory(null); 880 responseFactory(null);
851 } 881 }
852 882
853 abstract class CameraService { 883 abstract class CameraService {
854 static const String serviceName = "mojo::CameraService"; 884 static const String serviceName = "mojo::CameraService";
855 dynamic getLatestFrame([Function responseFactory = null]); 885 dynamic getLatestFrame([Function responseFactory = null]);
856 } 886 }
857 887
858 888 class _CameraServiceProxyControl
859 class _CameraServiceProxyControl extends bindings.ProxyMessageHandler 889 extends bindings.ProxyMessageHandler
860 implements bindings.ProxyControl { 890 implements bindings.ProxyControl {
861 _CameraServiceProxyControl.fromEndpoint( 891 _CameraServiceProxyControl.fromEndpoint(
862 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); 892 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint);
863 893
864 _CameraServiceProxyControl.fromHandle( 894 _CameraServiceProxyControl.fromHandle(
865 core.MojoHandle handle) : super.fromHandle(handle); 895 core.MojoHandle handle) : super.fromHandle(handle);
866 896
867 _CameraServiceProxyControl.unbound() : super.unbound(); 897 _CameraServiceProxyControl.unbound() : super.unbound();
868 898
869 service_describer.ServiceDescription get serviceDescription => 899 service_describer.ServiceDescription get serviceDescription =>
870 new _CameraServiceServiceDescription(); 900 new _CameraServiceServiceDescription();
871 901
872 String get serviceName => CameraService.serviceName; 902 String get serviceName => CameraService.serviceName;
873 903
874 @override
875 void handleResponse(bindings.ServiceMessage message) { 904 void handleResponse(bindings.ServiceMessage message) {
876 switch (message.header.type) { 905 switch (message.header.type) {
877 case _cameraServiceMethodGetLatestFrameName: 906 case _cameraServiceMethodGetLatestFrameName:
878 var r = CameraServiceGetLatestFrameResponseParams.deserialize( 907 var r = CameraServiceGetLatestFrameResponseParams.deserialize(
879 message.payload); 908 message.payload);
880 if (!message.header.hasRequestId) { 909 if (!message.header.hasRequestId) {
881 proxyError("Expected a message with a valid request Id."); 910 proxyError("Expected a message with a valid request Id.");
882 return; 911 return;
883 } 912 }
884 Completer c = completerMap[message.header.requestId]; 913 Completer c = completerMap[message.header.requestId];
(...skipping 16 matching lines...) Expand all
901 } 930 }
902 } 931 }
903 932
904 @override 933 @override
905 String toString() { 934 String toString() {
906 var superString = super.toString(); 935 var superString = super.toString();
907 return "_CameraServiceProxyControl($superString)"; 936 return "_CameraServiceProxyControl($superString)";
908 } 937 }
909 } 938 }
910 939
911 940 class CameraServiceProxy
912 class CameraServiceProxy extends bindings.Proxy 941 extends bindings.Proxy
913 implements CameraService { 942 implements CameraService {
914 CameraServiceProxy.fromEndpoint( 943 CameraServiceProxy.fromEndpoint(
915 core.MojoMessagePipeEndpoint endpoint) 944 core.MojoMessagePipeEndpoint endpoint)
916 : super(new _CameraServiceProxyControl.fromEndpoint(endpoint)); 945 : super(new _CameraServiceProxyControl.fromEndpoint(endpoint));
917 946
918 CameraServiceProxy.fromHandle(core.MojoHandle handle) 947 CameraServiceProxy.fromHandle(core.MojoHandle handle)
919 : super(new _CameraServiceProxyControl.fromHandle(handle)); 948 : super(new _CameraServiceProxyControl.fromHandle(handle));
920 949
921 CameraServiceProxy.unbound() 950 CameraServiceProxy.unbound()
922 : super(new _CameraServiceProxyControl.unbound()); 951 : super(new _CameraServiceProxyControl.unbound());
923 952
(...skipping 14 matching lines...) Expand all
938 dynamic getLatestFrame([Function responseFactory = null]) { 967 dynamic getLatestFrame([Function responseFactory = null]) {
939 var params = new _CameraServiceGetLatestFrameParams(); 968 var params = new _CameraServiceGetLatestFrameParams();
940 return ctrl.sendMessageWithRequestId( 969 return ctrl.sendMessageWithRequestId(
941 params, 970 params,
942 _cameraServiceMethodGetLatestFrameName, 971 _cameraServiceMethodGetLatestFrameName,
943 -1, 972 -1,
944 bindings.MessageHeader.kMessageExpectsResponse); 973 bindings.MessageHeader.kMessageExpectsResponse);
945 } 974 }
946 } 975 }
947 976
948 977 class _CameraServiceStubControl
949 class CameraServiceStub extends bindings.Stub { 978 extends bindings.StubMessageHandler
979 implements bindings.StubControl<CameraService> {
950 CameraService _impl; 980 CameraService _impl;
951 981
952 CameraServiceStub.fromEndpoint( 982 _CameraServiceStubControl.fromEndpoint(
953 core.MojoMessagePipeEndpoint endpoint, [CameraService impl]) 983 core.MojoMessagePipeEndpoint endpoint, [CameraService impl])
954 : super.fromEndpoint(endpoint, autoBegin: impl != null) { 984 : super.fromEndpoint(endpoint, autoBegin: impl != null) {
955 _impl = impl; 985 _impl = impl;
956 } 986 }
957 987
958 CameraServiceStub.fromHandle( 988 _CameraServiceStubControl.fromHandle(
959 core.MojoHandle handle, [CameraService impl]) 989 core.MojoHandle handle, [CameraService impl])
960 : super.fromHandle(handle, autoBegin: impl != null) { 990 : super.fromHandle(handle, autoBegin: impl != null) {
961 _impl = impl; 991 _impl = impl;
962 } 992 }
963 993
964 CameraServiceStub.unbound([this._impl]) : super.unbound(); 994 _CameraServiceStubControl.unbound([this._impl]) : super.unbound();
965
966 static CameraServiceStub newFromEndpoint(
967 core.MojoMessagePipeEndpoint endpoint) {
968 assert(endpoint.setDescription("For CameraServiceStub"));
969 return new CameraServiceStub.fromEndpoint(endpoint);
970 }
971 995
972 996
973 CameraServiceGetLatestFrameResponseParams _cameraServiceGetLatestFrameResponse ParamsFactory(core.MojoDataPipeConsumer content) { 997 CameraServiceGetLatestFrameResponseParams _cameraServiceGetLatestFrameResponse ParamsFactory(core.MojoDataPipeConsumer content) {
974 var result = new CameraServiceGetLatestFrameResponseParams(); 998 var result = new CameraServiceGetLatestFrameResponseParams();
975 result.content = content; 999 result.content = content;
976 return result; 1000 return result;
977 } 1001 }
978 1002
979 dynamic handleMessage(bindings.ServiceMessage message) { 1003 dynamic handleMessage(bindings.ServiceMessage message) {
980 if (bindings.ControlMessageHandler.isControlMessage(message)) { 1004 if (bindings.ControlMessageHandler.isControlMessage(message)) {
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
1025 } 1049 }
1026 1050
1027 @override 1051 @override
1028 void bind(core.MojoMessagePipeEndpoint endpoint) { 1052 void bind(core.MojoMessagePipeEndpoint endpoint) {
1029 super.bind(endpoint); 1053 super.bind(endpoint);
1030 if (!isOpen && (_impl != null)) { 1054 if (!isOpen && (_impl != null)) {
1031 beginHandlingEvents(); 1055 beginHandlingEvents();
1032 } 1056 }
1033 } 1057 }
1034 1058
1059 @override
1035 String toString() { 1060 String toString() {
1036 var superString = super.toString(); 1061 var superString = super.toString();
1037 return "CameraServiceStub($superString)"; 1062 return "_CameraServiceStubControl($superString)";
1038 } 1063 }
1039 1064
1040 int get version => 0; 1065 int get version => 0;
1041 1066
1042 static service_describer.ServiceDescription _cachedServiceDescription; 1067 static service_describer.ServiceDescription _cachedServiceDescription;
1043 static service_describer.ServiceDescription get serviceDescription { 1068 static service_describer.ServiceDescription get serviceDescription {
1044 if (_cachedServiceDescription == null) { 1069 if (_cachedServiceDescription == null) {
1045 _cachedServiceDescription = new _CameraServiceServiceDescription(); 1070 _cachedServiceDescription = new _CameraServiceServiceDescription();
1046 } 1071 }
1047 return _cachedServiceDescription; 1072 return _cachedServiceDescription;
1048 } 1073 }
1049 } 1074 }
1050 1075
1076 class CameraServiceStub
1077 extends bindings.Stub<CameraService>
1078 implements CameraService {
1079 CameraServiceStub.fromEndpoint(
1080 core.MojoMessagePipeEndpoint endpoint, [CameraService impl])
1081 : super(new _CameraServiceStubControl.fromEndpoint(endpoint, impl));
1082
1083 CameraServiceStub.fromHandle(
1084 core.MojoHandle handle, [CameraService impl])
1085 : super(new _CameraServiceStubControl.fromHandle(handle, impl));
1086
1087 CameraServiceStub.unbound([CameraService impl])
1088 : super(new _CameraServiceStubControl.unbound(impl));
1089
1090 static CameraServiceStub newFromEndpoint(
1091 core.MojoMessagePipeEndpoint endpoint) {
1092 assert(endpoint.setDescription("For CameraServiceStub"));
1093 return new CameraServiceStub.fromEndpoint(endpoint);
1094 }
1095
1096 static service_describer.ServiceDescription get serviceDescription =>
1097 _CameraServiceStubControl.serviceDescription;
1098
1099
1100 dynamic getLatestFrame([Function responseFactory = null]) {
1101 return impl.getLatestFrame(responseFactory);
1102 }
1103 }
1104
1051 1105
1052 1106
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698