| Index: mojo/dart/packages/mojo_services/lib/mojo/tcp_bound_socket.mojom.dart
|
| diff --git a/mojo/dart/packages/mojo_services/lib/mojo/tcp_bound_socket.mojom.dart b/mojo/dart/packages/mojo_services/lib/mojo/tcp_bound_socket.mojom.dart
|
| index d28f1ce88b29b41e8262cf5146f128a64bcd9aa6..5af9453ad23b24709851b9796bda2ca6f9ef3fda 100644
|
| --- a/mojo/dart/packages/mojo_services/lib/mojo/tcp_bound_socket.mojom.dart
|
| +++ b/mojo/dart/packages/mojo_services/lib/mojo/tcp_bound_socket.mojom.dart
|
| @@ -524,14 +524,19 @@ class TcpBoundSocketProxy implements bindings.ProxyBase {
|
|
|
|
|
| class TcpBoundSocketStub extends bindings.Stub {
|
| - TcpBoundSocket _impl = null;
|
| + TcpBoundSocket _impl;
|
|
|
| TcpBoundSocketStub.fromEndpoint(
|
| - core.MojoMessagePipeEndpoint endpoint, [this._impl])
|
| - : super.fromEndpoint(endpoint);
|
| + core.MojoMessagePipeEndpoint endpoint, [TcpBoundSocket impl])
|
| + : super.fromEndpoint(endpoint, autoBegin: impl != null) {
|
| + _impl = impl;
|
| + }
|
|
|
| - TcpBoundSocketStub.fromHandle(core.MojoHandle handle, [this._impl])
|
| - : super.fromHandle(handle);
|
| + TcpBoundSocketStub.fromHandle(
|
| + core.MojoHandle handle, [TcpBoundSocket impl])
|
| + : super.fromHandle(handle, autoBegin: impl != null) {
|
| + _impl = impl;
|
| + }
|
|
|
| TcpBoundSocketStub.unbound() : super.unbound();
|
|
|
| @@ -559,7 +564,9 @@ class TcpBoundSocketStub 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 _tcpBoundSocketMethodStartListeningName:
|
| var params = _TcpBoundSocketStartListeningParams.deserialize(
|
| @@ -614,10 +621,23 @@ class TcpBoundSocketStub extends bindings.Stub {
|
|
|
| TcpBoundSocket get impl => _impl;
|
| set impl(TcpBoundSocket 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 "TcpBoundSocketStub($superString)";
|
|
|