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

Side by Side Diff: mojo/dart/packages/mojo_services/lib/mojo/gfx/composition/hit_tests.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 hit_tests_mojom; 4 library hit_tests_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_services/mojo/geometry.mojom.dart' as geometry_mojom; 9 import 'package:mojo_services/mojo/geometry.mojom.dart' as geometry_mojom;
10 import 'package:mojo_services/mojo/gfx/composition/scene_token.mojom.dart' as sc ene_token_mojom; 10 import 'package:mojo_services/mojo/gfx/composition/scene_token.mojom.dart' as sc ene_token_mojom;
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 class HitTestBehavior extends bindings.Struct { 73 class HitTestBehavior extends bindings.Struct {
74 static const List<bindings.StructDataHeader> kVersions = const [ 74 static const List<bindings.StructDataHeader> kVersions = const [
75 const bindings.StructDataHeader(24, 0) 75 const bindings.StructDataHeader(24, 0)
76 ]; 76 ];
77 HitTestBehaviorVisibility visibility = new HitTestBehaviorVisibility(0); 77 HitTestBehaviorVisibility visibility = new HitTestBehaviorVisibility(0);
78 bool prune = false; 78 bool prune = false;
79 geometry_mojom.RectF hitRect = null; 79 geometry_mojom.RectF hitRect = null;
80 80
81 HitTestBehavior() : super(kVersions.last.size); 81 HitTestBehavior() : super(kVersions.last.size);
82 82
83 HitTestBehavior.init(
84 HitTestBehaviorVisibility this.visibility,
85 bool this.prune,
86 geometry_mojom.RectF this.hitRect
87 ) : super(kVersions.last.size);
88
83 static HitTestBehavior deserialize(bindings.Message message) { 89 static HitTestBehavior deserialize(bindings.Message message) {
84 var decoder = new bindings.Decoder(message); 90 var decoder = new bindings.Decoder(message);
85 var result = decode(decoder); 91 var result = decode(decoder);
86 if (decoder.excessHandles != null) { 92 if (decoder.excessHandles != null) {
87 decoder.excessHandles.forEach((h) => h.close()); 93 decoder.excessHandles.forEach((h) => h.close());
88 } 94 }
89 return result; 95 return result;
90 } 96 }
91 97
92 static HitTestBehavior decode(bindings.Decoder decoder0) { 98 static HitTestBehavior decode(bindings.Decoder decoder0) {
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 182
177 183
178 class HitTestResult extends bindings.Struct { 184 class HitTestResult extends bindings.Struct {
179 static const List<bindings.StructDataHeader> kVersions = const [ 185 static const List<bindings.StructDataHeader> kVersions = const [
180 const bindings.StructDataHeader(16, 0) 186 const bindings.StructDataHeader(16, 0)
181 ]; 187 ];
182 SceneHit root = null; 188 SceneHit root = null;
183 189
184 HitTestResult() : super(kVersions.last.size); 190 HitTestResult() : super(kVersions.last.size);
185 191
192 HitTestResult.init(
193 SceneHit this.root
194 ) : super(kVersions.last.size);
195
186 static HitTestResult deserialize(bindings.Message message) { 196 static HitTestResult deserialize(bindings.Message message) {
187 var decoder = new bindings.Decoder(message); 197 var decoder = new bindings.Decoder(message);
188 var result = decode(decoder); 198 var result = decode(decoder);
189 if (decoder.excessHandles != null) { 199 if (decoder.excessHandles != null) {
190 decoder.excessHandles.forEach((h) => h.close()); 200 decoder.excessHandles.forEach((h) => h.close());
191 } 201 }
192 return result; 202 return result;
193 } 203 }
194 204
195 static HitTestResult decode(bindings.Decoder decoder0) { 205 static HitTestResult decode(bindings.Decoder decoder0) {
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 class SceneHit extends bindings.Struct { 261 class SceneHit extends bindings.Struct {
252 static const List<bindings.StructDataHeader> kVersions = const [ 262 static const List<bindings.StructDataHeader> kVersions = const [
253 const bindings.StructDataHeader(32, 0) 263 const bindings.StructDataHeader(32, 0)
254 ]; 264 ];
255 scene_token_mojom.SceneToken sceneToken = null; 265 scene_token_mojom.SceneToken sceneToken = null;
256 int sceneVersion = 0; 266 int sceneVersion = 0;
257 List<Hit> hits = null; 267 List<Hit> hits = null;
258 268
259 SceneHit() : super(kVersions.last.size); 269 SceneHit() : super(kVersions.last.size);
260 270
271 SceneHit.init(
272 scene_token_mojom.SceneToken this.sceneToken,
273 int this.sceneVersion,
274 List<Hit> this.hits
275 ) : super(kVersions.last.size);
276
261 static SceneHit deserialize(bindings.Message message) { 277 static SceneHit deserialize(bindings.Message message) {
262 var decoder = new bindings.Decoder(message); 278 var decoder = new bindings.Decoder(message);
263 var result = decode(decoder); 279 var result = decode(decoder);
264 if (decoder.excessHandles != null) { 280 if (decoder.excessHandles != null) {
265 decoder.excessHandles.forEach((h) => h.close()); 281 decoder.excessHandles.forEach((h) => h.close());
266 } 282 }
267 return result; 283 return result;
268 } 284 }
269 285
270 static SceneHit decode(bindings.Decoder decoder0) { 286 static SceneHit decode(bindings.Decoder decoder0) {
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 386
371 class NodeHit extends bindings.Struct { 387 class NodeHit extends bindings.Struct {
372 static const List<bindings.StructDataHeader> kVersions = const [ 388 static const List<bindings.StructDataHeader> kVersions = const [
373 const bindings.StructDataHeader(24, 0) 389 const bindings.StructDataHeader(24, 0)
374 ]; 390 ];
375 int nodeId = 0; 391 int nodeId = 0;
376 geometry_mojom.Transform transform = null; 392 geometry_mojom.Transform transform = null;
377 393
378 NodeHit() : super(kVersions.last.size); 394 NodeHit() : super(kVersions.last.size);
379 395
396 NodeHit.init(
397 int this.nodeId,
398 geometry_mojom.Transform this.transform
399 ) : super(kVersions.last.size);
400
380 static NodeHit deserialize(bindings.Message message) { 401 static NodeHit deserialize(bindings.Message message) {
381 var decoder = new bindings.Decoder(message); 402 var decoder = new bindings.Decoder(message);
382 var result = decode(decoder); 403 var result = decode(decoder);
383 if (decoder.excessHandles != null) { 404 if (decoder.excessHandles != null) {
384 decoder.excessHandles.forEach((h) => h.close()); 405 decoder.excessHandles.forEach((h) => h.close());
385 } 406 }
386 return result; 407 return result;
387 } 408 }
388 409
389 static NodeHit decode(bindings.Decoder decoder0) { 410 static NodeHit decode(bindings.Decoder decoder0) {
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
456 477
457 478
458 class _HitTesterHitTestParams extends bindings.Struct { 479 class _HitTesterHitTestParams extends bindings.Struct {
459 static const List<bindings.StructDataHeader> kVersions = const [ 480 static const List<bindings.StructDataHeader> kVersions = const [
460 const bindings.StructDataHeader(16, 0) 481 const bindings.StructDataHeader(16, 0)
461 ]; 482 ];
462 geometry_mojom.PointF point = null; 483 geometry_mojom.PointF point = null;
463 484
464 _HitTesterHitTestParams() : super(kVersions.last.size); 485 _HitTesterHitTestParams() : super(kVersions.last.size);
465 486
487 _HitTesterHitTestParams.init(
488 geometry_mojom.PointF this.point
489 ) : super(kVersions.last.size);
490
466 static _HitTesterHitTestParams deserialize(bindings.Message message) { 491 static _HitTesterHitTestParams deserialize(bindings.Message message) {
467 var decoder = new bindings.Decoder(message); 492 var decoder = new bindings.Decoder(message);
468 var result = decode(decoder); 493 var result = decode(decoder);
469 if (decoder.excessHandles != null) { 494 if (decoder.excessHandles != null) {
470 decoder.excessHandles.forEach((h) => h.close()); 495 decoder.excessHandles.forEach((h) => h.close());
471 } 496 }
472 return result; 497 return result;
473 } 498 }
474 499
475 static _HitTesterHitTestParams decode(bindings.Decoder decoder0) { 500 static _HitTesterHitTestParams decode(bindings.Decoder decoder0) {
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
529 554
530 555
531 class HitTesterHitTestResponseParams extends bindings.Struct { 556 class HitTesterHitTestResponseParams extends bindings.Struct {
532 static const List<bindings.StructDataHeader> kVersions = const [ 557 static const List<bindings.StructDataHeader> kVersions = const [
533 const bindings.StructDataHeader(16, 0) 558 const bindings.StructDataHeader(16, 0)
534 ]; 559 ];
535 HitTestResult result = null; 560 HitTestResult result = null;
536 561
537 HitTesterHitTestResponseParams() : super(kVersions.last.size); 562 HitTesterHitTestResponseParams() : super(kVersions.last.size);
538 563
564 HitTesterHitTestResponseParams.init(
565 HitTestResult this.result
566 ) : super(kVersions.last.size);
567
539 static HitTesterHitTestResponseParams deserialize(bindings.Message message) { 568 static HitTesterHitTestResponseParams deserialize(bindings.Message message) {
540 var decoder = new bindings.Decoder(message); 569 var decoder = new bindings.Decoder(message);
541 var result = decode(decoder); 570 var result = decode(decoder);
542 if (decoder.excessHandles != null) { 571 if (decoder.excessHandles != null) {
543 decoder.excessHandles.forEach((h) => h.close()); 572 decoder.excessHandles.forEach((h) => h.close());
544 } 573 }
545 return result; 574 return result;
546 } 575 }
547 576
548 static HitTesterHitTestResponseParams decode(bindings.Decoder decoder0) { 577 static HitTesterHitTestResponseParams decode(bindings.Decoder decoder0) {
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
701 default: 730 default:
702 result += "unknown"; 731 result += "unknown";
703 } 732 }
704 result += ": $_data)"; 733 result += ": $_data)";
705 return result; 734 return result;
706 } 735 }
707 } 736 }
708 const int _hitTesterMethodHitTestName = 0; 737 const int _hitTesterMethodHitTestName = 0;
709 738
710 class _HitTesterServiceDescription implements service_describer.ServiceDescripti on { 739 class _HitTesterServiceDescription implements service_describer.ServiceDescripti on {
711 dynamic getTopLevelInterface([Function responseFactory]) => 740 void getTopLevelInterface(Function responder) {
712 responseFactory(null); 741 responder(null);
742 }
713 743
714 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => 744 void getTypeDefinition(String typeKey, Function responder) {
715 responseFactory(null); 745 responder(null);
746 }
716 747
717 dynamic getAllTypeDefinitions([Function responseFactory]) => 748 void getAllTypeDefinitions(Function responder) {
718 responseFactory(null); 749 responder(null);
750 }
719 } 751 }
720 752
721 abstract class HitTester { 753 abstract class HitTester {
722 static const String serviceName = null; 754 static const String serviceName = null;
723 755
724 static service_describer.ServiceDescription _cachedServiceDescription; 756 static service_describer.ServiceDescription _cachedServiceDescription;
725 static service_describer.ServiceDescription get serviceDescription { 757 static service_describer.ServiceDescription get serviceDescription {
726 if (_cachedServiceDescription == null) { 758 if (_cachedServiceDescription == null) {
727 _cachedServiceDescription = new _HitTesterServiceDescription(); 759 _cachedServiceDescription = new _HitTesterServiceDescription();
728 } 760 }
729 return _cachedServiceDescription; 761 return _cachedServiceDescription;
730 } 762 }
731 763
732 static HitTesterProxy connectToService( 764 static HitTesterProxy connectToService(
733 bindings.ServiceConnector s, String url, [String serviceName]) { 765 bindings.ServiceConnector s, String url, [String serviceName]) {
734 HitTesterProxy p = new HitTesterProxy.unbound(); 766 HitTesterProxy p = new HitTesterProxy.unbound();
735 String name = serviceName ?? HitTester.serviceName; 767 String name = serviceName ?? HitTester.serviceName;
736 if ((name == null) || name.isEmpty) { 768 if ((name == null) || name.isEmpty) {
737 throw new core.MojoApiError( 769 throw new core.MojoApiError(
738 "If an interface has no ServiceName, then one must be provided."); 770 "If an interface has no ServiceName, then one must be provided.");
739 } 771 }
740 s.connectToService(url, p, name); 772 s.connectToService(url, p, name);
741 return p; 773 return p;
742 } 774 }
743 dynamic hitTest(geometry_mojom.PointF point,[Function responseFactory = null]) ; 775 void hitTest(geometry_mojom.PointF point,void callback(HitTestResult result));
744 } 776 }
745 777
746 abstract class HitTesterInterface 778 abstract class HitTesterInterface
747 implements bindings.MojoInterface<HitTester>, 779 implements bindings.MojoInterface<HitTester>,
748 HitTester { 780 HitTester {
749 factory HitTesterInterface([HitTester impl]) => 781 factory HitTesterInterface([HitTester impl]) =>
750 new HitTesterStub.unbound(impl); 782 new HitTesterStub.unbound(impl);
751 783
752 factory HitTesterInterface.fromEndpoint( 784 factory HitTesterInterface.fromEndpoint(
753 core.MojoMessagePipeEndpoint endpoint, 785 core.MojoMessagePipeEndpoint endpoint,
(...skipping 29 matching lines...) Expand all
783 815
784 void handleResponse(bindings.ServiceMessage message) { 816 void handleResponse(bindings.ServiceMessage message) {
785 switch (message.header.type) { 817 switch (message.header.type) {
786 case _hitTesterMethodHitTestName: 818 case _hitTesterMethodHitTestName:
787 var r = HitTesterHitTestResponseParams.deserialize( 819 var r = HitTesterHitTestResponseParams.deserialize(
788 message.payload); 820 message.payload);
789 if (!message.header.hasRequestId) { 821 if (!message.header.hasRequestId) {
790 proxyError("Expected a message with a valid request Id."); 822 proxyError("Expected a message with a valid request Id.");
791 return; 823 return;
792 } 824 }
793 Completer c = completerMap[message.header.requestId]; 825 Function callback = callbackMap[message.header.requestId];
794 if (c == null) { 826 if (callback == null) {
795 proxyError( 827 proxyError(
796 "Message had unknown request Id: ${message.header.requestId}"); 828 "Message had unknown request Id: ${message.header.requestId}");
797 return; 829 return;
798 } 830 }
799 completerMap.remove(message.header.requestId); 831 callbackMap.remove(message.header.requestId);
800 if (c.isCompleted) { 832 callback(r.result );
801 proxyError("Response completer already completed");
802 return;
803 }
804 c.complete(r);
805 break; 833 break;
806 default: 834 default:
807 proxyError("Unexpected message type: ${message.header.type}"); 835 proxyError("Unexpected message type: ${message.header.type}");
808 close(immediate: true); 836 close(immediate: true);
809 break; 837 break;
810 } 838 }
811 } 839 }
812 840
813 @override 841 @override
814 String toString() { 842 String toString() {
(...skipping 24 matching lines...) Expand all
839 return newMockedProxy; 867 return newMockedProxy;
840 } 868 }
841 869
842 static HitTesterProxy newFromEndpoint( 870 static HitTesterProxy newFromEndpoint(
843 core.MojoMessagePipeEndpoint endpoint) { 871 core.MojoMessagePipeEndpoint endpoint) {
844 assert(endpoint.setDescription("For HitTesterProxy")); 872 assert(endpoint.setDescription("For HitTesterProxy"));
845 return new HitTesterProxy.fromEndpoint(endpoint); 873 return new HitTesterProxy.fromEndpoint(endpoint);
846 } 874 }
847 875
848 876
849 dynamic hitTest(geometry_mojom.PointF point,[Function responseFactory = null]) { 877 void hitTest(geometry_mojom.PointF point,void callback(HitTestResult result)) {
850 if (impl != null) { 878 if (impl != null) {
851 return new Future(() => impl.hitTest(point,_HitTesterStubControl._hitTeste rHitTestResponseParamsFactory)); 879 impl.hitTest(point,callback);
880 return;
852 } 881 }
853 var params = new _HitTesterHitTestParams(); 882 var params = new _HitTesterHitTestParams();
854 params.point = point; 883 params.point = point;
855 return ctrl.sendMessageWithRequestId( 884 ctrl.sendMessageWithRequestId(
856 params, 885 params,
857 _hitTesterMethodHitTestName, 886 _hitTesterMethodHitTestName,
858 -1, 887 -1,
859 bindings.MessageHeader.kMessageExpectsResponse); 888 bindings.MessageHeader.kMessageExpectsResponse,
889 callback);
860 } 890 }
861 } 891 }
862 892
863 class _HitTesterStubControl 893 class _HitTesterStubControl
864 extends bindings.StubMessageHandler 894 extends bindings.StubMessageHandler
865 implements bindings.StubControl<HitTester> { 895 implements bindings.StubControl<HitTester> {
866 HitTester _impl; 896 HitTester _impl;
867 897
868 _HitTesterStubControl.fromEndpoint( 898 _HitTesterStubControl.fromEndpoint(
869 core.MojoMessagePipeEndpoint endpoint, [HitTester impl]) 899 core.MojoMessagePipeEndpoint endpoint, [HitTester impl])
870 : super.fromEndpoint(endpoint, autoBegin: impl != null) { 900 : super.fromEndpoint(endpoint, autoBegin: impl != null) {
871 _impl = impl; 901 _impl = impl;
872 } 902 }
873 903
874 _HitTesterStubControl.fromHandle( 904 _HitTesterStubControl.fromHandle(
875 core.MojoHandle handle, [HitTester impl]) 905 core.MojoHandle handle, [HitTester impl])
876 : super.fromHandle(handle, autoBegin: impl != null) { 906 : super.fromHandle(handle, autoBegin: impl != null) {
877 _impl = impl; 907 _impl = impl;
878 } 908 }
879 909
880 _HitTesterStubControl.unbound([this._impl]) : super.unbound(); 910 _HitTesterStubControl.unbound([this._impl]) : super.unbound();
881 911
882 String get serviceName => HitTester.serviceName; 912 String get serviceName => HitTester.serviceName;
883 913
884 914
885 static HitTesterHitTestResponseParams _hitTesterHitTestResponseParamsFactory(H itTestResult result) { 915 Function _hitTesterHitTestResponseParamsResponder(
886 var result = new HitTesterHitTestResponseParams(); 916 int requestId) {
887 result.result = result; 917 return (HitTestResult result) {
888 return result; 918 var result = new HitTesterHitTestResponseParams();
919 result.result = result;
920 sendResponse(buildResponseWithId(
921 result,
922 _hitTesterMethodHitTestName,
923 requestId,
924 bindings.MessageHeader.kMessageIsResponse));
925 };
889 } 926 }
890 927
891 dynamic handleMessage(bindings.ServiceMessage message) { 928 void handleMessage(bindings.ServiceMessage message) {
892 if (bindings.ControlMessageHandler.isControlMessage(message)) { 929 if (bindings.ControlMessageHandler.isControlMessage(message)) {
893 return bindings.ControlMessageHandler.handleMessage(this, 930 bindings.ControlMessageHandler.handleMessage(
894 0, 931 this, 0, message);
895 message); 932 return;
896 } 933 }
897 if (_impl == null) { 934 if (_impl == null) {
898 throw new core.MojoApiError("$this has no implementation set"); 935 throw new core.MojoApiError("$this has no implementation set");
899 } 936 }
900 switch (message.header.type) { 937 switch (message.header.type) {
901 case _hitTesterMethodHitTestName: 938 case _hitTesterMethodHitTestName:
902 var params = _HitTesterHitTestParams.deserialize( 939 var params = _HitTesterHitTestParams.deserialize(
903 message.payload); 940 message.payload);
904 var response = _impl.hitTest(params.point,_hitTesterHitTestResponseParam sFactory); 941 _impl.hitTest(params.point, _hitTesterHitTestResponseParamsResponder(mes sage.header.requestId));
905 if (response is Future) {
906 return response.then((response) {
907 if (response != null) {
908 return buildResponseWithId(
909 response,
910 _hitTesterMethodHitTestName,
911 message.header.requestId,
912 bindings.MessageHeader.kMessageIsResponse);
913 }
914 });
915 } else if (response != null) {
916 return buildResponseWithId(
917 response,
918 _hitTesterMethodHitTestName,
919 message.header.requestId,
920 bindings.MessageHeader.kMessageIsResponse);
921 }
922 break; 942 break;
923 default: 943 default:
924 throw new bindings.MojoCodecError("Unexpected message name"); 944 throw new bindings.MojoCodecError("Unexpected message name");
925 break; 945 break;
926 } 946 }
927 return null;
928 } 947 }
929 948
930 HitTester get impl => _impl; 949 HitTester get impl => _impl;
931 set impl(HitTester d) { 950 set impl(HitTester d) {
932 if (d == null) { 951 if (d == null) {
933 throw new core.MojoApiError("$this: Cannot set a null implementation"); 952 throw new core.MojoApiError("$this: Cannot set a null implementation");
934 } 953 }
935 if (isBound && (_impl == null)) { 954 if (isBound && (_impl == null)) {
936 beginHandlingEvents(); 955 beginHandlingEvents();
937 } 956 }
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
971 core.MojoHandle handle, [HitTester impl]) 990 core.MojoHandle handle, [HitTester impl])
972 : super(new _HitTesterStubControl.fromHandle(handle, impl)); 991 : super(new _HitTesterStubControl.fromHandle(handle, impl));
973 992
974 static HitTesterStub newFromEndpoint( 993 static HitTesterStub newFromEndpoint(
975 core.MojoMessagePipeEndpoint endpoint) { 994 core.MojoMessagePipeEndpoint endpoint) {
976 assert(endpoint.setDescription("For HitTesterStub")); 995 assert(endpoint.setDescription("For HitTesterStub"));
977 return new HitTesterStub.fromEndpoint(endpoint); 996 return new HitTesterStub.fromEndpoint(endpoint);
978 } 997 }
979 998
980 999
981 dynamic hitTest(geometry_mojom.PointF point,[Function responseFactory = null]) { 1000 void hitTest(geometry_mojom.PointF point,void callback(HitTestResult result)) {
982 return impl.hitTest(point,responseFactory); 1001 return impl.hitTest(point,callback);
983 } 1002 }
984 } 1003 }
985 1004
986 1005
987 1006
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698