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

Unified Diff: mojo/dart/packages/mojo_services/lib/mojo/ui/view_token.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_services/lib/mojo/ui/view_token.mojom.dart
diff --git a/mojo/dart/packages/mojo_services/lib/mojo/ui/view_token.mojom.dart b/mojo/dart/packages/mojo_services/lib/mojo/ui/view_token.mojom.dart
index 10a3104b76aa723f79be0f507c191b6e9d60a6ed..125ef8f7c68600495e763137ffb73a3ee6b5e146 100644
--- a/mojo/dart/packages/mojo_services/lib/mojo/ui/view_token.mojom.dart
+++ b/mojo/dart/packages/mojo_services/lib/mojo/ui/view_token.mojom.dart
@@ -231,24 +231,22 @@ abstract class ViewOwner {
}
-class _ViewOwnerProxyImpl extends bindings.Proxy {
- _ViewOwnerProxyImpl.fromEndpoint(
+class _ViewOwnerProxyControl extends bindings.ProxyMessageHandler
+ implements bindings.ProxyControl {
+ _ViewOwnerProxyControl.fromEndpoint(
core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint);
- _ViewOwnerProxyImpl.fromHandle(core.MojoHandle handle) :
- super.fromHandle(handle);
+ _ViewOwnerProxyControl.fromHandle(
+ core.MojoHandle handle) : super.fromHandle(handle);
- _ViewOwnerProxyImpl.unbound() : super.unbound();
-
- static _ViewOwnerProxyImpl newFromEndpoint(
- core.MojoMessagePipeEndpoint endpoint) {
- assert(endpoint.setDescription("For _ViewOwnerProxyImpl"));
- return new _ViewOwnerProxyImpl.fromEndpoint(endpoint);
- }
+ _ViewOwnerProxyControl.unbound() : super.unbound();
service_describer.ServiceDescription get serviceDescription =>
- new _ViewOwnerServiceDescription();
+ new _ViewOwnerServiceDescription();
+
+ String get serviceName => ViewOwner.serviceName;
+ @override
void handleResponse(bindings.ServiceMessage message) {
switch (message.header.type) {
case _viewOwnerMethodGetTokenName:
@@ -278,50 +276,30 @@ class _ViewOwnerProxyImpl extends bindings.Proxy {
}
}
+ @override
String toString() {
var superString = super.toString();
- return "_ViewOwnerProxyImpl($superString)";
+ return "_ViewOwnerProxyControl($superString)";
}
}
-class _ViewOwnerProxyCalls implements ViewOwner {
- _ViewOwnerProxyImpl _proxyImpl;
-
- _ViewOwnerProxyCalls(this._proxyImpl);
- dynamic getToken([Function responseFactory = null]) {
- var params = new _ViewOwnerGetTokenParams();
- return _proxyImpl.sendMessageWithRequestId(
- params,
- _viewOwnerMethodGetTokenName,
- -1,
- bindings.MessageHeader.kMessageExpectsResponse);
- }
-}
-
-
-class ViewOwnerProxy implements bindings.ProxyBase {
- final bindings.Proxy impl;
- ViewOwner ptr;
-
- ViewOwnerProxy(_ViewOwnerProxyImpl proxyImpl) :
- impl = proxyImpl,
- ptr = new _ViewOwnerProxyCalls(proxyImpl);
-
+class ViewOwnerProxy extends bindings.Proxy
+ implements ViewOwner {
ViewOwnerProxy.fromEndpoint(
- core.MojoMessagePipeEndpoint endpoint) :
- impl = new _ViewOwnerProxyImpl.fromEndpoint(endpoint) {
- ptr = new _ViewOwnerProxyCalls(impl);
- }
+ core.MojoMessagePipeEndpoint endpoint)
+ : super(new _ViewOwnerProxyControl.fromEndpoint(endpoint));
- ViewOwnerProxy.fromHandle(core.MojoHandle handle) :
- impl = new _ViewOwnerProxyImpl.fromHandle(handle) {
- ptr = new _ViewOwnerProxyCalls(impl);
- }
+ ViewOwnerProxy.fromHandle(core.MojoHandle handle)
+ : super(new _ViewOwnerProxyControl.fromHandle(handle));
- ViewOwnerProxy.unbound() :
- impl = new _ViewOwnerProxyImpl.unbound() {
- ptr = new _ViewOwnerProxyCalls(impl);
+ ViewOwnerProxy.unbound()
+ : super(new _ViewOwnerProxyControl.unbound());
+
+ static ViewOwnerProxy newFromEndpoint(
+ core.MojoMessagePipeEndpoint endpoint) {
+ assert(endpoint.setDescription("For ViewOwnerProxy"));
+ return new ViewOwnerProxy.fromEndpoint(endpoint);
}
factory ViewOwnerProxy.connectToService(
@@ -331,30 +309,14 @@ class ViewOwnerProxy implements bindings.ProxyBase {
return p;
}
- static ViewOwnerProxy newFromEndpoint(
- core.MojoMessagePipeEndpoint endpoint) {
- assert(endpoint.setDescription("For ViewOwnerProxy"));
- return new ViewOwnerProxy.fromEndpoint(endpoint);
- }
-
- String get serviceName => ViewOwner.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 "ViewOwnerProxy($impl)";
+ dynamic getToken([Function responseFactory = null]) {
+ var params = new _ViewOwnerGetTokenParams();
+ return ctrl.sendMessageWithRequestId(
+ params,
+ _viewOwnerMethodGetTokenName,
+ -1,
+ bindings.MessageHeader.kMessageExpectsResponse);
}
}

Powered by Google App Engine
This is Rietveld 408576698