| 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 import 'package:_mojo_for_test_only/mojo/examples/echo.mojom.dart'; | 10 import 'package:_mojo_for_test_only/mojo/examples/echo.mojom.dart'; |
| 11 | 11 |
| 12 class EchoImpl implements Echo { | 12 class EchoImpl implements Echo { |
| 13 EchoStub _stub; | 13 EchoStub _stub; |
| 14 EchoApplication _application; | 14 EchoApplication _application; |
| 15 | 15 |
| 16 EchoImpl(this._application, MojoMessagePipeEndpoint endpoint) { | 16 EchoImpl(this._application, MojoMessagePipeEndpoint endpoint) { |
| 17 _stub = new EchoStub.fromEndpoint(endpoint, this); | 17 _stub = new EchoStub.fromEndpoint(endpoint, this); |
| 18 _stub.onError = _errorHandler; | 18 _stub.ctrl.onError = _errorHandler; |
| 19 } | 19 } |
| 20 | 20 |
| 21 echoString(String value, [Function responseFactory]) => | 21 echoString(String value, [Function responseFactory]) => |
| 22 responseFactory(value); | 22 responseFactory(value); |
| 23 | 23 |
| 24 Future close() => _stub.close(); | 24 Future close() => _stub.close(); |
| 25 | 25 |
| 26 _errorHandler(Object e) => _application.removeService(this); | 26 _errorHandler(Object e) => _application.removeService(this); |
| 27 } | 27 } |
| 28 | 28 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 await service.close(); | 65 await service.close(); |
| 66 } | 66 } |
| 67 MojoHandle.reportLeakedHandles(); | 67 MojoHandle.reportLeakedHandles(); |
| 68 } | 68 } |
| 69 } | 69 } |
| 70 | 70 |
| 71 main(List args, Object handleToken) { | 71 main(List args, Object handleToken) { |
| 72 MojoHandle appHandle = new MojoHandle(handleToken); | 72 MojoHandle appHandle = new MojoHandle(handleToken); |
| 73 new EchoApplication.fromHandle(appHandle); | 73 new EchoApplication.fromHandle(appHandle); |
| 74 } | 74 } |
| OLD | NEW |