| Index: mojo/dart/packages/mojo_services/lib/mojo/media/media_sink.mojom.dart
|
| diff --git a/mojo/dart/packages/mojo_services/lib/mojo/media/media_sink.mojom.dart b/mojo/dart/packages/mojo_services/lib/mojo/media/media_sink.mojom.dart
|
| index be2f76b1dac21828e05055cecfb100a9b3766497..117e787faf627acdb508a61050fdca5d7c73d18f 100644
|
| --- a/mojo/dart/packages/mojo_services/lib/mojo/media/media_sink.mojom.dart
|
| +++ b/mojo/dart/packages/mojo_services/lib/mojo/media/media_sink.mojom.dart
|
| @@ -630,14 +630,19 @@ class MediaSinkProxy implements bindings.ProxyBase {
|
|
|
|
|
| class MediaSinkStub extends bindings.Stub {
|
| - MediaSink _impl = null;
|
| + MediaSink _impl;
|
|
|
| MediaSinkStub.fromEndpoint(
|
| - core.MojoMessagePipeEndpoint endpoint, [this._impl])
|
| - : super.fromEndpoint(endpoint);
|
| + core.MojoMessagePipeEndpoint endpoint, [MediaSink impl])
|
| + : super.fromEndpoint(endpoint, autoBegin: impl != null) {
|
| + _impl = impl;
|
| + }
|
|
|
| - MediaSinkStub.fromHandle(core.MojoHandle handle, [this._impl])
|
| - : super.fromHandle(handle);
|
| + MediaSinkStub.fromHandle(
|
| + core.MojoHandle handle, [MediaSink impl])
|
| + : super.fromHandle(handle, autoBegin: impl != null) {
|
| + _impl = impl;
|
| + }
|
|
|
| MediaSinkStub.unbound() : super.unbound();
|
|
|
| @@ -661,7 +666,9 @@ class MediaSinkStub 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 _mediaSinkMethodGetConsumerName:
|
| var params = _MediaSinkGetConsumerParams.deserialize(
|
| @@ -705,10 +712,23 @@ class MediaSinkStub extends bindings.Stub {
|
|
|
| MediaSink get impl => _impl;
|
| set impl(MediaSink 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 "MediaSinkStub($superString)";
|
|
|