Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(162)

Side by Side Diff: runtime/observatory/lib/src/repositories/target.dart

Issue 2244413004: Saving last connection time in Observatory settings (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698