Index: mojo/dart/packages/_mojo_for_test_only/lib/test/echo_service.mojom.dart |
diff --git a/mojo/dart/packages/_mojo_for_test_only/lib/test/echo_service.mojom.dart b/mojo/dart/packages/_mojo_for_test_only/lib/test/echo_service.mojom.dart |
index 0a3846a3dd6027800dd2b46d2038356ddd0bc0dc..d953cd5a777acc68d0a6c25c6e549ae54fbc1e6c 100644 |
--- a/mojo/dart/packages/_mojo_for_test_only/lib/test/echo_service.mojom.dart |
+++ b/mojo/dart/packages/_mojo_for_test_only/lib/test/echo_service.mojom.dart |
@@ -453,15 +453,53 @@ class _EchoServiceServiceDescription implements service_describer.ServiceDescrip |
abstract class EchoService { |
static const String serviceName = "test::EchoService"; |
+ |
+ static service_describer.ServiceDescription _cachedServiceDescription; |
+ static service_describer.ServiceDescription get serviceDescription { |
+ if (_cachedServiceDescription == null) { |
+ _cachedServiceDescription = new _EchoServiceServiceDescription(); |
+ } |
+ return _cachedServiceDescription; |
+ } |
+ |
+ static EchoServiceProxy connectToService( |
+ bindings.ServiceConnector s, String url, [String serviceName]) { |
+ EchoServiceProxy p = new EchoServiceProxy.unbound(); |
+ String name = serviceName ?? EchoService.serviceName; |
+ if ((name == null) || name.isEmpty) { |
+ throw new core.MojoApiError( |
+ "If an interface has no ServiceName, then one must be provided."); |
+ } |
+ s.connectToService(url, p, name); |
+ return p; |
+ } |
dynamic echoString(String value,[Function responseFactory = null]); |
dynamic delayedEchoString(String value,int millis,[Function responseFactory = null]); |
void swap(); |
void quit(); |
} |
+abstract class EchoServiceInterface |
+ implements bindings.MojoInterface<EchoService>, |
+ EchoService { |
+ factory EchoServiceInterface([EchoService impl]) => |
+ new EchoServiceStub.unbound(impl); |
+ factory EchoServiceInterface.fromEndpoint( |
+ core.MojoMessagePipeEndpoint endpoint, |
+ [EchoService impl]) => |
+ new EchoServiceStub.fromEndpoint(endpoint, impl); |
+} |
+ |
+abstract class EchoServiceInterfaceRequest |
+ implements bindings.MojoInterface<EchoService>, |
+ EchoService { |
+ factory EchoServiceInterfaceRequest() => |
+ new EchoServiceProxy.unbound(); |
+} |
+ |
class _EchoServiceProxyControl |
extends bindings.ProxyMessageHandler |
- implements bindings.ProxyControl { |
+ implements bindings.ProxyControl<EchoService> { |
_EchoServiceProxyControl.fromEndpoint( |
core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); |
@@ -470,9 +508,6 @@ class _EchoServiceProxyControl |
_EchoServiceProxyControl.unbound() : super.unbound(); |
- service_describer.ServiceDescription get serviceDescription => |
- new _EchoServiceServiceDescription(); |
- |
String get serviceName => EchoService.serviceName; |
void handleResponse(bindings.ServiceMessage message) { |
@@ -524,6 +559,11 @@ class _EchoServiceProxyControl |
} |
} |
+ EchoService get impl => null; |
+ set impl(EchoService _) { |
+ throw new core.MojoApiError("The impl of a Proxy cannot be set."); |
+ } |
+ |
@override |
String toString() { |
var superString = super.toString(); |
@@ -532,8 +572,10 @@ class _EchoServiceProxyControl |
} |
class EchoServiceProxy |
- extends bindings.Proxy |
- implements EchoService { |
+ extends bindings.Proxy<EchoService> |
+ implements EchoService, |
+ EchoServiceInterface, |
+ EchoServiceInterfaceRequest { |
EchoServiceProxy.fromEndpoint( |
core.MojoMessagePipeEndpoint endpoint) |
: super(new _EchoServiceProxyControl.fromEndpoint(endpoint)); |
@@ -550,13 +592,6 @@ class EchoServiceProxy |
return new EchoServiceProxy.fromEndpoint(endpoint); |
} |
- factory EchoServiceProxy.connectToService( |
- bindings.ServiceConnector s, String url, [String serviceName]) { |
- EchoServiceProxy p = new EchoServiceProxy.unbound(); |
- s.connectToService(url, p, serviceName); |
- return p; |
- } |
- |
dynamic echoString(String value,[Function responseFactory = null]) { |
var params = new _EchoServiceEchoStringParams(); |
@@ -616,6 +651,8 @@ class _EchoServiceStubControl |
_EchoServiceStubControl.unbound([this._impl]) : super.unbound(); |
+ String get serviceName => EchoService.serviceName; |
+ |
EchoServiceEchoStringResponseParams _echoServiceEchoStringResponseParamsFactory(String value) { |
var result = new EchoServiceEchoStringResponseParams(); |
@@ -721,19 +758,16 @@ class _EchoServiceStubControl |
} |
int get version => 0; |
- |
- static service_describer.ServiceDescription _cachedServiceDescription; |
- static service_describer.ServiceDescription get serviceDescription { |
- if (_cachedServiceDescription == null) { |
- _cachedServiceDescription = new _EchoServiceServiceDescription(); |
- } |
- return _cachedServiceDescription; |
- } |
} |
class EchoServiceStub |
extends bindings.Stub<EchoService> |
- implements EchoService { |
+ implements EchoService, |
+ EchoServiceInterface, |
+ EchoServiceInterfaceRequest { |
+ EchoServiceStub.unbound([EchoService impl]) |
+ : super(new _EchoServiceStubControl.unbound(impl)); |
+ |
EchoServiceStub.fromEndpoint( |
core.MojoMessagePipeEndpoint endpoint, [EchoService impl]) |
: super(new _EchoServiceStubControl.fromEndpoint(endpoint, impl)); |
@@ -742,18 +776,12 @@ class EchoServiceStub |
core.MojoHandle handle, [EchoService impl]) |
: super(new _EchoServiceStubControl.fromHandle(handle, impl)); |
- EchoServiceStub.unbound([EchoService impl]) |
- : super(new _EchoServiceStubControl.unbound(impl)); |
- |
static EchoServiceStub newFromEndpoint( |
core.MojoMessagePipeEndpoint endpoint) { |
assert(endpoint.setDescription("For EchoServiceStub")); |
return new EchoServiceStub.fromEndpoint(endpoint); |
} |
- static service_describer.ServiceDescription get serviceDescription => |
- _EchoServiceStubControl.serviceDescription; |
- |
dynamic echoString(String value,[Function responseFactory = null]) { |
return impl.echoString(value,responseFactory); |