| 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 | 49 |
| 50 class PingPongApplication extends Application { | 50 class PingPongApplication extends Application { |
| 51 PingPongApplication.fromHandle(MojoHandle handle) : super.fromHandle(handle); | 51 PingPongApplication.fromHandle(MojoHandle handle) : super.fromHandle(handle); |
| 52 | 52 |
| 53 @override | 53 @override |
| 54 void acceptConnection(String requestorUrl, String resolvedUrl, | 54 void acceptConnection(String requestorUrl, String resolvedUrl, |
| 55 ApplicationConnection connection) { | 55 ApplicationConnection connection) { |
| 56 // Provide the service implemented by PingPongServiceImpl. | 56 // Provide the service implemented by PingPongServiceImpl. |
| 57 connection.provideService(PingPongService.serviceName, | 57 connection.provideService(PingPongService.serviceName, |
| 58 (endpoint) => new PingPongServiceImpl(this, endpoint)); | 58 (endpoint) => new PingPongServiceImpl(this, endpoint)); |
| 59 | |
| 60 // No services are required from the remote end. | |
| 61 connection.remoteServiceProvider.close(); | |
| 62 } | 59 } |
| 63 | 60 |
| 64 Future closeApplication() async { | 61 Future closeApplication() async { |
| 65 await close(); | 62 await close(); |
| 66 MojoHandle.reportLeakedHandles(); | 63 MojoHandle.reportLeakedHandles(); |
| 67 } | 64 } |
| 68 } | 65 } |
| 69 | 66 |
| 70 main(List args, Object handleToken) { | 67 main(List args, Object handleToken) { |
| 71 MojoHandle appHandle = new MojoHandle(handleToken); | 68 MojoHandle appHandle = new MojoHandle(handleToken); |
| 72 new PingPongApplication.fromHandle(appHandle); | 69 new PingPongApplication.fromHandle(appHandle); |
| 73 } | 70 } |
| OLD | NEW |