Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(168)

Unified Diff: mojo/dart/packages/_mojo_for_test_only/lib/mojo/test/test_unions.mojom.dart

Issue 1998433002: Dart: Adds Interface and InterfaceRequest interfaces. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Merge Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: mojo/dart/packages/_mojo_for_test_only/lib/mojo/test/test_unions.mojom.dart
diff --git a/mojo/dart/packages/_mojo_for_test_only/lib/mojo/test/test_unions.mojom.dart b/mojo/dart/packages/_mojo_for_test_only/lib/mojo/test/test_unions.mojom.dart
index 338f1d97aa295261eebb768a0f2b7801d5fd7222..a6f1871cb0b3e04b9a9707768c93ce9d7bb23e53 100644
--- a/mojo/dart/packages/_mojo_for_test_only/lib/mojo/test/test_unions.mojom.dart
+++ b/mojo/dart/packages/_mojo_for_test_only/lib/mojo/test/test_unions.mojom.dart
@@ -2580,14 +2580,14 @@ class HandleUnion extends bindings.Union {
_tag = HandleUnionTag.fSharedBuffer;
_data = value;
}
- Object get fSmallCache {
+ SmallCacheInterface get fSmallCache {
if (_tag != HandleUnionTag.fSmallCache) {
throw new bindings.UnsetUnionTagError(_tag, HandleUnionTag.fSmallCache);
}
return _data;
}
- set fSmallCache(Object value) {
+ set fSmallCache(SmallCacheInterface value) {
_tag = HandleUnionTag.fSmallCache;
_data = value;
}
@@ -2967,13 +2967,51 @@ class _SmallCacheServiceDescription implements service_describer.ServiceDescript
abstract class SmallCache {
static const String serviceName = null;
+
+ static service_describer.ServiceDescription _cachedServiceDescription;
+ static service_describer.ServiceDescription get serviceDescription {
+ if (_cachedServiceDescription == null) {
+ _cachedServiceDescription = new _SmallCacheServiceDescription();
+ }
+ return _cachedServiceDescription;
+ }
+
+ static SmallCacheProxy connectToService(
+ bindings.ServiceConnector s, String url, [String serviceName]) {
+ SmallCacheProxy p = new SmallCacheProxy.unbound();
+ String name = serviceName ?? SmallCache.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;
+ }
void setIntValue(int intValue);
dynamic getIntValue([Function responseFactory = null]);
}
+abstract class SmallCacheInterface
+ implements bindings.MojoInterface<SmallCache>,
+ SmallCache {
+ factory SmallCacheInterface([SmallCache impl]) =>
+ new SmallCacheStub.unbound(impl);
+ factory SmallCacheInterface.fromEndpoint(
+ core.MojoMessagePipeEndpoint endpoint,
+ [SmallCache impl]) =>
+ new SmallCacheStub.fromEndpoint(endpoint, impl);
+}
+
+abstract class SmallCacheInterfaceRequest
+ implements bindings.MojoInterface<SmallCache>,
+ SmallCache {
+ factory SmallCacheInterfaceRequest() =>
+ new SmallCacheProxy.unbound();
+}
+
class _SmallCacheProxyControl
extends bindings.ProxyMessageHandler
- implements bindings.ProxyControl {
+ implements bindings.ProxyControl<SmallCache> {
_SmallCacheProxyControl.fromEndpoint(
core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint);
@@ -2982,9 +3020,6 @@ class _SmallCacheProxyControl
_SmallCacheProxyControl.unbound() : super.unbound();
- service_describer.ServiceDescription get serviceDescription =>
- new _SmallCacheServiceDescription();
-
String get serviceName => SmallCache.serviceName;
void handleResponse(bindings.ServiceMessage message) {
@@ -3016,6 +3051,11 @@ class _SmallCacheProxyControl
}
}
+ SmallCache get impl => null;
+ set impl(SmallCache _) {
+ throw new core.MojoApiError("The impl of a Proxy cannot be set.");
+ }
+
@override
String toString() {
var superString = super.toString();
@@ -3024,8 +3064,10 @@ class _SmallCacheProxyControl
}
class SmallCacheProxy
- extends bindings.Proxy
- implements SmallCache {
+ extends bindings.Proxy<SmallCache>
+ implements SmallCache,
+ SmallCacheInterface,
+ SmallCacheInterfaceRequest {
SmallCacheProxy.fromEndpoint(
core.MojoMessagePipeEndpoint endpoint)
: super(new _SmallCacheProxyControl.fromEndpoint(endpoint));
@@ -3042,13 +3084,6 @@ class SmallCacheProxy
return new SmallCacheProxy.fromEndpoint(endpoint);
}
- factory SmallCacheProxy.connectToService(
- bindings.ServiceConnector s, String url, [String serviceName]) {
- SmallCacheProxy p = new SmallCacheProxy.unbound();
- s.connectToService(url, p, serviceName);
- return p;
- }
-
void setIntValue(int intValue) {
if (!ctrl.isBound) {
@@ -3089,6 +3124,8 @@ class _SmallCacheStubControl
_SmallCacheStubControl.unbound([this._impl]) : super.unbound();
+ String get serviceName => SmallCache.serviceName;
+
SmallCacheGetIntValueResponseParams _smallCacheGetIntValueResponseParamsFactory(int intValue) {
var result = new SmallCacheGetIntValueResponseParams();
@@ -3164,19 +3201,16 @@ class _SmallCacheStubControl
}
int get version => 0;
-
- static service_describer.ServiceDescription _cachedServiceDescription;
- static service_describer.ServiceDescription get serviceDescription {
- if (_cachedServiceDescription == null) {
- _cachedServiceDescription = new _SmallCacheServiceDescription();
- }
- return _cachedServiceDescription;
- }
}
class SmallCacheStub
extends bindings.Stub<SmallCache>
- implements SmallCache {
+ implements SmallCache,
+ SmallCacheInterface,
+ SmallCacheInterfaceRequest {
+ SmallCacheStub.unbound([SmallCache impl])
+ : super(new _SmallCacheStubControl.unbound(impl));
+
SmallCacheStub.fromEndpoint(
core.MojoMessagePipeEndpoint endpoint, [SmallCache impl])
: super(new _SmallCacheStubControl.fromEndpoint(endpoint, impl));
@@ -3185,18 +3219,12 @@ class SmallCacheStub
core.MojoHandle handle, [SmallCache impl])
: super(new _SmallCacheStubControl.fromHandle(handle, impl));
- SmallCacheStub.unbound([SmallCache impl])
- : super(new _SmallCacheStubControl.unbound(impl));
-
static SmallCacheStub newFromEndpoint(
core.MojoMessagePipeEndpoint endpoint) {
assert(endpoint.setDescription("For SmallCacheStub"));
return new SmallCacheStub.fromEndpoint(endpoint);
}
- static service_describer.ServiceDescription get serviceDescription =>
- _SmallCacheStubControl.serviceDescription;
-
void setIntValue(int intValue) {
return impl.setIntValue(intValue);
@@ -3221,12 +3249,50 @@ class _UnionInterfaceServiceDescription implements service_describer.ServiceDesc
abstract class UnionInterface {
static const String serviceName = null;
+
+ static service_describer.ServiceDescription _cachedServiceDescription;
+ static service_describer.ServiceDescription get serviceDescription {
+ if (_cachedServiceDescription == null) {
+ _cachedServiceDescription = new _UnionInterfaceServiceDescription();
+ }
+ return _cachedServiceDescription;
+ }
+
+ static UnionInterfaceProxy connectToService(
+ bindings.ServiceConnector s, String url, [String serviceName]) {
+ UnionInterfaceProxy p = new UnionInterfaceProxy.unbound();
+ String name = serviceName ?? UnionInterface.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 echo(PodUnion inVal,[Function responseFactory = null]);
}
+abstract class UnionInterfaceInterface
+ implements bindings.MojoInterface<UnionInterface>,
+ UnionInterface {
+ factory UnionInterfaceInterface([UnionInterface impl]) =>
+ new UnionInterfaceStub.unbound(impl);
+ factory UnionInterfaceInterface.fromEndpoint(
+ core.MojoMessagePipeEndpoint endpoint,
+ [UnionInterface impl]) =>
+ new UnionInterfaceStub.fromEndpoint(endpoint, impl);
+}
+
+abstract class UnionInterfaceInterfaceRequest
+ implements bindings.MojoInterface<UnionInterface>,
+ UnionInterface {
+ factory UnionInterfaceInterfaceRequest() =>
+ new UnionInterfaceProxy.unbound();
+}
+
class _UnionInterfaceProxyControl
extends bindings.ProxyMessageHandler
- implements bindings.ProxyControl {
+ implements bindings.ProxyControl<UnionInterface> {
_UnionInterfaceProxyControl.fromEndpoint(
core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint);
@@ -3235,9 +3301,6 @@ class _UnionInterfaceProxyControl
_UnionInterfaceProxyControl.unbound() : super.unbound();
- service_describer.ServiceDescription get serviceDescription =>
- new _UnionInterfaceServiceDescription();
-
String get serviceName => UnionInterface.serviceName;
void handleResponse(bindings.ServiceMessage message) {
@@ -3269,6 +3332,11 @@ class _UnionInterfaceProxyControl
}
}
+ UnionInterface get impl => null;
+ set impl(UnionInterface _) {
+ throw new core.MojoApiError("The impl of a Proxy cannot be set.");
+ }
+
@override
String toString() {
var superString = super.toString();
@@ -3277,8 +3345,10 @@ class _UnionInterfaceProxyControl
}
class UnionInterfaceProxy
- extends bindings.Proxy
- implements UnionInterface {
+ extends bindings.Proxy<UnionInterface>
+ implements UnionInterface,
+ UnionInterfaceInterface,
+ UnionInterfaceInterfaceRequest {
UnionInterfaceProxy.fromEndpoint(
core.MojoMessagePipeEndpoint endpoint)
: super(new _UnionInterfaceProxyControl.fromEndpoint(endpoint));
@@ -3295,13 +3365,6 @@ class UnionInterfaceProxy
return new UnionInterfaceProxy.fromEndpoint(endpoint);
}
- factory UnionInterfaceProxy.connectToService(
- bindings.ServiceConnector s, String url, [String serviceName]) {
- UnionInterfaceProxy p = new UnionInterfaceProxy.unbound();
- s.connectToService(url, p, serviceName);
- return p;
- }
-
dynamic echo(PodUnion inVal,[Function responseFactory = null]) {
var params = new _UnionInterfaceEchoParams();
@@ -3333,6 +3396,8 @@ class _UnionInterfaceStubControl
_UnionInterfaceStubControl.unbound([this._impl]) : super.unbound();
+ String get serviceName => UnionInterface.serviceName;
+
UnionInterfaceEchoResponseParams _unionInterfaceEchoResponseParamsFactory(PodUnion outVal) {
var result = new UnionInterfaceEchoResponseParams();
@@ -3405,19 +3470,16 @@ class _UnionInterfaceStubControl
}
int get version => 0;
-
- static service_describer.ServiceDescription _cachedServiceDescription;
- static service_describer.ServiceDescription get serviceDescription {
- if (_cachedServiceDescription == null) {
- _cachedServiceDescription = new _UnionInterfaceServiceDescription();
- }
- return _cachedServiceDescription;
- }
}
class UnionInterfaceStub
extends bindings.Stub<UnionInterface>
- implements UnionInterface {
+ implements UnionInterface,
+ UnionInterfaceInterface,
+ UnionInterfaceInterfaceRequest {
+ UnionInterfaceStub.unbound([UnionInterface impl])
+ : super(new _UnionInterfaceStubControl.unbound(impl));
+
UnionInterfaceStub.fromEndpoint(
core.MojoMessagePipeEndpoint endpoint, [UnionInterface impl])
: super(new _UnionInterfaceStubControl.fromEndpoint(endpoint, impl));
@@ -3426,18 +3488,12 @@ class UnionInterfaceStub
core.MojoHandle handle, [UnionInterface impl])
: super(new _UnionInterfaceStubControl.fromHandle(handle, impl));
- UnionInterfaceStub.unbound([UnionInterface impl])
- : super(new _UnionInterfaceStubControl.unbound(impl));
-
static UnionInterfaceStub newFromEndpoint(
core.MojoMessagePipeEndpoint endpoint) {
assert(endpoint.setDescription("For UnionInterfaceStub"));
return new UnionInterfaceStub.fromEndpoint(endpoint);
}
- static service_describer.ServiceDescription get serviceDescription =>
- _UnionInterfaceStubControl.serviceDescription;
-
dynamic echo(PodUnion inVal,[Function responseFactory = null]) {
return impl.echo(inVal,responseFactory);

Powered by Google App Engine
This is Rietveld 408576698