| Index: services/dart/test/pingpong/main.dart
|
| diff --git a/services/dart/test/pingpong/main.dart b/services/dart/test/pingpong/main.dart
|
| index 01dd1cb95cce6bd5b101c3a4da5d7c214bbc850f..143325cbbf429218daf2e6e9a927e56a549e8c9a 100644
|
| --- a/services/dart/test/pingpong/main.dart
|
| +++ b/services/dart/test/pingpong/main.dart
|
| @@ -10,40 +10,39 @@ import 'mojo:core';
|
| import 'package:services/dart/test/pingpong_service.mojom.dart';
|
|
|
| class PingPongClientImpl implements PingPongClient {
|
| - final PingPongClientStub stub;
|
| + final PingPongClientBinding binding;
|
| Completer _completer;
|
| int _count;
|
|
|
| PingPongClientImpl.unbound(this._count, this._completer)
|
| - : stub = new PingPongClientStub.unbound() {
|
| - stub.delegate = this;
|
| + : binding = new PingPongClientBinding.unbound() {
|
| + binding.delegate = this;
|
| }
|
|
|
| void pong(int pongValue) {
|
| if (pongValue == _count) {
|
| _completer.complete(null);
|
| - stub.close();
|
| + binding.close();
|
| }
|
| }
|
| }
|
|
|
| class PingPongServiceImpl implements PingPongService {
|
| - PingPongServiceStub _stub;
|
| + PingPongServiceBinding _binding;
|
| Application _application;
|
| PingPongClientProxy _pingPongClient;
|
|
|
| PingPongServiceImpl(Application application, MojoMessagePipeEndpoint endpoint)
|
| : _application = application {
|
| - _stub = new PingPongServiceStub.fromEndpoint(endpoint)
|
| - ..delegate = this
|
| - ..listen();
|
| + _binding = new PingPongServiceBinding.fromEndpoint(
|
| + endpoint, delegate: this);
|
| }
|
|
|
| - PingPongServiceImpl.fromStub(this._stub) {
|
| - _stub.delegate = this;
|
| + PingPongServiceImpl.fromBinding(this._binding) {
|
| + _binding.delegate = this;
|
| }
|
|
|
| - listen() => _stub.listen();
|
| + listen() => _binding.listen();
|
|
|
| void setClient(ProxyBase proxyBase) {
|
| assert(_pingPongClient== null);
|
| @@ -61,18 +60,19 @@ class PingPongServiceImpl implements PingPongService {
|
| return responseFactory(false);
|
| }
|
| var completer = new Completer();
|
| - var pingPongService= new PingPongServiceProxy.unbound();
|
| + var pingPongService = new PingPongServiceProxy.unbound();
|
| _application.connectToService(url, pingPongService);
|
|
|
| var pingPongClient = new PingPongClientImpl.unbound(count, completer);
|
| - pingPongService.ptr.setClient(pingPongClient.stub);
|
| - pingPongClient.stub.listen();
|
| + pingPongService.ptr.setClient(pingPongClient.binding);
|
| + pingPongClient.binding.listen();
|
|
|
| for (var i = 0; i < count; i++) {
|
| pingPongService.ptr.ping(i);
|
| }
|
| await completer.future;
|
| pingPongService.ptr.quit();
|
| + pingPongService.close();
|
|
|
| return responseFactory(true);
|
| }
|
| @@ -83,20 +83,21 @@ class PingPongServiceImpl implements PingPongService {
|
| var pingPongService = proxyBase;
|
| var completer = new Completer();
|
| var client = new PingPongClientImpl.unbound(count, completer);
|
| - pingPongService.ptr.setClient(client.stub);
|
| - client.stub.listen();
|
| + pingPongService.ptr.setClient(client.binding);
|
| + client.binding.listen();
|
|
|
| for (var i = 0; i < count; i++) {
|
| pingPongService.ptr.ping(i);
|
| }
|
| await completer.future;
|
| pingPongService.ptr.quit();
|
| + pingPongService.close();
|
|
|
| return responseFactory(true);
|
| }
|
|
|
| - getPingPongService(PingPongServiceStub serviceStub) {
|
| - new PingPongServiceImpl.fromStub(serviceStub)..listen();
|
| + getPingPongService(PingPongServiceBinding serviceBinding) {
|
| + new PingPongServiceImpl.fromBinding(serviceBinding)..listen();
|
| }
|
|
|
| void quit() {
|
| @@ -104,17 +105,17 @@ class PingPongServiceImpl implements PingPongService {
|
| _pingPongClient.close();
|
| _pingPongClient = null;
|
| }
|
| - _stub.close();
|
| - if (_application != null) {
|
| - _application.close();
|
| - }
|
| + _binding.close();
|
| + _binding = null;
|
| }
|
| }
|
|
|
| class PingPongApplication extends Application {
|
| PingPongApplication.fromHandle(MojoHandle handle) : super.fromHandle(handle);
|
|
|
| - void acceptConnection(String requestorUrl, ApplicationConnection connection) {
|
| + void acceptConnection(String requestorUrl,
|
| + ApplicationConnection connection,
|
| + String resolvedUrl) {
|
| connection.provideService(PingPongServiceName,
|
| (endpoint) => new PingPongServiceImpl(this, endpoint));
|
| connection.listen();
|
|
|