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

Unified Diff: mojo/dart/packages/mojo_services/lib/mojo/http_server.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/http_server.mojom.dart
diff --git a/mojo/dart/packages/mojo_services/lib/mojo/http_server.mojom.dart b/mojo/dart/packages/mojo_services/lib/mojo/http_server.mojom.dart
index bd55edea9d3326eea26ff343489c732a8d853811..2712cb6d34b85323a515d57d1fe7c5a66259902d 100644
--- a/mojo/dart/packages/mojo_services/lib/mojo/http_server.mojom.dart
+++ b/mojo/dart/packages/mojo_services/lib/mojo/http_server.mojom.dart
@@ -113,24 +113,22 @@ abstract class HttpServerDelegate {
}
-class _HttpServerDelegateProxyImpl extends bindings.Proxy {
- _HttpServerDelegateProxyImpl.fromEndpoint(
+class _HttpServerDelegateProxyControl extends bindings.ProxyMessageHandler
+ implements bindings.ProxyControl {
+ _HttpServerDelegateProxyControl.fromEndpoint(
core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint);
- _HttpServerDelegateProxyImpl.fromHandle(core.MojoHandle handle) :
- super.fromHandle(handle);
+ _HttpServerDelegateProxyControl.fromHandle(
+ core.MojoHandle handle) : super.fromHandle(handle);
- _HttpServerDelegateProxyImpl.unbound() : super.unbound();
-
- static _HttpServerDelegateProxyImpl newFromEndpoint(
- core.MojoMessagePipeEndpoint endpoint) {
- assert(endpoint.setDescription("For _HttpServerDelegateProxyImpl"));
- return new _HttpServerDelegateProxyImpl.fromEndpoint(endpoint);
- }
+ _HttpServerDelegateProxyControl.unbound() : super.unbound();
service_describer.ServiceDescription get serviceDescription =>
- new _HttpServerDelegateServiceDescription();
+ new _HttpServerDelegateServiceDescription();
+
+ String get serviceName => HttpServerDelegate.serviceName;
+ @override
void handleResponse(bindings.ServiceMessage message) {
switch (message.header.type) {
default:
@@ -140,52 +138,30 @@ class _HttpServerDelegateProxyImpl extends bindings.Proxy {
}
}
+ @override
String toString() {
var superString = super.toString();
- return "_HttpServerDelegateProxyImpl($superString)";
+ return "_HttpServerDelegateProxyControl($superString)";
}
}
-class _HttpServerDelegateProxyCalls implements HttpServerDelegate {
- _HttpServerDelegateProxyImpl _proxyImpl;
-
- _HttpServerDelegateProxyCalls(this._proxyImpl);
- void onConnected(Object connection, Object delegate) {
- if (!_proxyImpl.isBound) {
- _proxyImpl.proxyError("The Proxy is closed.");
- return;
- }
- var params = new _HttpServerDelegateOnConnectedParams();
- params.connection = connection;
- params.delegate = delegate;
- _proxyImpl.sendMessage(params, _httpServerDelegateMethodOnConnectedName);
- }
-}
-
-
-class HttpServerDelegateProxy implements bindings.ProxyBase {
- final bindings.Proxy impl;
- HttpServerDelegate ptr;
-
- HttpServerDelegateProxy(_HttpServerDelegateProxyImpl proxyImpl) :
- impl = proxyImpl,
- ptr = new _HttpServerDelegateProxyCalls(proxyImpl);
-
+class HttpServerDelegateProxy extends bindings.Proxy
+ implements HttpServerDelegate {
HttpServerDelegateProxy.fromEndpoint(
- core.MojoMessagePipeEndpoint endpoint) :
- impl = new _HttpServerDelegateProxyImpl.fromEndpoint(endpoint) {
- ptr = new _HttpServerDelegateProxyCalls(impl);
- }
+ core.MojoMessagePipeEndpoint endpoint)
+ : super(new _HttpServerDelegateProxyControl.fromEndpoint(endpoint));
- HttpServerDelegateProxy.fromHandle(core.MojoHandle handle) :
- impl = new _HttpServerDelegateProxyImpl.fromHandle(handle) {
- ptr = new _HttpServerDelegateProxyCalls(impl);
- }
+ HttpServerDelegateProxy.fromHandle(core.MojoHandle handle)
+ : super(new _HttpServerDelegateProxyControl.fromHandle(handle));
- HttpServerDelegateProxy.unbound() :
- impl = new _HttpServerDelegateProxyImpl.unbound() {
- ptr = new _HttpServerDelegateProxyCalls(impl);
+ HttpServerDelegateProxy.unbound()
+ : super(new _HttpServerDelegateProxyControl.unbound());
+
+ static HttpServerDelegateProxy newFromEndpoint(
+ core.MojoMessagePipeEndpoint endpoint) {
+ assert(endpoint.setDescription("For HttpServerDelegateProxy"));
+ return new HttpServerDelegateProxy.fromEndpoint(endpoint);
}
factory HttpServerDelegateProxy.connectToService(
@@ -195,30 +171,17 @@ class HttpServerDelegateProxy implements bindings.ProxyBase {
return p;
}
- static HttpServerDelegateProxy newFromEndpoint(
- core.MojoMessagePipeEndpoint endpoint) {
- assert(endpoint.setDescription("For HttpServerDelegateProxy"));
- return new HttpServerDelegateProxy.fromEndpoint(endpoint);
- }
-
- String get serviceName => HttpServerDelegate.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 "HttpServerDelegateProxy($impl)";
+ void onConnected(Object connection, Object delegate) {
+ if (!ctrl.isBound) {
+ ctrl.proxyError("The Proxy is closed.");
+ return;
+ }
+ var params = new _HttpServerDelegateOnConnectedParams();
+ params.connection = connection;
+ params.delegate = delegate;
+ ctrl.sendMessage(params,
+ _httpServerDelegateMethodOnConnectedName);
}
}

Powered by Google App Engine
This is Rietveld 408576698