| 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 TargetChangeEvent implements M.TargetChangeEvent { | 7 class TargetChangeEvent implements M.TargetChangeEvent { |
| 8 final TargetRepository repository; | 8 final TargetRepository repository; |
| 9 TargetChangeEvent(this.repository); | 9 TargetChangeEvent(this.repository); |
| 10 } | 10 } |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 _onChange.add(new TargetChangeEvent(this)); | 40 _onChange.add(new TargetChangeEvent(this)); |
| 41 _store(); | 41 _store(); |
| 42 } | 42 } |
| 43 | 43 |
| 44 Iterable<SC.WebSocketVMTarget> list() => _list; | 44 Iterable<SC.WebSocketVMTarget> list() => _list; |
| 45 | 45 |
| 46 void setCurrent(M.Target t) { | 46 void setCurrent(M.Target t) { |
| 47 SC.WebSocketVMTarget target = t as SC.WebSocketVMTarget; | 47 SC.WebSocketVMTarget target = t as SC.WebSocketVMTarget; |
| 48 if (!_list.contains(target)) return; | 48 if (!_list.contains(target)) return; |
| 49 current = target; | 49 current = target; |
| 50 current.lastConnectionTime = new DateTime.now().millisecondsSinceEpoch; |
| 50 _onChange.add(new TargetChangeEvent(this)); | 51 _onChange.add(new TargetChangeEvent(this)); |
| 52 _store(); |
| 51 } | 53 } |
| 52 | 54 |
| 53 void delete(o) { | 55 void delete(o) { |
| 54 if (_list.remove(o)) { | 56 if (_list.remove(o)) { |
| 55 if (o == current) { | 57 if (o == current) { |
| 56 current = null; | 58 current = null; |
| 57 } | 59 } |
| 58 _onChange.add(new TargetChangeEvent(this)); | 60 _onChange.add(new TargetChangeEvent(this)); |
| 59 _store(); | 61 _store(); |
| 60 } | 62 } |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 // We are running as JavaScript, use the same host that Observatory has | 95 // We are running as JavaScript, use the same host that Observatory has |
| 94 // been loaded from. | 96 // been loaded from. |
| 95 return 'ws://${window.location.host}/ws'; | 97 return 'ws://${window.location.host}/ws'; |
| 96 } else { | 98 } else { |
| 97 // Otherwise, assume we are running from Dart Editor and want to connect | 99 // Otherwise, assume we are running from Dart Editor and want to connect |
| 98 // to the default host. | 100 // to the default host. |
| 99 return 'ws://localhost:8181/ws'; | 101 return 'ws://localhost:8181/ws'; |
| 100 } | 102 } |
| 101 } | 103 } |
| 102 } | 104 } |
| OLD | NEW |