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

Side by Side Diff: mojo/dart/packages/mojo_services/lib/mojo/gfx/composition/scenes.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 scenes_mojom; 5 library scenes_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 import 'package:mojo_services/mojo/gfx/composition/nodes.mojom.dart' as nodes_mo jom; 10 import 'package:mojo_services/mojo/gfx/composition/nodes.mojom.dart' as nodes_mo jom;
(...skipping 712 matching lines...) Expand 10 before | Expand all | Expand 10 after
723 } 723 }
724 724
725 abstract class Scene { 725 abstract class Scene {
726 static const String serviceName = null; 726 static const String serviceName = null;
727 void setListener(Object listener); 727 void setListener(Object listener);
728 void update(SceneUpdate update); 728 void update(SceneUpdate update);
729 void publish(SceneMetadata metadata); 729 void publish(SceneMetadata metadata);
730 void getScheduler(Object scheduler); 730 void getScheduler(Object scheduler);
731 } 731 }
732 732
733 733 class _SceneProxyControl
734 class _SceneProxyControl extends bindings.ProxyMessageHandler 734 extends bindings.ProxyMessageHandler
735 implements bindings.ProxyControl { 735 implements bindings.ProxyControl {
736 _SceneProxyControl.fromEndpoint( 736 _SceneProxyControl.fromEndpoint(
737 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); 737 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint);
738 738
739 _SceneProxyControl.fromHandle( 739 _SceneProxyControl.fromHandle(
740 core.MojoHandle handle) : super.fromHandle(handle); 740 core.MojoHandle handle) : super.fromHandle(handle);
741 741
742 _SceneProxyControl.unbound() : super.unbound(); 742 _SceneProxyControl.unbound() : super.unbound();
743 743
744 service_describer.ServiceDescription get serviceDescription => 744 service_describer.ServiceDescription get serviceDescription =>
745 new _SceneServiceDescription(); 745 new _SceneServiceDescription();
746 746
747 String get serviceName => Scene.serviceName; 747 String get serviceName => Scene.serviceName;
748 748
749 @override
750 void handleResponse(bindings.ServiceMessage message) { 749 void handleResponse(bindings.ServiceMessage message) {
751 switch (message.header.type) { 750 switch (message.header.type) {
752 default: 751 default:
753 proxyError("Unexpected message type: ${message.header.type}"); 752 proxyError("Unexpected message type: ${message.header.type}");
754 close(immediate: true); 753 close(immediate: true);
755 break; 754 break;
756 } 755 }
757 } 756 }
758 757
759 @override 758 @override
760 String toString() { 759 String toString() {
761 var superString = super.toString(); 760 var superString = super.toString();
762 return "_SceneProxyControl($superString)"; 761 return "_SceneProxyControl($superString)";
763 } 762 }
764 } 763 }
765 764
766 765 class SceneProxy
767 class SceneProxy extends bindings.Proxy 766 extends bindings.Proxy
768 implements Scene { 767 implements Scene {
769 SceneProxy.fromEndpoint( 768 SceneProxy.fromEndpoint(
770 core.MojoMessagePipeEndpoint endpoint) 769 core.MojoMessagePipeEndpoint endpoint)
771 : super(new _SceneProxyControl.fromEndpoint(endpoint)); 770 : super(new _SceneProxyControl.fromEndpoint(endpoint));
772 771
773 SceneProxy.fromHandle(core.MojoHandle handle) 772 SceneProxy.fromHandle(core.MojoHandle handle)
774 : super(new _SceneProxyControl.fromHandle(handle)); 773 : super(new _SceneProxyControl.fromHandle(handle));
775 774
776 SceneProxy.unbound() 775 SceneProxy.unbound()
777 : super(new _SceneProxyControl.unbound()); 776 : super(new _SceneProxyControl.unbound());
778 777
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
825 ctrl.proxyError("The Proxy is closed."); 824 ctrl.proxyError("The Proxy is closed.");
826 return; 825 return;
827 } 826 }
828 var params = new _SceneGetSchedulerParams(); 827 var params = new _SceneGetSchedulerParams();
829 params.scheduler = scheduler; 828 params.scheduler = scheduler;
830 ctrl.sendMessage(params, 829 ctrl.sendMessage(params,
831 _sceneMethodGetSchedulerName); 830 _sceneMethodGetSchedulerName);
832 } 831 }
833 } 832 }
834 833
835 834 class _SceneStubControl
836 class SceneStub extends bindings.Stub { 835 extends bindings.StubMessageHandler
836 implements bindings.StubControl<Scene> {
837 Scene _impl; 837 Scene _impl;
838 838
839 SceneStub.fromEndpoint( 839 _SceneStubControl.fromEndpoint(
840 core.MojoMessagePipeEndpoint endpoint, [Scene impl]) 840 core.MojoMessagePipeEndpoint endpoint, [Scene impl])
841 : super.fromEndpoint(endpoint, autoBegin: impl != null) { 841 : super.fromEndpoint(endpoint, autoBegin: impl != null) {
842 _impl = impl; 842 _impl = impl;
843 } 843 }
844 844
845 SceneStub.fromHandle( 845 _SceneStubControl.fromHandle(
846 core.MojoHandle handle, [Scene impl]) 846 core.MojoHandle handle, [Scene impl])
847 : super.fromHandle(handle, autoBegin: impl != null) { 847 : super.fromHandle(handle, autoBegin: impl != null) {
848 _impl = impl; 848 _impl = impl;
849 } 849 }
850 850
851 SceneStub.unbound([this._impl]) : super.unbound(); 851 _SceneStubControl.unbound([this._impl]) : super.unbound();
852
853 static SceneStub newFromEndpoint(
854 core.MojoMessagePipeEndpoint endpoint) {
855 assert(endpoint.setDescription("For SceneStub"));
856 return new SceneStub.fromEndpoint(endpoint);
857 }
858 852
859 853
860 854
861 dynamic handleMessage(bindings.ServiceMessage message) { 855 dynamic handleMessage(bindings.ServiceMessage message) {
862 if (bindings.ControlMessageHandler.isControlMessage(message)) { 856 if (bindings.ControlMessageHandler.isControlMessage(message)) {
863 return bindings.ControlMessageHandler.handleMessage(this, 857 return bindings.ControlMessageHandler.handleMessage(this,
864 0, 858 0,
865 message); 859 message);
866 } 860 }
867 if (_impl == null) { 861 if (_impl == null) {
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
907 } 901 }
908 902
909 @override 903 @override
910 void bind(core.MojoMessagePipeEndpoint endpoint) { 904 void bind(core.MojoMessagePipeEndpoint endpoint) {
911 super.bind(endpoint); 905 super.bind(endpoint);
912 if (!isOpen && (_impl != null)) { 906 if (!isOpen && (_impl != null)) {
913 beginHandlingEvents(); 907 beginHandlingEvents();
914 } 908 }
915 } 909 }
916 910
911 @override
917 String toString() { 912 String toString() {
918 var superString = super.toString(); 913 var superString = super.toString();
919 return "SceneStub($superString)"; 914 return "_SceneStubControl($superString)";
920 } 915 }
921 916
922 int get version => 0; 917 int get version => 0;
923 918
924 static service_describer.ServiceDescription _cachedServiceDescription; 919 static service_describer.ServiceDescription _cachedServiceDescription;
925 static service_describer.ServiceDescription get serviceDescription { 920 static service_describer.ServiceDescription get serviceDescription {
926 if (_cachedServiceDescription == null) { 921 if (_cachedServiceDescription == null) {
927 _cachedServiceDescription = new _SceneServiceDescription(); 922 _cachedServiceDescription = new _SceneServiceDescription();
928 } 923 }
929 return _cachedServiceDescription; 924 return _cachedServiceDescription;
930 } 925 }
931 } 926 }
932 927
928 class SceneStub
929 extends bindings.Stub<Scene>
930 implements Scene {
931 SceneStub.fromEndpoint(
932 core.MojoMessagePipeEndpoint endpoint, [Scene impl])
933 : super(new _SceneStubControl.fromEndpoint(endpoint, impl));
934
935 SceneStub.fromHandle(
936 core.MojoHandle handle, [Scene impl])
937 : super(new _SceneStubControl.fromHandle(handle, impl));
938
939 SceneStub.unbound([Scene impl])
940 : super(new _SceneStubControl.unbound(impl));
941
942 static SceneStub newFromEndpoint(
943 core.MojoMessagePipeEndpoint endpoint) {
944 assert(endpoint.setDescription("For SceneStub"));
945 return new SceneStub.fromEndpoint(endpoint);
946 }
947
948 static service_describer.ServiceDescription get serviceDescription =>
949 _SceneStubControl.serviceDescription;
950
951
952 void setListener(Object listener) {
953 return impl.setListener(listener);
954 }
955 void update(SceneUpdate update) {
956 return impl.update(update);
957 }
958 void publish(SceneMetadata metadata) {
959 return impl.publish(metadata);
960 }
961 void getScheduler(Object scheduler) {
962 return impl.getScheduler(scheduler);
963 }
964 }
965
933 const int _sceneListenerMethodOnResourceUnavailableName = 0; 966 const int _sceneListenerMethodOnResourceUnavailableName = 0;
934 967
935 class _SceneListenerServiceDescription implements service_describer.ServiceDescr iption { 968 class _SceneListenerServiceDescription implements service_describer.ServiceDescr iption {
936 dynamic getTopLevelInterface([Function responseFactory]) => 969 dynamic getTopLevelInterface([Function responseFactory]) =>
937 responseFactory(null); 970 responseFactory(null);
938 971
939 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => 972 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) =>
940 responseFactory(null); 973 responseFactory(null);
941 974
942 dynamic getAllTypeDefinitions([Function responseFactory]) => 975 dynamic getAllTypeDefinitions([Function responseFactory]) =>
943 responseFactory(null); 976 responseFactory(null);
944 } 977 }
945 978
946 abstract class SceneListener { 979 abstract class SceneListener {
947 static const String serviceName = null; 980 static const String serviceName = null;
948 dynamic onResourceUnavailable(int resourceId,[Function responseFactory = null] ); 981 dynamic onResourceUnavailable(int resourceId,[Function responseFactory = null] );
949 } 982 }
950 983
951 984 class _SceneListenerProxyControl
952 class _SceneListenerProxyControl extends bindings.ProxyMessageHandler 985 extends bindings.ProxyMessageHandler
953 implements bindings.ProxyControl { 986 implements bindings.ProxyControl {
954 _SceneListenerProxyControl.fromEndpoint( 987 _SceneListenerProxyControl.fromEndpoint(
955 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); 988 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint);
956 989
957 _SceneListenerProxyControl.fromHandle( 990 _SceneListenerProxyControl.fromHandle(
958 core.MojoHandle handle) : super.fromHandle(handle); 991 core.MojoHandle handle) : super.fromHandle(handle);
959 992
960 _SceneListenerProxyControl.unbound() : super.unbound(); 993 _SceneListenerProxyControl.unbound() : super.unbound();
961 994
962 service_describer.ServiceDescription get serviceDescription => 995 service_describer.ServiceDescription get serviceDescription =>
963 new _SceneListenerServiceDescription(); 996 new _SceneListenerServiceDescription();
964 997
965 String get serviceName => SceneListener.serviceName; 998 String get serviceName => SceneListener.serviceName;
966 999
967 @override
968 void handleResponse(bindings.ServiceMessage message) { 1000 void handleResponse(bindings.ServiceMessage message) {
969 switch (message.header.type) { 1001 switch (message.header.type) {
970 case _sceneListenerMethodOnResourceUnavailableName: 1002 case _sceneListenerMethodOnResourceUnavailableName:
971 var r = SceneListenerOnResourceUnavailableResponseParams.deserialize( 1003 var r = SceneListenerOnResourceUnavailableResponseParams.deserialize(
972 message.payload); 1004 message.payload);
973 if (!message.header.hasRequestId) { 1005 if (!message.header.hasRequestId) {
974 proxyError("Expected a message with a valid request Id."); 1006 proxyError("Expected a message with a valid request Id.");
975 return; 1007 return;
976 } 1008 }
977 Completer c = completerMap[message.header.requestId]; 1009 Completer c = completerMap[message.header.requestId];
(...skipping 16 matching lines...) Expand all
994 } 1026 }
995 } 1027 }
996 1028
997 @override 1029 @override
998 String toString() { 1030 String toString() {
999 var superString = super.toString(); 1031 var superString = super.toString();
1000 return "_SceneListenerProxyControl($superString)"; 1032 return "_SceneListenerProxyControl($superString)";
1001 } 1033 }
1002 } 1034 }
1003 1035
1004 1036 class SceneListenerProxy
1005 class SceneListenerProxy extends bindings.Proxy 1037 extends bindings.Proxy
1006 implements SceneListener { 1038 implements SceneListener {
1007 SceneListenerProxy.fromEndpoint( 1039 SceneListenerProxy.fromEndpoint(
1008 core.MojoMessagePipeEndpoint endpoint) 1040 core.MojoMessagePipeEndpoint endpoint)
1009 : super(new _SceneListenerProxyControl.fromEndpoint(endpoint)); 1041 : super(new _SceneListenerProxyControl.fromEndpoint(endpoint));
1010 1042
1011 SceneListenerProxy.fromHandle(core.MojoHandle handle) 1043 SceneListenerProxy.fromHandle(core.MojoHandle handle)
1012 : super(new _SceneListenerProxyControl.fromHandle(handle)); 1044 : super(new _SceneListenerProxyControl.fromHandle(handle));
1013 1045
1014 SceneListenerProxy.unbound() 1046 SceneListenerProxy.unbound()
1015 : super(new _SceneListenerProxyControl.unbound()); 1047 : super(new _SceneListenerProxyControl.unbound());
1016 1048
(...skipping 15 matching lines...) Expand all
1032 var params = new _SceneListenerOnResourceUnavailableParams(); 1064 var params = new _SceneListenerOnResourceUnavailableParams();
1033 params.resourceId = resourceId; 1065 params.resourceId = resourceId;
1034 return ctrl.sendMessageWithRequestId( 1066 return ctrl.sendMessageWithRequestId(
1035 params, 1067 params,
1036 _sceneListenerMethodOnResourceUnavailableName, 1068 _sceneListenerMethodOnResourceUnavailableName,
1037 -1, 1069 -1,
1038 bindings.MessageHeader.kMessageExpectsResponse); 1070 bindings.MessageHeader.kMessageExpectsResponse);
1039 } 1071 }
1040 } 1072 }
1041 1073
1042 1074 class _SceneListenerStubControl
1043 class SceneListenerStub extends bindings.Stub { 1075 extends bindings.StubMessageHandler
1076 implements bindings.StubControl<SceneListener> {
1044 SceneListener _impl; 1077 SceneListener _impl;
1045 1078
1046 SceneListenerStub.fromEndpoint( 1079 _SceneListenerStubControl.fromEndpoint(
1047 core.MojoMessagePipeEndpoint endpoint, [SceneListener impl]) 1080 core.MojoMessagePipeEndpoint endpoint, [SceneListener impl])
1048 : super.fromEndpoint(endpoint, autoBegin: impl != null) { 1081 : super.fromEndpoint(endpoint, autoBegin: impl != null) {
1049 _impl = impl; 1082 _impl = impl;
1050 } 1083 }
1051 1084
1052 SceneListenerStub.fromHandle( 1085 _SceneListenerStubControl.fromHandle(
1053 core.MojoHandle handle, [SceneListener impl]) 1086 core.MojoHandle handle, [SceneListener impl])
1054 : super.fromHandle(handle, autoBegin: impl != null) { 1087 : super.fromHandle(handle, autoBegin: impl != null) {
1055 _impl = impl; 1088 _impl = impl;
1056 } 1089 }
1057 1090
1058 SceneListenerStub.unbound([this._impl]) : super.unbound(); 1091 _SceneListenerStubControl.unbound([this._impl]) : super.unbound();
1059
1060 static SceneListenerStub newFromEndpoint(
1061 core.MojoMessagePipeEndpoint endpoint) {
1062 assert(endpoint.setDescription("For SceneListenerStub"));
1063 return new SceneListenerStub.fromEndpoint(endpoint);
1064 }
1065 1092
1066 1093
1067 SceneListenerOnResourceUnavailableResponseParams _sceneListenerOnResourceUnava ilableResponseParamsFactory() { 1094 SceneListenerOnResourceUnavailableResponseParams _sceneListenerOnResourceUnava ilableResponseParamsFactory() {
1068 var result = new SceneListenerOnResourceUnavailableResponseParams(); 1095 var result = new SceneListenerOnResourceUnavailableResponseParams();
1069 return result; 1096 return result;
1070 } 1097 }
1071 1098
1072 dynamic handleMessage(bindings.ServiceMessage message) { 1099 dynamic handleMessage(bindings.ServiceMessage message) {
1073 if (bindings.ControlMessageHandler.isControlMessage(message)) { 1100 if (bindings.ControlMessageHandler.isControlMessage(message)) {
1074 return bindings.ControlMessageHandler.handleMessage(this, 1101 return bindings.ControlMessageHandler.handleMessage(this,
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
1120 } 1147 }
1121 1148
1122 @override 1149 @override
1123 void bind(core.MojoMessagePipeEndpoint endpoint) { 1150 void bind(core.MojoMessagePipeEndpoint endpoint) {
1124 super.bind(endpoint); 1151 super.bind(endpoint);
1125 if (!isOpen && (_impl != null)) { 1152 if (!isOpen && (_impl != null)) {
1126 beginHandlingEvents(); 1153 beginHandlingEvents();
1127 } 1154 }
1128 } 1155 }
1129 1156
1157 @override
1130 String toString() { 1158 String toString() {
1131 var superString = super.toString(); 1159 var superString = super.toString();
1132 return "SceneListenerStub($superString)"; 1160 return "_SceneListenerStubControl($superString)";
1133 } 1161 }
1134 1162
1135 int get version => 0; 1163 int get version => 0;
1136 1164
1137 static service_describer.ServiceDescription _cachedServiceDescription; 1165 static service_describer.ServiceDescription _cachedServiceDescription;
1138 static service_describer.ServiceDescription get serviceDescription { 1166 static service_describer.ServiceDescription get serviceDescription {
1139 if (_cachedServiceDescription == null) { 1167 if (_cachedServiceDescription == null) {
1140 _cachedServiceDescription = new _SceneListenerServiceDescription(); 1168 _cachedServiceDescription = new _SceneListenerServiceDescription();
1141 } 1169 }
1142 return _cachedServiceDescription; 1170 return _cachedServiceDescription;
1143 } 1171 }
1144 } 1172 }
1145 1173
1174 class SceneListenerStub
1175 extends bindings.Stub<SceneListener>
1176 implements SceneListener {
1177 SceneListenerStub.fromEndpoint(
1178 core.MojoMessagePipeEndpoint endpoint, [SceneListener impl])
1179 : super(new _SceneListenerStubControl.fromEndpoint(endpoint, impl));
1180
1181 SceneListenerStub.fromHandle(
1182 core.MojoHandle handle, [SceneListener impl])
1183 : super(new _SceneListenerStubControl.fromHandle(handle, impl));
1184
1185 SceneListenerStub.unbound([SceneListener impl])
1186 : super(new _SceneListenerStubControl.unbound(impl));
1187
1188 static SceneListenerStub newFromEndpoint(
1189 core.MojoMessagePipeEndpoint endpoint) {
1190 assert(endpoint.setDescription("For SceneListenerStub"));
1191 return new SceneListenerStub.fromEndpoint(endpoint);
1192 }
1193
1194 static service_describer.ServiceDescription get serviceDescription =>
1195 _SceneListenerStubControl.serviceDescription;
1196
1197
1198 dynamic onResourceUnavailable(int resourceId,[Function responseFactory = null] ) {
1199 return impl.onResourceUnavailable(resourceId,responseFactory);
1200 }
1201 }
1202
1146 1203
1147 1204
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698