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 |
(...skipping 15 matching lines...) Expand all Loading... |
26 } | 26 } |
27 | 27 |
28 void setClient(PingPongClientInterface client) { | 28 void setClient(PingPongClientInterface client) { |
29 assert(_pingPongClient == null); | 29 assert(_pingPongClient == null); |
30 _pingPongClient = client; | 30 _pingPongClient = client; |
31 } | 31 } |
32 | 32 |
33 void ping(int pingValue) => _pingPongClient.pong(pingValue + 1); | 33 void ping(int pingValue) => _pingPongClient.pong(pingValue + 1); |
34 | 34 |
35 // These methods are unimplemented; they merely throw on invocation. | 35 // These methods are unimplemented; they merely throw on invocation. |
36 dynamic pingTargetUrl(String url, int count, [Function responseFactory]) => | 36 void pingTargetUrl(String url, int count, void callback(bool ok)) => |
37 throw "Unimplemented"; | 37 throw "Unimplemented"; |
38 dynamic pingTargetService(PingPongServiceInterface service, int count, | 38 void pingTargetService(PingPongServiceInterface service, int count, |
39 [Function responseFactory]) => | 39 void callback(bool ok)) => |
40 throw "Unimplemented"; | 40 throw "Unimplemented"; |
41 dynamic getPingPongServiceDelayed(PingPongServiceInterfaceRequest service, | 41 void getPingPongServiceDelayed(PingPongServiceInterfaceRequest service) => |
42 [Function responseFactory]) => | |
43 throw "Unimplemented"; | 42 throw "Unimplemented"; |
44 | 43 |
45 void getPingPongService(PingPongServiceInterfaceRequest service) { | 44 void getPingPongService(PingPongServiceInterfaceRequest service) { |
46 new PingPongServiceImpl.fromInterfaceRequest(service); | 45 new PingPongServiceImpl.fromInterfaceRequest(service); |
47 } | 46 } |
48 | 47 |
49 void quit() {} | 48 void quit() {} |
50 } | 49 } |
51 | 50 |
52 class PingPongApplication extends Application { | 51 class PingPongApplication extends Application { |
(...skipping 10 matching lines...) Expand all Loading... |
63 Future closeApplication() async { | 62 Future closeApplication() async { |
64 await close(); | 63 await close(); |
65 MojoHandle.reportLeakedHandles(); | 64 MojoHandle.reportLeakedHandles(); |
66 } | 65 } |
67 } | 66 } |
68 | 67 |
69 main(List args, Object handleToken) { | 68 main(List args, Object handleToken) { |
70 MojoHandle appHandle = new MojoHandle(handleToken); | 69 MojoHandle appHandle = new MojoHandle(handleToken); |
71 new PingPongApplication.fromHandle(appHandle); | 70 new PingPongApplication.fromHandle(appHandle); |
72 } | 71 } |
OLD | NEW |