| OLD | NEW |
| 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 sensors_mojom; | 5 library sensors_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 635 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 646 impl.requireVersion(requiredVersion); | 646 impl.requireVersion(requiredVersion); |
| 647 } | 647 } |
| 648 | 648 |
| 649 String toString() { | 649 String toString() { |
| 650 return "SensorListenerProxy($impl)"; | 650 return "SensorListenerProxy($impl)"; |
| 651 } | 651 } |
| 652 } | 652 } |
| 653 | 653 |
| 654 | 654 |
| 655 class SensorListenerStub extends bindings.Stub { | 655 class SensorListenerStub extends bindings.Stub { |
| 656 SensorListener _impl = null; | 656 SensorListener _impl; |
| 657 | 657 |
| 658 SensorListenerStub.fromEndpoint( | 658 SensorListenerStub.fromEndpoint( |
| 659 core.MojoMessagePipeEndpoint endpoint, [this._impl]) | 659 core.MojoMessagePipeEndpoint endpoint, [SensorListener impl]) |
| 660 : super.fromEndpoint(endpoint); | 660 : super.fromEndpoint(endpoint, autoBegin: impl != null) { |
| 661 _impl = impl; |
| 662 } |
| 661 | 663 |
| 662 SensorListenerStub.fromHandle(core.MojoHandle handle, [this._impl]) | 664 SensorListenerStub.fromHandle( |
| 663 : super.fromHandle(handle); | 665 core.MojoHandle handle, [SensorListener impl]) |
| 666 : super.fromHandle(handle, autoBegin: impl != null) { |
| 667 _impl = impl; |
| 668 } |
| 664 | 669 |
| 665 SensorListenerStub.unbound() : super.unbound(); | 670 SensorListenerStub.unbound() : super.unbound(); |
| 666 | 671 |
| 667 static SensorListenerStub newFromEndpoint( | 672 static SensorListenerStub newFromEndpoint( |
| 668 core.MojoMessagePipeEndpoint endpoint) { | 673 core.MojoMessagePipeEndpoint endpoint) { |
| 669 assert(endpoint.setDescription("For SensorListenerStub")); | 674 assert(endpoint.setDescription("For SensorListenerStub")); |
| 670 return new SensorListenerStub.fromEndpoint(endpoint); | 675 return new SensorListenerStub.fromEndpoint(endpoint); |
| 671 } | 676 } |
| 672 | 677 |
| 673 | 678 |
| 674 | 679 |
| 675 dynamic handleMessage(bindings.ServiceMessage message) { | 680 dynamic handleMessage(bindings.ServiceMessage message) { |
| 676 if (bindings.ControlMessageHandler.isControlMessage(message)) { | 681 if (bindings.ControlMessageHandler.isControlMessage(message)) { |
| 677 return bindings.ControlMessageHandler.handleMessage(this, | 682 return bindings.ControlMessageHandler.handleMessage(this, |
| 678 0, | 683 0, |
| 679 message); | 684 message); |
| 680 } | 685 } |
| 681 assert(_impl != null); | 686 if (_impl == null) { |
| 687 throw new core.MojoApiError("$this has no implementation set"); |
| 688 } |
| 682 switch (message.header.type) { | 689 switch (message.header.type) { |
| 683 case _sensorListenerMethodOnAccuracyChangedName: | 690 case _sensorListenerMethodOnAccuracyChangedName: |
| 684 var params = _SensorListenerOnAccuracyChangedParams.deserialize( | 691 var params = _SensorListenerOnAccuracyChangedParams.deserialize( |
| 685 message.payload); | 692 message.payload); |
| 686 _impl.onAccuracyChanged(params.accuracy); | 693 _impl.onAccuracyChanged(params.accuracy); |
| 687 break; | 694 break; |
| 688 case _sensorListenerMethodOnSensorChangedName: | 695 case _sensorListenerMethodOnSensorChangedName: |
| 689 var params = _SensorListenerOnSensorChangedParams.deserialize( | 696 var params = _SensorListenerOnSensorChangedParams.deserialize( |
| 690 message.payload); | 697 message.payload); |
| 691 _impl.onSensorChanged(params.data); | 698 _impl.onSensorChanged(params.data); |
| 692 break; | 699 break; |
| 693 default: | 700 default: |
| 694 throw new bindings.MojoCodecError("Unexpected message name"); | 701 throw new bindings.MojoCodecError("Unexpected message name"); |
| 695 break; | 702 break; |
| 696 } | 703 } |
| 697 return null; | 704 return null; |
| 698 } | 705 } |
| 699 | 706 |
| 700 SensorListener get impl => _impl; | 707 SensorListener get impl => _impl; |
| 701 set impl(SensorListener d) { | 708 set impl(SensorListener d) { |
| 702 assert(_impl == null); | 709 if (d == null) { |
| 710 throw new core.MojoApiError("$this: Cannot set a null implementation"); |
| 711 } |
| 712 if (isBound && (_impl == null)) { |
| 713 beginHandlingEvents(); |
| 714 } |
| 703 _impl = d; | 715 _impl = d; |
| 704 } | 716 } |
| 705 | 717 |
| 718 @override |
| 719 void bind(core.MojoMessagePipeEndpoint endpoint) { |
| 720 super.bind(endpoint); |
| 721 if (!isOpen && (_impl != null)) { |
| 722 beginHandlingEvents(); |
| 723 } |
| 724 } |
| 725 |
| 706 String toString() { | 726 String toString() { |
| 707 var superString = super.toString(); | 727 var superString = super.toString(); |
| 708 return "SensorListenerStub($superString)"; | 728 return "SensorListenerStub($superString)"; |
| 709 } | 729 } |
| 710 | 730 |
| 711 int get version => 0; | 731 int get version => 0; |
| 712 | 732 |
| 713 static service_describer.ServiceDescription _cachedServiceDescription; | 733 static service_describer.ServiceDescription _cachedServiceDescription; |
| 714 static service_describer.ServiceDescription get serviceDescription { | 734 static service_describer.ServiceDescription get serviceDescription { |
| 715 if (_cachedServiceDescription == null) { | 735 if (_cachedServiceDescription == null) { |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 842 impl.requireVersion(requiredVersion); | 862 impl.requireVersion(requiredVersion); |
| 843 } | 863 } |
| 844 | 864 |
| 845 String toString() { | 865 String toString() { |
| 846 return "SensorServiceProxy($impl)"; | 866 return "SensorServiceProxy($impl)"; |
| 847 } | 867 } |
| 848 } | 868 } |
| 849 | 869 |
| 850 | 870 |
| 851 class SensorServiceStub extends bindings.Stub { | 871 class SensorServiceStub extends bindings.Stub { |
| 852 SensorService _impl = null; | 872 SensorService _impl; |
| 853 | 873 |
| 854 SensorServiceStub.fromEndpoint( | 874 SensorServiceStub.fromEndpoint( |
| 855 core.MojoMessagePipeEndpoint endpoint, [this._impl]) | 875 core.MojoMessagePipeEndpoint endpoint, [SensorService impl]) |
| 856 : super.fromEndpoint(endpoint); | 876 : super.fromEndpoint(endpoint, autoBegin: impl != null) { |
| 877 _impl = impl; |
| 878 } |
| 857 | 879 |
| 858 SensorServiceStub.fromHandle(core.MojoHandle handle, [this._impl]) | 880 SensorServiceStub.fromHandle( |
| 859 : super.fromHandle(handle); | 881 core.MojoHandle handle, [SensorService impl]) |
| 882 : super.fromHandle(handle, autoBegin: impl != null) { |
| 883 _impl = impl; |
| 884 } |
| 860 | 885 |
| 861 SensorServiceStub.unbound() : super.unbound(); | 886 SensorServiceStub.unbound() : super.unbound(); |
| 862 | 887 |
| 863 static SensorServiceStub newFromEndpoint( | 888 static SensorServiceStub newFromEndpoint( |
| 864 core.MojoMessagePipeEndpoint endpoint) { | 889 core.MojoMessagePipeEndpoint endpoint) { |
| 865 assert(endpoint.setDescription("For SensorServiceStub")); | 890 assert(endpoint.setDescription("For SensorServiceStub")); |
| 866 return new SensorServiceStub.fromEndpoint(endpoint); | 891 return new SensorServiceStub.fromEndpoint(endpoint); |
| 867 } | 892 } |
| 868 | 893 |
| 869 | 894 |
| 870 | 895 |
| 871 dynamic handleMessage(bindings.ServiceMessage message) { | 896 dynamic handleMessage(bindings.ServiceMessage message) { |
| 872 if (bindings.ControlMessageHandler.isControlMessage(message)) { | 897 if (bindings.ControlMessageHandler.isControlMessage(message)) { |
| 873 return bindings.ControlMessageHandler.handleMessage(this, | 898 return bindings.ControlMessageHandler.handleMessage(this, |
| 874 0, | 899 0, |
| 875 message); | 900 message); |
| 876 } | 901 } |
| 877 assert(_impl != null); | 902 if (_impl == null) { |
| 903 throw new core.MojoApiError("$this has no implementation set"); |
| 904 } |
| 878 switch (message.header.type) { | 905 switch (message.header.type) { |
| 879 case _sensorServiceMethodAddListenerName: | 906 case _sensorServiceMethodAddListenerName: |
| 880 var params = _SensorServiceAddListenerParams.deserialize( | 907 var params = _SensorServiceAddListenerParams.deserialize( |
| 881 message.payload); | 908 message.payload); |
| 882 _impl.addListener(params.type, params.listener); | 909 _impl.addListener(params.type, params.listener); |
| 883 break; | 910 break; |
| 884 default: | 911 default: |
| 885 throw new bindings.MojoCodecError("Unexpected message name"); | 912 throw new bindings.MojoCodecError("Unexpected message name"); |
| 886 break; | 913 break; |
| 887 } | 914 } |
| 888 return null; | 915 return null; |
| 889 } | 916 } |
| 890 | 917 |
| 891 SensorService get impl => _impl; | 918 SensorService get impl => _impl; |
| 892 set impl(SensorService d) { | 919 set impl(SensorService d) { |
| 893 assert(_impl == null); | 920 if (d == null) { |
| 921 throw new core.MojoApiError("$this: Cannot set a null implementation"); |
| 922 } |
| 923 if (isBound && (_impl == null)) { |
| 924 beginHandlingEvents(); |
| 925 } |
| 894 _impl = d; | 926 _impl = d; |
| 895 } | 927 } |
| 896 | 928 |
| 929 @override |
| 930 void bind(core.MojoMessagePipeEndpoint endpoint) { |
| 931 super.bind(endpoint); |
| 932 if (!isOpen && (_impl != null)) { |
| 933 beginHandlingEvents(); |
| 934 } |
| 935 } |
| 936 |
| 897 String toString() { | 937 String toString() { |
| 898 var superString = super.toString(); | 938 var superString = super.toString(); |
| 899 return "SensorServiceStub($superString)"; | 939 return "SensorServiceStub($superString)"; |
| 900 } | 940 } |
| 901 | 941 |
| 902 int get version => 0; | 942 int get version => 0; |
| 903 | 943 |
| 904 static service_describer.ServiceDescription _cachedServiceDescription; | 944 static service_describer.ServiceDescription _cachedServiceDescription; |
| 905 static service_describer.ServiceDescription get serviceDescription { | 945 static service_describer.ServiceDescription get serviceDescription { |
| 906 if (_cachedServiceDescription == null) { | 946 if (_cachedServiceDescription == null) { |
| 907 _cachedServiceDescription = new _SensorServiceServiceDescription(); | 947 _cachedServiceDescription = new _SensorServiceServiceDescription(); |
| 908 } | 948 } |
| 909 return _cachedServiceDescription; | 949 return _cachedServiceDescription; |
| 910 } | 950 } |
| 911 } | 951 } |
| 912 | 952 |
| 913 | 953 |
| 914 | 954 |
| OLD | NEW |