OLD | NEW |
1 #!mojo mojo:dart_content_handler | 1 #!mojo mojo:dart_content_handler |
2 | 2 |
3 // Copyright 2015 The Chromium Authors. All rights reserved. | 3 // Copyright 2015 The Chromium Authors. All rights reserved. |
4 // Use of this source code is governed by a BSD-style license that can be | 4 // Use of this source code is governed by a BSD-style license that can be |
5 // found in the LICENSE file. | 5 // found in the LICENSE file. |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:mojo_application'; | 8 import 'dart:mojo_application'; |
9 import 'dart:mojo_bindings'; | 9 import 'dart:mojo_bindings'; |
10 import 'dart:mojo_core'; | 10 import 'dart:mojo_core'; |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 getPingPongService(PingPongServiceStub stub) { | 87 getPingPongService(PingPongServiceStub stub) { |
88 stub.delegate = new PingPongServiceImpl.unbound(); | 88 stub.delegate = new PingPongServiceImpl.unbound(); |
89 stub.listen(); | 89 stub.listen(); |
90 } | 90 } |
91 | 91 |
92 void quit() { | 92 void quit() { |
93 if (_proxy != null) { | 93 if (_proxy != null) { |
94 _proxy.close(); | 94 _proxy.close(); |
95 } | 95 } |
96 close(); | 96 close(); |
| 97 if (_application != null) { |
| 98 _application.close(); |
| 99 } |
97 } | 100 } |
98 } | 101 } |
99 | 102 |
100 class PingPongApplication extends Application { | 103 class PingPongApplication extends Application { |
101 PingPongApplication.fromHandle(MojoHandle handle) : super.fromHandle(handle); | 104 PingPongApplication.fromHandle(MojoHandle handle) : super.fromHandle(handle); |
102 | 105 |
103 Function stubFactoryClosure() => | 106 Function stubFactoryClosure() => |
104 (endpoint) => new PingPongServiceImpl(this, endpoint); | 107 (endpoint) => new PingPongServiceImpl(this, endpoint); |
105 } | 108 } |
106 | 109 |
107 main(List args) { | 110 main(List args) { |
108 MojoHandle shellHandle = new MojoHandle(args[0]); | 111 MojoHandle appHandle = new MojoHandle(args[0]); |
109 String url = args[1]; | 112 String url = args[1]; |
110 var pingPongApplication = new PingPongApplication.fromHandle(shellHandle); | 113 var pingPongApplication = new PingPongApplication.fromHandle(appHandle); |
111 pingPongApplication.listen(); | 114 pingPongApplication.listen(); |
112 } | 115 } |
OLD | NEW |