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

Side by Side Diff: mojo/dart/packages/mojo_services/lib/sensors/sensors.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 sensors_mojom; 4 library sensors_mojom;
5 import 'dart:async'; 5 import 'dart:async';
6 import 'package:mojo/bindings.dart' as bindings; 6 import 'package:mojo/bindings.dart' as bindings;
7 import 'package:mojo/core.dart' as core; 7 import 'package:mojo/core.dart' as core;
8 import 'package:mojo/mojo/bindings/types/service_describer.mojom.dart' as servic e_describer; 8 import 'package:mojo/mojo/bindings/types/service_describer.mojom.dart' as servic e_describer;
9 9
10 class SensorType extends bindings.MojoEnum { 10 class SensorType extends bindings.MojoEnum {
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 class SensorData extends bindings.Struct { 183 class SensorData extends bindings.Struct {
184 static const List<bindings.StructDataHeader> kVersions = const [ 184 static const List<bindings.StructDataHeader> kVersions = const [
185 const bindings.StructDataHeader(32, 0) 185 const bindings.StructDataHeader(32, 0)
186 ]; 186 ];
187 int accuracy = 0; 187 int accuracy = 0;
188 int timeStamp = 0; 188 int timeStamp = 0;
189 List<double> values = null; 189 List<double> values = null;
190 190
191 SensorData() : super(kVersions.last.size); 191 SensorData() : super(kVersions.last.size);
192 192
193 SensorData.init(
194 int this.accuracy,
195 int this.timeStamp,
196 List<double> this.values
197 ) : super(kVersions.last.size);
198
193 static SensorData deserialize(bindings.Message message) { 199 static SensorData deserialize(bindings.Message message) {
194 var decoder = new bindings.Decoder(message); 200 var decoder = new bindings.Decoder(message);
195 var result = decode(decoder); 201 var result = decode(decoder);
196 if (decoder.excessHandles != null) { 202 if (decoder.excessHandles != null) {
197 decoder.excessHandles.forEach((h) => h.close()); 203 decoder.excessHandles.forEach((h) => h.close());
198 } 204 }
199 return result; 205 return result;
200 } 206 }
201 207
202 static SensorData decode(bindings.Decoder decoder0) { 208 static SensorData decode(bindings.Decoder decoder0) {
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 287
282 288
283 class _SensorListenerOnAccuracyChangedParams extends bindings.Struct { 289 class _SensorListenerOnAccuracyChangedParams extends bindings.Struct {
284 static const List<bindings.StructDataHeader> kVersions = const [ 290 static const List<bindings.StructDataHeader> kVersions = const [
285 const bindings.StructDataHeader(16, 0) 291 const bindings.StructDataHeader(16, 0)
286 ]; 292 ];
287 int accuracy = 0; 293 int accuracy = 0;
288 294
289 _SensorListenerOnAccuracyChangedParams() : super(kVersions.last.size); 295 _SensorListenerOnAccuracyChangedParams() : super(kVersions.last.size);
290 296
297 _SensorListenerOnAccuracyChangedParams.init(
298 int this.accuracy
299 ) : super(kVersions.last.size);
300
291 static _SensorListenerOnAccuracyChangedParams deserialize(bindings.Message mes sage) { 301 static _SensorListenerOnAccuracyChangedParams deserialize(bindings.Message mes sage) {
292 var decoder = new bindings.Decoder(message); 302 var decoder = new bindings.Decoder(message);
293 var result = decode(decoder); 303 var result = decode(decoder);
294 if (decoder.excessHandles != null) { 304 if (decoder.excessHandles != null) {
295 decoder.excessHandles.forEach((h) => h.close()); 305 decoder.excessHandles.forEach((h) => h.close());
296 } 306 }
297 return result; 307 return result;
298 } 308 }
299 309
300 static _SensorListenerOnAccuracyChangedParams decode(bindings.Decoder decoder0 ) { 310 static _SensorListenerOnAccuracyChangedParams decode(bindings.Decoder decoder0 ) {
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 363
354 364
355 class _SensorListenerOnSensorChangedParams extends bindings.Struct { 365 class _SensorListenerOnSensorChangedParams extends bindings.Struct {
356 static const List<bindings.StructDataHeader> kVersions = const [ 366 static const List<bindings.StructDataHeader> kVersions = const [
357 const bindings.StructDataHeader(16, 0) 367 const bindings.StructDataHeader(16, 0)
358 ]; 368 ];
359 SensorData data = null; 369 SensorData data = null;
360 370
361 _SensorListenerOnSensorChangedParams() : super(kVersions.last.size); 371 _SensorListenerOnSensorChangedParams() : super(kVersions.last.size);
362 372
373 _SensorListenerOnSensorChangedParams.init(
374 SensorData this.data
375 ) : super(kVersions.last.size);
376
363 static _SensorListenerOnSensorChangedParams deserialize(bindings.Message messa ge) { 377 static _SensorListenerOnSensorChangedParams deserialize(bindings.Message messa ge) {
364 var decoder = new bindings.Decoder(message); 378 var decoder = new bindings.Decoder(message);
365 var result = decode(decoder); 379 var result = decode(decoder);
366 if (decoder.excessHandles != null) { 380 if (decoder.excessHandles != null) {
367 decoder.excessHandles.forEach((h) => h.close()); 381 decoder.excessHandles.forEach((h) => h.close());
368 } 382 }
369 return result; 383 return result;
370 } 384 }
371 385
372 static _SensorListenerOnSensorChangedParams decode(bindings.Decoder decoder0) { 386 static _SensorListenerOnSensorChangedParams decode(bindings.Decoder decoder0) {
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 441
428 class _SensorServiceAddListenerParams extends bindings.Struct { 442 class _SensorServiceAddListenerParams extends bindings.Struct {
429 static const List<bindings.StructDataHeader> kVersions = const [ 443 static const List<bindings.StructDataHeader> kVersions = const [
430 const bindings.StructDataHeader(24, 0) 444 const bindings.StructDataHeader(24, 0)
431 ]; 445 ];
432 SensorType type = null; 446 SensorType type = null;
433 SensorListenerInterface listener = null; 447 SensorListenerInterface listener = null;
434 448
435 _SensorServiceAddListenerParams() : super(kVersions.last.size); 449 _SensorServiceAddListenerParams() : super(kVersions.last.size);
436 450
451 _SensorServiceAddListenerParams.init(
452 SensorType this.type,
453 SensorListenerInterface this.listener
454 ) : super(kVersions.last.size);
455
437 static _SensorServiceAddListenerParams deserialize(bindings.Message message) { 456 static _SensorServiceAddListenerParams deserialize(bindings.Message message) {
438 var decoder = new bindings.Decoder(message); 457 var decoder = new bindings.Decoder(message);
439 var result = decode(decoder); 458 var result = decode(decoder);
440 if (decoder.excessHandles != null) { 459 if (decoder.excessHandles != null) {
441 decoder.excessHandles.forEach((h) => h.close()); 460 decoder.excessHandles.forEach((h) => h.close());
442 } 461 }
443 return result; 462 return result;
444 } 463 }
445 464
446 static _SensorServiceAddListenerParams decode(bindings.Decoder decoder0) { 465 static _SensorServiceAddListenerParams decode(bindings.Decoder decoder0) {
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
509 Map toJson() { 528 Map toJson() {
510 throw new bindings.MojoCodecError( 529 throw new bindings.MojoCodecError(
511 'Object containing handles cannot be encoded to JSON.'); 530 'Object containing handles cannot be encoded to JSON.');
512 } 531 }
513 } 532 }
514 533
515 const int _sensorListenerMethodOnAccuracyChangedName = 0; 534 const int _sensorListenerMethodOnAccuracyChangedName = 0;
516 const int _sensorListenerMethodOnSensorChangedName = 1; 535 const int _sensorListenerMethodOnSensorChangedName = 1;
517 536
518 class _SensorListenerServiceDescription implements service_describer.ServiceDesc ription { 537 class _SensorListenerServiceDescription implements service_describer.ServiceDesc ription {
519 dynamic getTopLevelInterface([Function responseFactory]) => 538 void getTopLevelInterface(Function responder) {
520 responseFactory(null); 539 responder(null);
540 }
521 541
522 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => 542 void getTypeDefinition(String typeKey, Function responder) {
523 responseFactory(null); 543 responder(null);
544 }
524 545
525 dynamic getAllTypeDefinitions([Function responseFactory]) => 546 void getAllTypeDefinitions(Function responder) {
526 responseFactory(null); 547 responder(null);
548 }
527 } 549 }
528 550
529 abstract class SensorListener { 551 abstract class SensorListener {
530 static const String serviceName = null; 552 static const String serviceName = null;
531 553
532 static service_describer.ServiceDescription _cachedServiceDescription; 554 static service_describer.ServiceDescription _cachedServiceDescription;
533 static service_describer.ServiceDescription get serviceDescription { 555 static service_describer.ServiceDescription get serviceDescription {
534 if (_cachedServiceDescription == null) { 556 if (_cachedServiceDescription == null) {
535 _cachedServiceDescription = new _SensorListenerServiceDescription(); 557 _cachedServiceDescription = new _SensorListenerServiceDescription();
536 } 558 }
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
681 : super.fromHandle(handle, autoBegin: impl != null) { 703 : super.fromHandle(handle, autoBegin: impl != null) {
682 _impl = impl; 704 _impl = impl;
683 } 705 }
684 706
685 _SensorListenerStubControl.unbound([this._impl]) : super.unbound(); 707 _SensorListenerStubControl.unbound([this._impl]) : super.unbound();
686 708
687 String get serviceName => SensorListener.serviceName; 709 String get serviceName => SensorListener.serviceName;
688 710
689 711
690 712
691 dynamic handleMessage(bindings.ServiceMessage message) { 713 void handleMessage(bindings.ServiceMessage message) {
692 if (bindings.ControlMessageHandler.isControlMessage(message)) { 714 if (bindings.ControlMessageHandler.isControlMessage(message)) {
693 return bindings.ControlMessageHandler.handleMessage(this, 715 bindings.ControlMessageHandler.handleMessage(
694 0, 716 this, 0, message);
695 message); 717 return;
696 } 718 }
697 if (_impl == null) { 719 if (_impl == null) {
698 throw new core.MojoApiError("$this has no implementation set"); 720 throw new core.MojoApiError("$this has no implementation set");
699 } 721 }
700 switch (message.header.type) { 722 switch (message.header.type) {
701 case _sensorListenerMethodOnAccuracyChangedName: 723 case _sensorListenerMethodOnAccuracyChangedName:
702 var params = _SensorListenerOnAccuracyChangedParams.deserialize( 724 var params = _SensorListenerOnAccuracyChangedParams.deserialize(
703 message.payload); 725 message.payload);
704 _impl.onAccuracyChanged(params.accuracy); 726 _impl.onAccuracyChanged(params.accuracy);
705 break; 727 break;
706 case _sensorListenerMethodOnSensorChangedName: 728 case _sensorListenerMethodOnSensorChangedName:
707 var params = _SensorListenerOnSensorChangedParams.deserialize( 729 var params = _SensorListenerOnSensorChangedParams.deserialize(
708 message.payload); 730 message.payload);
709 _impl.onSensorChanged(params.data); 731 _impl.onSensorChanged(params.data);
710 break; 732 break;
711 default: 733 default:
712 throw new bindings.MojoCodecError("Unexpected message name"); 734 throw new bindings.MojoCodecError("Unexpected message name");
713 break; 735 break;
714 } 736 }
715 return null;
716 } 737 }
717 738
718 SensorListener get impl => _impl; 739 SensorListener get impl => _impl;
719 set impl(SensorListener d) { 740 set impl(SensorListener d) {
720 if (d == null) { 741 if (d == null) {
721 throw new core.MojoApiError("$this: Cannot set a null implementation"); 742 throw new core.MojoApiError("$this: Cannot set a null implementation");
722 } 743 }
723 if (isBound && (_impl == null)) { 744 if (isBound && (_impl == null)) {
724 beginHandlingEvents(); 745 beginHandlingEvents();
725 } 746 }
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
770 return impl.onAccuracyChanged(accuracy); 791 return impl.onAccuracyChanged(accuracy);
771 } 792 }
772 void onSensorChanged(SensorData data) { 793 void onSensorChanged(SensorData data) {
773 return impl.onSensorChanged(data); 794 return impl.onSensorChanged(data);
774 } 795 }
775 } 796 }
776 797
777 const int _sensorServiceMethodAddListenerName = 0; 798 const int _sensorServiceMethodAddListenerName = 0;
778 799
779 class _SensorServiceServiceDescription implements service_describer.ServiceDescr iption { 800 class _SensorServiceServiceDescription implements service_describer.ServiceDescr iption {
780 dynamic getTopLevelInterface([Function responseFactory]) => 801 void getTopLevelInterface(Function responder) {
781 responseFactory(null); 802 responder(null);
803 }
782 804
783 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => 805 void getTypeDefinition(String typeKey, Function responder) {
784 responseFactory(null); 806 responder(null);
807 }
785 808
786 dynamic getAllTypeDefinitions([Function responseFactory]) => 809 void getAllTypeDefinitions(Function responder) {
787 responseFactory(null); 810 responder(null);
811 }
788 } 812 }
789 813
790 abstract class SensorService { 814 abstract class SensorService {
791 static const String serviceName = "sensors::SensorService"; 815 static const String serviceName = "sensors::SensorService";
792 816
793 static service_describer.ServiceDescription _cachedServiceDescription; 817 static service_describer.ServiceDescription _cachedServiceDescription;
794 static service_describer.ServiceDescription get serviceDescription { 818 static service_describer.ServiceDescription get serviceDescription {
795 if (_cachedServiceDescription == null) { 819 if (_cachedServiceDescription == null) {
796 _cachedServiceDescription = new _SensorServiceServiceDescription(); 820 _cachedServiceDescription = new _SensorServiceServiceDescription();
797 } 821 }
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
928 : super.fromHandle(handle, autoBegin: impl != null) { 952 : super.fromHandle(handle, autoBegin: impl != null) {
929 _impl = impl; 953 _impl = impl;
930 } 954 }
931 955
932 _SensorServiceStubControl.unbound([this._impl]) : super.unbound(); 956 _SensorServiceStubControl.unbound([this._impl]) : super.unbound();
933 957
934 String get serviceName => SensorService.serviceName; 958 String get serviceName => SensorService.serviceName;
935 959
936 960
937 961
938 dynamic handleMessage(bindings.ServiceMessage message) { 962 void handleMessage(bindings.ServiceMessage message) {
939 if (bindings.ControlMessageHandler.isControlMessage(message)) { 963 if (bindings.ControlMessageHandler.isControlMessage(message)) {
940 return bindings.ControlMessageHandler.handleMessage(this, 964 bindings.ControlMessageHandler.handleMessage(
941 0, 965 this, 0, message);
942 message); 966 return;
943 } 967 }
944 if (_impl == null) { 968 if (_impl == null) {
945 throw new core.MojoApiError("$this has no implementation set"); 969 throw new core.MojoApiError("$this has no implementation set");
946 } 970 }
947 switch (message.header.type) { 971 switch (message.header.type) {
948 case _sensorServiceMethodAddListenerName: 972 case _sensorServiceMethodAddListenerName:
949 var params = _SensorServiceAddListenerParams.deserialize( 973 var params = _SensorServiceAddListenerParams.deserialize(
950 message.payload); 974 message.payload);
951 _impl.addListener(params.type, params.listener); 975 _impl.addListener(params.type, params.listener);
952 break; 976 break;
953 default: 977 default:
954 throw new bindings.MojoCodecError("Unexpected message name"); 978 throw new bindings.MojoCodecError("Unexpected message name");
955 break; 979 break;
956 } 980 }
957 return null;
958 } 981 }
959 982
960 SensorService get impl => _impl; 983 SensorService get impl => _impl;
961 set impl(SensorService d) { 984 set impl(SensorService d) {
962 if (d == null) { 985 if (d == null) {
963 throw new core.MojoApiError("$this: Cannot set a null implementation"); 986 throw new core.MojoApiError("$this: Cannot set a null implementation");
964 } 987 }
965 if (isBound && (_impl == null)) { 988 if (isBound && (_impl == null)) {
966 beginHandlingEvents(); 989 beginHandlingEvents();
967 } 990 }
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
1008 } 1031 }
1009 1032
1010 1033
1011 void addListener(SensorType type, SensorListenerInterface listener) { 1034 void addListener(SensorType type, SensorListenerInterface listener) {
1012 return impl.addListener(type, listener); 1035 return impl.addListener(type, listener);
1013 } 1036 }
1014 } 1037 }
1015 1038
1016 1039
1017 1040
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698