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

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

Issue 1964193002: Dart: Refactors Proxies (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Address comments 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/test/pingpong_service.mojom.dart
diff --git a/mojo/dart/packages/_mojo_for_test_only/lib/test/pingpong_service.mojom.dart b/mojo/dart/packages/_mojo_for_test_only/lib/test/pingpong_service.mojom.dart
index 2ca1bab25438a3670c611b5df480245e213e953c..425f5fbc10a0e219817f1537a4e13e9e67c325f6 100644
--- a/mojo/dart/packages/_mojo_for_test_only/lib/test/pingpong_service.mojom.dart
+++ b/mojo/dart/packages/_mojo_for_test_only/lib/test/pingpong_service.mojom.dart
@@ -777,24 +777,22 @@ abstract class PingPongService {
}
-class _PingPongServiceProxyImpl extends bindings.Proxy {
- _PingPongServiceProxyImpl.fromEndpoint(
+class _PingPongServiceProxyControl extends bindings.ProxyMessageHandler
+ implements bindings.ProxyControl {
+ _PingPongServiceProxyControl.fromEndpoint(
core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint);
- _PingPongServiceProxyImpl.fromHandle(core.MojoHandle handle) :
- super.fromHandle(handle);
+ _PingPongServiceProxyControl.fromHandle(
+ core.MojoHandle handle) : super.fromHandle(handle);
- _PingPongServiceProxyImpl.unbound() : super.unbound();
-
- static _PingPongServiceProxyImpl newFromEndpoint(
- core.MojoMessagePipeEndpoint endpoint) {
- assert(endpoint.setDescription("For _PingPongServiceProxyImpl"));
- return new _PingPongServiceProxyImpl.fromEndpoint(endpoint);
- }
+ _PingPongServiceProxyControl.unbound() : super.unbound();
service_describer.ServiceDescription get serviceDescription =>
- new _PingPongServiceServiceDescription();
+ new _PingPongServiceServiceDescription();
+
+ String get serviceName => PingPongService.serviceName;
+ @override
void handleResponse(bindings.ServiceMessage message) {
switch (message.header.type) {
case _pingPongServiceMethodPingTargetUrlName:
@@ -844,106 +842,30 @@ class _PingPongServiceProxyImpl extends bindings.Proxy {
}
}
+ @override
String toString() {
var superString = super.toString();
- return "_PingPongServiceProxyImpl($superString)";
+ return "_PingPongServiceProxyControl($superString)";
}
}
-class _PingPongServiceProxyCalls implements PingPongService {
- _PingPongServiceProxyImpl _proxyImpl;
-
- _PingPongServiceProxyCalls(this._proxyImpl);
- void setClient(Object client) {
- if (!_proxyImpl.isBound) {
- _proxyImpl.proxyError("The Proxy is closed.");
- return;
- }
- var params = new _PingPongServiceSetClientParams();
- params.client = client;
- _proxyImpl.sendMessage(params, _pingPongServiceMethodSetClientName);
- }
- void ping(int pingValue) {
- if (!_proxyImpl.isBound) {
- _proxyImpl.proxyError("The Proxy is closed.");
- return;
- }
- var params = new _PingPongServicePingParams();
- params.pingValue = pingValue;
- _proxyImpl.sendMessage(params, _pingPongServiceMethodPingName);
- }
- dynamic pingTargetUrl(String url,int count,[Function responseFactory = null]) {
- var params = new _PingPongServicePingTargetUrlParams();
- params.url = url;
- params.count = count;
- return _proxyImpl.sendMessageWithRequestId(
- params,
- _pingPongServiceMethodPingTargetUrlName,
- -1,
- bindings.MessageHeader.kMessageExpectsResponse);
- }
- dynamic pingTargetService(Object service,int count,[Function responseFactory = null]) {
- var params = new _PingPongServicePingTargetServiceParams();
- params.service = service;
- params.count = count;
- return _proxyImpl.sendMessageWithRequestId(
- params,
- _pingPongServiceMethodPingTargetServiceName,
- -1,
- bindings.MessageHeader.kMessageExpectsResponse);
- }
- void getPingPongService(Object service) {
- if (!_proxyImpl.isBound) {
- _proxyImpl.proxyError("The Proxy is closed.");
- return;
- }
- var params = new _PingPongServiceGetPingPongServiceParams();
- params.service = service;
- _proxyImpl.sendMessage(params, _pingPongServiceMethodGetPingPongServiceName);
- }
- void getPingPongServiceDelayed(Object service) {
- if (!_proxyImpl.isBound) {
- _proxyImpl.proxyError("The Proxy is closed.");
- return;
- }
- var params = new _PingPongServiceGetPingPongServiceDelayedParams();
- params.service = service;
- _proxyImpl.sendMessage(params, _pingPongServiceMethodGetPingPongServiceDelayedName);
- }
- void quit() {
- if (!_proxyImpl.isBound) {
- _proxyImpl.proxyError("The Proxy is closed.");
- return;
- }
- var params = new _PingPongServiceQuitParams();
- _proxyImpl.sendMessage(params, _pingPongServiceMethodQuitName);
- }
-}
-
-
-class PingPongServiceProxy implements bindings.ProxyBase {
- final bindings.Proxy impl;
- PingPongService ptr;
-
- PingPongServiceProxy(_PingPongServiceProxyImpl proxyImpl) :
- impl = proxyImpl,
- ptr = new _PingPongServiceProxyCalls(proxyImpl);
-
+class PingPongServiceProxy extends bindings.Proxy
+ implements PingPongService {
PingPongServiceProxy.fromEndpoint(
- core.MojoMessagePipeEndpoint endpoint) :
- impl = new _PingPongServiceProxyImpl.fromEndpoint(endpoint) {
- ptr = new _PingPongServiceProxyCalls(impl);
- }
+ core.MojoMessagePipeEndpoint endpoint)
+ : super(new _PingPongServiceProxyControl.fromEndpoint(endpoint));
- PingPongServiceProxy.fromHandle(core.MojoHandle handle) :
- impl = new _PingPongServiceProxyImpl.fromHandle(handle) {
- ptr = new _PingPongServiceProxyCalls(impl);
- }
+ PingPongServiceProxy.fromHandle(core.MojoHandle handle)
+ : super(new _PingPongServiceProxyControl.fromHandle(handle));
+
+ PingPongServiceProxy.unbound()
+ : super(new _PingPongServiceProxyControl.unbound());
- PingPongServiceProxy.unbound() :
- impl = new _PingPongServiceProxyImpl.unbound() {
- ptr = new _PingPongServiceProxyCalls(impl);
+ static PingPongServiceProxy newFromEndpoint(
+ core.MojoMessagePipeEndpoint endpoint) {
+ assert(endpoint.setDescription("For PingPongServiceProxy"));
+ return new PingPongServiceProxy.fromEndpoint(endpoint);
}
factory PingPongServiceProxy.connectToService(
@@ -953,30 +875,75 @@ class PingPongServiceProxy implements bindings.ProxyBase {
return p;
}
- static PingPongServiceProxy newFromEndpoint(
- core.MojoMessagePipeEndpoint endpoint) {
- assert(endpoint.setDescription("For PingPongServiceProxy"));
- return new PingPongServiceProxy.fromEndpoint(endpoint);
- }
-
- String get serviceName => PingPongService.serviceName;
-
- Future close({bool immediate: false}) => impl.close(immediate: immediate);
-
- Future responseOrError(Future f) => impl.responseOrError(f);
- Future get errorFuture => impl.errorFuture;
-
- int get version => impl.version;
-
- Future<int> queryVersion() => impl.queryVersion();
-
- void requireVersion(int requiredVersion) {
- impl.requireVersion(requiredVersion);
- }
-
- String toString() {
- return "PingPongServiceProxy($impl)";
+ void setClient(Object client) {
+ if (!ctrl.isBound) {
+ ctrl.proxyError("The Proxy is closed.");
+ return;
+ }
+ var params = new _PingPongServiceSetClientParams();
+ params.client = client;
+ ctrl.sendMessage(params,
+ _pingPongServiceMethodSetClientName);
+ }
+ void ping(int pingValue) {
+ if (!ctrl.isBound) {
+ ctrl.proxyError("The Proxy is closed.");
+ return;
+ }
+ var params = new _PingPongServicePingParams();
+ params.pingValue = pingValue;
+ ctrl.sendMessage(params,
+ _pingPongServiceMethodPingName);
+ }
+ dynamic pingTargetUrl(String url,int count,[Function responseFactory = null]) {
+ var params = new _PingPongServicePingTargetUrlParams();
+ params.url = url;
+ params.count = count;
+ return ctrl.sendMessageWithRequestId(
+ params,
+ _pingPongServiceMethodPingTargetUrlName,
+ -1,
+ bindings.MessageHeader.kMessageExpectsResponse);
+ }
+ dynamic pingTargetService(Object service,int count,[Function responseFactory = null]) {
+ var params = new _PingPongServicePingTargetServiceParams();
+ params.service = service;
+ params.count = count;
+ return ctrl.sendMessageWithRequestId(
+ params,
+ _pingPongServiceMethodPingTargetServiceName,
+ -1,
+ bindings.MessageHeader.kMessageExpectsResponse);
+ }
+ void getPingPongService(Object service) {
+ if (!ctrl.isBound) {
+ ctrl.proxyError("The Proxy is closed.");
+ return;
+ }
+ var params = new _PingPongServiceGetPingPongServiceParams();
+ params.service = service;
+ ctrl.sendMessage(params,
+ _pingPongServiceMethodGetPingPongServiceName);
+ }
+ void getPingPongServiceDelayed(Object service) {
+ if (!ctrl.isBound) {
+ ctrl.proxyError("The Proxy is closed.");
+ return;
+ }
+ var params = new _PingPongServiceGetPingPongServiceDelayedParams();
+ params.service = service;
+ ctrl.sendMessage(params,
+ _pingPongServiceMethodGetPingPongServiceDelayedName);
+ }
+ void quit() {
+ if (!ctrl.isBound) {
+ ctrl.proxyError("The Proxy is closed.");
+ return;
+ }
+ var params = new _PingPongServiceQuitParams();
+ ctrl.sendMessage(params,
+ _pingPongServiceMethodQuitName);
}
}
@@ -1154,24 +1121,22 @@ abstract class PingPongClient {
}
-class _PingPongClientProxyImpl extends bindings.Proxy {
- _PingPongClientProxyImpl.fromEndpoint(
+class _PingPongClientProxyControl extends bindings.ProxyMessageHandler
+ implements bindings.ProxyControl {
+ _PingPongClientProxyControl.fromEndpoint(
core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint);
- _PingPongClientProxyImpl.fromHandle(core.MojoHandle handle) :
- super.fromHandle(handle);
+ _PingPongClientProxyControl.fromHandle(
+ core.MojoHandle handle) : super.fromHandle(handle);
- _PingPongClientProxyImpl.unbound() : super.unbound();
-
- static _PingPongClientProxyImpl newFromEndpoint(
- core.MojoMessagePipeEndpoint endpoint) {
- assert(endpoint.setDescription("For _PingPongClientProxyImpl"));
- return new _PingPongClientProxyImpl.fromEndpoint(endpoint);
- }
+ _PingPongClientProxyControl.unbound() : super.unbound();
service_describer.ServiceDescription get serviceDescription =>
- new _PingPongClientServiceDescription();
+ new _PingPongClientServiceDescription();
+
+ String get serviceName => PingPongClient.serviceName;
+ @override
void handleResponse(bindings.ServiceMessage message) {
switch (message.header.type) {
default:
@@ -1181,51 +1146,30 @@ class _PingPongClientProxyImpl extends bindings.Proxy {
}
}
+ @override
String toString() {
var superString = super.toString();
- return "_PingPongClientProxyImpl($superString)";
+ return "_PingPongClientProxyControl($superString)";
}
}
-class _PingPongClientProxyCalls implements PingPongClient {
- _PingPongClientProxyImpl _proxyImpl;
-
- _PingPongClientProxyCalls(this._proxyImpl);
- void pong(int pongValue) {
- if (!_proxyImpl.isBound) {
- _proxyImpl.proxyError("The Proxy is closed.");
- return;
- }
- var params = new _PingPongClientPongParams();
- params.pongValue = pongValue;
- _proxyImpl.sendMessage(params, _pingPongClientMethodPongName);
- }
-}
-
-
-class PingPongClientProxy implements bindings.ProxyBase {
- final bindings.Proxy impl;
- PingPongClient ptr;
-
- PingPongClientProxy(_PingPongClientProxyImpl proxyImpl) :
- impl = proxyImpl,
- ptr = new _PingPongClientProxyCalls(proxyImpl);
-
+class PingPongClientProxy extends bindings.Proxy
+ implements PingPongClient {
PingPongClientProxy.fromEndpoint(
- core.MojoMessagePipeEndpoint endpoint) :
- impl = new _PingPongClientProxyImpl.fromEndpoint(endpoint) {
- ptr = new _PingPongClientProxyCalls(impl);
- }
+ core.MojoMessagePipeEndpoint endpoint)
+ : super(new _PingPongClientProxyControl.fromEndpoint(endpoint));
- PingPongClientProxy.fromHandle(core.MojoHandle handle) :
- impl = new _PingPongClientProxyImpl.fromHandle(handle) {
- ptr = new _PingPongClientProxyCalls(impl);
- }
+ PingPongClientProxy.fromHandle(core.MojoHandle handle)
+ : super(new _PingPongClientProxyControl.fromHandle(handle));
- PingPongClientProxy.unbound() :
- impl = new _PingPongClientProxyImpl.unbound() {
- ptr = new _PingPongClientProxyCalls(impl);
+ PingPongClientProxy.unbound()
+ : super(new _PingPongClientProxyControl.unbound());
+
+ static PingPongClientProxy newFromEndpoint(
+ core.MojoMessagePipeEndpoint endpoint) {
+ assert(endpoint.setDescription("For PingPongClientProxy"));
+ return new PingPongClientProxy.fromEndpoint(endpoint);
}
factory PingPongClientProxy.connectToService(
@@ -1235,30 +1179,16 @@ class PingPongClientProxy implements bindings.ProxyBase {
return p;
}
- static PingPongClientProxy newFromEndpoint(
- core.MojoMessagePipeEndpoint endpoint) {
- assert(endpoint.setDescription("For PingPongClientProxy"));
- return new PingPongClientProxy.fromEndpoint(endpoint);
- }
-
- String get serviceName => PingPongClient.serviceName;
- Future close({bool immediate: false}) => impl.close(immediate: immediate);
-
- Future responseOrError(Future f) => impl.responseOrError(f);
-
- Future get errorFuture => impl.errorFuture;
-
- int get version => impl.version;
-
- Future<int> queryVersion() => impl.queryVersion();
-
- void requireVersion(int requiredVersion) {
- impl.requireVersion(requiredVersion);
- }
-
- String toString() {
- return "PingPongClientProxy($impl)";
+ void pong(int pongValue) {
+ if (!ctrl.isBound) {
+ ctrl.proxyError("The Proxy is closed.");
+ return;
+ }
+ var params = new _PingPongClientPongParams();
+ params.pongValue = pongValue;
+ ctrl.sendMessage(params,
+ _pingPongClientMethodPongName);
}
}
@@ -1358,7 +1288,7 @@ mojom_types.RuntimeTypeInfo _initRuntimeTypeInfo() {
// serializedRuntimeTypeInfo contains the bytes of the Mojo serialization of
// a mojom_types.RuntimeTypeInfo struct describing the Mojom types in this
// file. The string contains the base64 encoding of the gzip-compressed bytes.
- var serializedRuntimeTypeInfo = "H4sIAAAJbogC/+xZTU/bTBB2HD7ywhs+3hdKSigKlFb0AEZqD4gTUkFFalWlLVXLKVhhC26T2LUdpN565CfwE/oTeuxP4dgjR27tLpltl/VOYkeJbVpWGsyuP3bn2Zl5ZicFrdUm4HoCV3l8XehnqOSgf4fKNBWfeP7GRtlqHJbtxuEr4h5bVaJ4/h68s7tX3q483d7bYC+uBt+T53eEdenC+Bpcl6jMod99XLNIw48y/7IwT1ZaD+t/Hmj1l2G8pEktc7W7Kd1ek8Z/QCtr6naLyhgVWaMiHfsf8FeoG8BxgcoIlQqVN1SMI7tODLd5YNetBnGNuv3eNjy32vrnwHR9w3Qc9nXPYH8rtOcZVsMn7juzSjzDoXM6dM6K18Julb1YD8zL+/9K0Mj2IeN5huCB4akJeIrfkxtbB9tCBpcKp0XY/37jVJLw4fpeZMLrydoaoucU6Mr0XHHJxyZdm0pf3vqtr7zfm4r4ogn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m+Y7/3JwAA///Y0/jDWCcAAA==";
// Deserialize RuntimeTypeInfo
var bytes = BASE64.decode(serializedRuntimeTypeInfo);
« no previous file with comments | « mojo/dart/packages/_mojo_for_test_only/lib/test/echo_service.mojom.dart ('k') | mojo/dart/packages/mojo/lib/core.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698