OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file | 3 // BSD-style license that can be found in the LICENSE file |
4 | 4 |
5 part of repositories; | 5 part of repositories; |
6 | 6 |
7 class IsolateRepository extends M.IsolateRepository { | 7 class IsolateRepository extends M.IsolateRepository { |
| 8 final S.VM _vm; |
| 9 |
| 10 Iterable<M.Service> get reloadSourcesServices => |
| 11 _vm.services.where((S.Service s) => s.service == 'reloadSources'); |
| 12 |
| 13 IsolateRepository(this._vm) { |
| 14 assert(_vm == null); |
| 15 } |
| 16 |
8 Future<M.Isolate> get(M.IsolateRef i) async { | 17 Future<M.Isolate> get(M.IsolateRef i) async { |
9 S.Isolate isolate = i as S.Isolate; | 18 S.Isolate isolate = i as S.Isolate; |
10 assert(isolate != null); | 19 assert(isolate != null); |
11 try { | 20 try { |
12 await isolate.reload(); | 21 await isolate.reload(); |
13 } on SC.NetworkRpcException catch (_) { | 22 } on SC.NetworkRpcException catch (_) { |
14 /* ignore */ | 23 /* ignore */ |
15 } | 24 } |
16 return isolate; | 25 return isolate; |
17 } | 26 } |
18 | 27 |
19 Future reloadSources(M.IsolateRef i) async { | 28 Future reloadSources(M.IsolateRef i, {M.Service service}) async { |
20 S.Isolate isolate = i as S.Isolate; | 29 if (service == null) { |
21 assert(isolate != null); | 30 S.Isolate isolate = i as S.Isolate; |
22 await isolate.reloadSources(); | 31 assert(isolate != null); |
| 32 await isolate.reloadSources(); |
| 33 } else { |
| 34 S.Service srv = service as S.Service; |
| 35 assert(srv != null); |
| 36 await _vm.invokeRpcNoUpgrade(srv.method, {'isolateId': i.id}); |
| 37 } |
23 } | 38 } |
24 } | 39 } |
OLD | NEW |