| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 import 'dart:async'; | 5 import 'dart:async'; |
| 6 | 6 |
| 7 import 'package:mojo/application.dart'; | 7 import 'package:mojo/application.dart'; |
| 8 import 'package:mojo/bindings.dart'; | 8 import 'package:mojo/bindings.dart'; |
| 9 import 'package:mojo/core.dart'; | 9 import 'package:mojo/core.dart'; |
| 10 | 10 |
| 11 import 'package:_mojo_for_test_only/test/pingpong_service.mojom.dart'; | 11 import 'package:_mojo_for_test_only/test/pingpong_service.mojom.dart'; |
| 12 | 12 |
| 13 class PingPongServiceImpl implements PingPongService { | 13 class PingPongServiceImpl implements PingPongService { |
| 14 PingPongServiceStub _stub; | 14 PingPongServiceStub _stub; |
| 15 Application _application; | 15 Application _application; |
| 16 PingPongClientProxy _pingPongClient; | 16 PingPongClientProxy _pingPongClient; |
| 17 | 17 |
| 18 PingPongServiceImpl(this._application, MojoMessagePipeEndpoint endpoint) { | 18 PingPongServiceImpl(this._application, MojoMessagePipeEndpoint endpoint) { |
| 19 _stub = new PingPongServiceStub.fromEndpoint(endpoint, this); | 19 _stub = new PingPongServiceStub.fromEndpoint(endpoint, this); |
| 20 } | 20 } |
| 21 | 21 |
| 22 PingPongServiceImpl.fromStub(this._stub) { | 22 PingPongServiceImpl.fromStub(this._stub) { |
| 23 _stub.impl = this; | 23 _stub.impl = this; |
| 24 } | 24 } |
| 25 | 25 |
| 26 void setClient(ProxyBase proxyBase) { | 26 void setClient(Proxy proxy) { |
| 27 assert(_pingPongClient == null); | 27 assert(_pingPongClient == null); |
| 28 _pingPongClient = proxyBase; | 28 _pingPongClient = proxy; |
| 29 } | 29 } |
| 30 | 30 |
| 31 void ping(int pingValue) => _pingPongClient.ptr.pong(pingValue + 1); | 31 void ping(int pingValue) => _pingPongClient.pong(pingValue + 1); |
| 32 | 32 |
| 33 // These methods are unimplemented; they merely throw on invocation. | 33 // These methods are unimplemented; they merely throw on invocation. |
| 34 dynamic pingTargetUrl(String url, int count, [Function responseFactory]) => | 34 dynamic pingTargetUrl(String url, int count, [Function responseFactory]) => |
| 35 throw "Unimplemented"; | 35 throw "Unimplemented"; |
| 36 dynamic pingTargetService( | 36 dynamic pingTargetService( |
| 37 Object service, int count, [Function responseFactory]) => | 37 Object service, int count, [Function responseFactory]) => |
| 38 throw "Unimplemented"; | 38 throw "Unimplemented"; |
| 39 dynamic getPingPongServiceDelayed( | 39 dynamic getPingPongServiceDelayed( |
| 40 Object service, [Function responseFactory]) => | 40 Object service, [Function responseFactory]) => |
| 41 throw "Unimplemented"; | 41 throw "Unimplemented"; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 61 Future closeApplication() async { | 61 Future closeApplication() async { |
| 62 await close(); | 62 await close(); |
| 63 MojoHandle.reportLeakedHandles(); | 63 MojoHandle.reportLeakedHandles(); |
| 64 } | 64 } |
| 65 } | 65 } |
| 66 | 66 |
| 67 main(List args, Object handleToken) { | 67 main(List args, Object handleToken) { |
| 68 MojoHandle appHandle = new MojoHandle(handleToken); | 68 MojoHandle appHandle = new MojoHandle(handleToken); |
| 69 new PingPongApplication.fromHandle(appHandle); | 69 new PingPongApplication.fromHandle(appHandle); |
| 70 } | 70 } |
| OLD | NEW |