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

Side by Side Diff: runtime/bin/vmservice/client/lib/src/observatory/isolate.dart

Issue 143973005: Code coverage in Observatory (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 11 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 observatory; 5 part of observatory;
6 6
7 /// State for a running isolate. 7 /// State for a running isolate.
8 class Isolate extends Observable { 8 class Isolate extends Observable {
9 @observable Profile profile; 9 @observable Profile profile;
10 @observable final Map<String, Script> scripts =
11 toObservable(new Map<String, Script>());
10 @observable final List<Code> codes = new List<Code>(); 12 @observable final List<Code> codes = new List<Code>();
11 @observable String id; 13 @observable String id;
12 @observable String name; 14 @observable String name;
13 @observable final Map<String, ScriptSource> scripts =
14 toObservable(new Map<String, ScriptSource>());
15 15
16 Isolate(this.id, this.name); 16 Isolate(this.id, this.name);
17 17
18 String toString() => '$id $name'; 18 String toString() => '$id $name';
19 19
20 Code findCodeByAddress(int address) { 20 Code findCodeByAddress(int address) {
21 for (var i = 0; i < codes.length; i++) { 21 for (var i = 0; i < codes.length; i++) {
22 if (codes[i].contains(address)) { 22 if (codes[i].contains(address)) {
23 return codes[i]; 23 return codes[i];
24 } 24 }
25 } 25 }
26 } 26 }
27 27
28 Code findCodeByName(String name) { 28 Code findCodeByName(String name) {
29 for (var i = 0; i < codes.length; i++) { 29 for (var i = 0; i < codes.length; i++) {
30 if (codes[i].name == name) { 30 if (codes[i].name == name) {
31 return codes[i]; 31 return codes[i];
32 } 32 }
33 } 33 }
34 } 34 }
35 35
36 void resetCodeTicks() { 36 void resetCodeTicks() {
37 Logger.root.info('Reset all code ticks.'); 37 Logger.root.info('Reset all code ticks.');
38 for (var i = 0; i < codes.length; i++) { 38 for (var i = 0; i < codes.length; i++) {
39 codes[i].resetTicks(); 39 codes[i].resetTicks();
40 } 40 }
41 } 41 }
42
43 void updateCoverage(List coverages) {
44 for (var coverage in coverages) {
45 var id = coverage['script']['id'];
46 var script = scripts[id];
47 if (script == null) {
48 script = new Script.fromMap(coverage['script']);
49 scripts[id] = script;
50 }
51 assert(script != null);
52 script._processCoverageHits(coverage['hits']);
53 }
54 }
42 } 55 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698