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

Unified Diff: mojo/dart/packages/_mojo_for_test_only/lib/mojo/test/test_structs.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_structs.mojom.dart
diff --git a/mojo/dart/packages/_mojo_for_test_only/lib/mojo/test/test_structs.mojom.dart b/mojo/dart/packages/_mojo_for_test_only/lib/mojo/test/test_structs.mojom.dart
index 72b3d85e970e2180abd99ce6d8780ddf3836e22d..758361ff88cf307812dcb53d8caf665995efa5ce 100644
--- a/mojo/dart/packages/_mojo_for_test_only/lib/mojo/test/test_structs.mojom.dart
+++ b/mojo/dart/packages/_mojo_for_test_only/lib/mojo/test/test_structs.mojom.dart
@@ -5166,7 +5166,7 @@ class ContainsInterface extends bindings.Struct {
static const List<bindings.StructDataHeader> kVersions = const [
const bindings.StructDataHeader(16, 0)
];
- Object someInterface = null;
+ SomeInterfaceInterface someInterface = null;
ContainsInterface() : super(kVersions.last.size);
@@ -5309,8 +5309,8 @@ class ContainsInterfaceRequest extends bindings.Struct {
static const List<bindings.StructDataHeader> kVersions = const [
const bindings.StructDataHeader(16, 0)
];
- Object req = null;
- Object nullableReq = null;
+ SomeInterfaceInterfaceRequest req = null;
+ SomeInterfaceInterfaceRequest nullableReq = null;
ContainsInterfaceRequest() : super(kVersions.last.size);
@@ -6004,12 +6004,50 @@ class _SomeInterfaceServiceDescription implements service_describer.ServiceDescr
abstract class SomeInterface {
static const String serviceName = null;
+
+ static service_describer.ServiceDescription _cachedServiceDescription;
+ static service_describer.ServiceDescription get serviceDescription {
+ if (_cachedServiceDescription == null) {
+ _cachedServiceDescription = new _SomeInterfaceServiceDescription();
+ }
+ return _cachedServiceDescription;
+ }
+
+ static SomeInterfaceProxy connectToService(
+ bindings.ServiceConnector s, String url, [String serviceName]) {
+ SomeInterfaceProxy p = new SomeInterfaceProxy.unbound();
+ String name = serviceName ?? SomeInterface.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 someMethod(RectPair pair,[Function responseFactory = null]);
}
+abstract class SomeInterfaceInterface
+ implements bindings.MojoInterface<SomeInterface>,
+ SomeInterface {
+ factory SomeInterfaceInterface([SomeInterface impl]) =>
+ new SomeInterfaceStub.unbound(impl);
+ factory SomeInterfaceInterface.fromEndpoint(
+ core.MojoMessagePipeEndpoint endpoint,
+ [SomeInterface impl]) =>
+ new SomeInterfaceStub.fromEndpoint(endpoint, impl);
+}
+
+abstract class SomeInterfaceInterfaceRequest
+ implements bindings.MojoInterface<SomeInterface>,
+ SomeInterface {
+ factory SomeInterfaceInterfaceRequest() =>
+ new SomeInterfaceProxy.unbound();
+}
+
class _SomeInterfaceProxyControl
extends bindings.ProxyMessageHandler
- implements bindings.ProxyControl {
+ implements bindings.ProxyControl<SomeInterface> {
_SomeInterfaceProxyControl.fromEndpoint(
core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint);
@@ -6018,9 +6056,6 @@ class _SomeInterfaceProxyControl
_SomeInterfaceProxyControl.unbound() : super.unbound();
- service_describer.ServiceDescription get serviceDescription =>
- new _SomeInterfaceServiceDescription();
-
String get serviceName => SomeInterface.serviceName;
void handleResponse(bindings.ServiceMessage message) {
@@ -6052,6 +6087,11 @@ class _SomeInterfaceProxyControl
}
}
+ SomeInterface get impl => null;
+ set impl(SomeInterface _) {
+ throw new core.MojoApiError("The impl of a Proxy cannot be set.");
+ }
+
@override
String toString() {
var superString = super.toString();
@@ -6060,8 +6100,10 @@ class _SomeInterfaceProxyControl
}
class SomeInterfaceProxy
- extends bindings.Proxy
- implements SomeInterface {
+ extends bindings.Proxy<SomeInterface>
+ implements SomeInterface,
+ SomeInterfaceInterface,
+ SomeInterfaceInterfaceRequest {
SomeInterfaceProxy.fromEndpoint(
core.MojoMessagePipeEndpoint endpoint)
: super(new _SomeInterfaceProxyControl.fromEndpoint(endpoint));
@@ -6078,13 +6120,6 @@ class SomeInterfaceProxy
return new SomeInterfaceProxy.fromEndpoint(endpoint);
}
- factory SomeInterfaceProxy.connectToService(
- bindings.ServiceConnector s, String url, [String serviceName]) {
- SomeInterfaceProxy p = new SomeInterfaceProxy.unbound();
- s.connectToService(url, p, serviceName);
- return p;
- }
-
dynamic someMethod(RectPair pair,[Function responseFactory = null]) {
var params = new _SomeInterfaceSomeMethodParams();
@@ -6116,6 +6151,8 @@ class _SomeInterfaceStubControl
_SomeInterfaceStubControl.unbound([this._impl]) : super.unbound();
+ String get serviceName => SomeInterface.serviceName;
+
SomeInterfaceSomeMethodResponseParams _someInterfaceSomeMethodResponseParamsFactory(RectPair otherPair) {
var result = new SomeInterfaceSomeMethodResponseParams();
@@ -6188,19 +6225,16 @@ class _SomeInterfaceStubControl
}
int get version => 0;
-
- static service_describer.ServiceDescription _cachedServiceDescription;
- static service_describer.ServiceDescription get serviceDescription {
- if (_cachedServiceDescription == null) {
- _cachedServiceDescription = new _SomeInterfaceServiceDescription();
- }
- return _cachedServiceDescription;
- }
}
class SomeInterfaceStub
extends bindings.Stub<SomeInterface>
- implements SomeInterface {
+ implements SomeInterface,
+ SomeInterfaceInterface,
+ SomeInterfaceInterfaceRequest {
+ SomeInterfaceStub.unbound([SomeInterface impl])
+ : super(new _SomeInterfaceStubControl.unbound(impl));
+
SomeInterfaceStub.fromEndpoint(
core.MojoMessagePipeEndpoint endpoint, [SomeInterface impl])
: super(new _SomeInterfaceStubControl.fromEndpoint(endpoint, impl));
@@ -6209,18 +6243,12 @@ class SomeInterfaceStub
core.MojoHandle handle, [SomeInterface impl])
: super(new _SomeInterfaceStubControl.fromHandle(handle, impl));
- SomeInterfaceStub.unbound([SomeInterface impl])
- : super(new _SomeInterfaceStubControl.unbound(impl));
-
static SomeInterfaceStub newFromEndpoint(
core.MojoMessagePipeEndpoint endpoint) {
assert(endpoint.setDescription("For SomeInterfaceStub"));
return new SomeInterfaceStub.fromEndpoint(endpoint);
}
- static service_describer.ServiceDescription get serviceDescription =>
- _SomeInterfaceStubControl.serviceDescription;
-
dynamic someMethod(RectPair pair,[Function responseFactory = null]) {
return impl.someMethod(pair,responseFactory);

Powered by Google App Engine
This is Rietveld 408576698