| Index: mojo/dart/packages/mojo_services/lib/mojo/sharing.mojom.dart
|
| diff --git a/mojo/dart/packages/mojo_services/lib/mojo/sharing.mojom.dart b/mojo/dart/packages/mojo_services/lib/mojo/sharing.mojom.dart
|
| index 8ad902b68c16eb500a9f23f4b9a2062342d65e25..441af33461b4a15c89486850e7feced44e07fde2 100644
|
| --- a/mojo/dart/packages/mojo_services/lib/mojo/sharing.mojom.dart
|
| +++ b/mojo/dart/packages/mojo_services/lib/mojo/sharing.mojom.dart
|
| @@ -210,14 +210,19 @@ class SharingServiceProxy implements bindings.ProxyBase {
|
|
|
|
|
| class SharingServiceStub extends bindings.Stub {
|
| - SharingService _impl = null;
|
| + SharingService _impl;
|
|
|
| SharingServiceStub.fromEndpoint(
|
| - core.MojoMessagePipeEndpoint endpoint, [this._impl])
|
| - : super.fromEndpoint(endpoint);
|
| + core.MojoMessagePipeEndpoint endpoint, [SharingService impl])
|
| + : super.fromEndpoint(endpoint, autoBegin: impl != null) {
|
| + _impl = impl;
|
| + }
|
|
|
| - SharingServiceStub.fromHandle(core.MojoHandle handle, [this._impl])
|
| - : super.fromHandle(handle);
|
| + SharingServiceStub.fromHandle(
|
| + core.MojoHandle handle, [SharingService impl])
|
| + : super.fromHandle(handle, autoBegin: impl != null) {
|
| + _impl = impl;
|
| + }
|
|
|
| SharingServiceStub.unbound() : super.unbound();
|
|
|
| @@ -235,7 +240,9 @@ class SharingServiceStub extends bindings.Stub {
|
| 0,
|
| message);
|
| }
|
| - assert(_impl != null);
|
| + if (_impl == null) {
|
| + throw new core.MojoApiError("$this has no implementation set");
|
| + }
|
| switch (message.header.type) {
|
| case _sharingServiceMethodShareTextName:
|
| var params = _SharingServiceShareTextParams.deserialize(
|
| @@ -251,10 +258,23 @@ class SharingServiceStub extends bindings.Stub {
|
|
|
| SharingService get impl => _impl;
|
| set impl(SharingService d) {
|
| - assert(_impl == null);
|
| + if (d == null) {
|
| + throw new core.MojoApiError("$this: Cannot set a null implementation");
|
| + }
|
| + if (isBound && (_impl == null)) {
|
| + beginHandlingEvents();
|
| + }
|
| _impl = d;
|
| }
|
|
|
| + @override
|
| + void bind(core.MojoMessagePipeEndpoint endpoint) {
|
| + super.bind(endpoint);
|
| + if (!isOpen && (_impl != null)) {
|
| + beginHandlingEvents();
|
| + }
|
| + }
|
| +
|
| String toString() {
|
| var superString = super.toString();
|
| return "SharingServiceStub($superString)";
|
|
|