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

Unified Diff: mojo/dart/packages/mojo_services/lib/mojo/media/audio_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/media/audio_server.mojom.dart
diff --git a/mojo/dart/packages/mojo_services/lib/mojo/media/audio_server.mojom.dart b/mojo/dart/packages/mojo_services/lib/mojo/media/audio_server.mojom.dart
index 88ebb0dcbe4ebd5ae5c2a76ca2345474f4397afd..bd61c731f70104cca4515e00af6b1f0d4ee06ba5 100644
--- a/mojo/dart/packages/mojo_services/lib/mojo/media/audio_server.mojom.dart
+++ b/mojo/dart/packages/mojo_services/lib/mojo/media/audio_server.mojom.dart
@@ -100,24 +100,22 @@ abstract class AudioServer {
}
-class _AudioServerProxyImpl extends bindings.Proxy {
- _AudioServerProxyImpl.fromEndpoint(
+class _AudioServerProxyControl extends bindings.ProxyMessageHandler
+ implements bindings.ProxyControl {
+ _AudioServerProxyControl.fromEndpoint(
core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint);
- _AudioServerProxyImpl.fromHandle(core.MojoHandle handle) :
- super.fromHandle(handle);
+ _AudioServerProxyControl.fromHandle(
+ core.MojoHandle handle) : super.fromHandle(handle);
- _AudioServerProxyImpl.unbound() : super.unbound();
-
- static _AudioServerProxyImpl newFromEndpoint(
- core.MojoMessagePipeEndpoint endpoint) {
- assert(endpoint.setDescription("For _AudioServerProxyImpl"));
- return new _AudioServerProxyImpl.fromEndpoint(endpoint);
- }
+ _AudioServerProxyControl.unbound() : super.unbound();
service_describer.ServiceDescription get serviceDescription =>
- new _AudioServerServiceDescription();
+ new _AudioServerServiceDescription();
+
+ String get serviceName => AudioServer.serviceName;
+ @override
void handleResponse(bindings.ServiceMessage message) {
switch (message.header.type) {
default:
@@ -127,51 +125,30 @@ class _AudioServerProxyImpl extends bindings.Proxy {
}
}
+ @override
String toString() {
var superString = super.toString();
- return "_AudioServerProxyImpl($superString)";
+ return "_AudioServerProxyControl($superString)";
}
}
-class _AudioServerProxyCalls implements AudioServer {
- _AudioServerProxyImpl _proxyImpl;
-
- _AudioServerProxyCalls(this._proxyImpl);
- void createTrack(Object track) {
- if (!_proxyImpl.isBound) {
- _proxyImpl.proxyError("The Proxy is closed.");
- return;
- }
- var params = new _AudioServerCreateTrackParams();
- params.track = track;
- _proxyImpl.sendMessage(params, _audioServerMethodCreateTrackName);
- }
-}
-
-
-class AudioServerProxy implements bindings.ProxyBase {
- final bindings.Proxy impl;
- AudioServer ptr;
-
- AudioServerProxy(_AudioServerProxyImpl proxyImpl) :
- impl = proxyImpl,
- ptr = new _AudioServerProxyCalls(proxyImpl);
-
+class AudioServerProxy extends bindings.Proxy
+ implements AudioServer {
AudioServerProxy.fromEndpoint(
- core.MojoMessagePipeEndpoint endpoint) :
- impl = new _AudioServerProxyImpl.fromEndpoint(endpoint) {
- ptr = new _AudioServerProxyCalls(impl);
- }
+ core.MojoMessagePipeEndpoint endpoint)
+ : super(new _AudioServerProxyControl.fromEndpoint(endpoint));
- AudioServerProxy.fromHandle(core.MojoHandle handle) :
- impl = new _AudioServerProxyImpl.fromHandle(handle) {
- ptr = new _AudioServerProxyCalls(impl);
- }
+ AudioServerProxy.fromHandle(core.MojoHandle handle)
+ : super(new _AudioServerProxyControl.fromHandle(handle));
- AudioServerProxy.unbound() :
- impl = new _AudioServerProxyImpl.unbound() {
- ptr = new _AudioServerProxyCalls(impl);
+ AudioServerProxy.unbound()
+ : super(new _AudioServerProxyControl.unbound());
+
+ static AudioServerProxy newFromEndpoint(
+ core.MojoMessagePipeEndpoint endpoint) {
+ assert(endpoint.setDescription("For AudioServerProxy"));
+ return new AudioServerProxy.fromEndpoint(endpoint);
}
factory AudioServerProxy.connectToService(
@@ -181,30 +158,16 @@ class AudioServerProxy implements bindings.ProxyBase {
return p;
}
- static AudioServerProxy newFromEndpoint(
- core.MojoMessagePipeEndpoint endpoint) {
- assert(endpoint.setDescription("For AudioServerProxy"));
- return new AudioServerProxy.fromEndpoint(endpoint);
- }
-
- String get serviceName => AudioServer.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 "AudioServerProxy($impl)";
+ void createTrack(Object track) {
+ if (!ctrl.isBound) {
+ ctrl.proxyError("The Proxy is closed.");
+ return;
+ }
+ var params = new _AudioServerCreateTrackParams();
+ params.track = track;
+ ctrl.sendMessage(params,
+ _audioServerMethodCreateTrackName);
}
}

Powered by Google App Engine
This is Rietveld 408576698