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

Unified Diff: runtime/bin/vmservice/client/lib/src/service/object.dart

Issue 345113002: Fix Observatory code coverage (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/bin/vmservice/client/lib/src/elements/script_view.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/vmservice/client/lib/src/service/object.dart
diff --git a/runtime/bin/vmservice/client/lib/src/service/object.dart b/runtime/bin/vmservice/client/lib/src/service/object.dart
index b0dc960b4a30719243d648e93fc6037ecd977e7f..233be876926cb4aad7575f318d9b312ce459d563 100644
--- a/runtime/bin/vmservice/client/lib/src/service/object.dart
+++ b/runtime/bin/vmservice/client/lib/src/service/object.dart
@@ -258,18 +258,18 @@ abstract class VM extends ServiceObjectOwner {
String isolateId = _parseIsolateId(id);
String objectId = _parseObjectId(id);
return _getIsolate(isolateId).then((isolate) {
- if (isolate == null) {
- // The isolate does not exist. Return the VM object instead.
- //
- // TODO(turnidge): Generate a service error?
- return this;
- }
- if (objectId == null) {
- return isolate.reload();
- } else {
- return isolate.get(objectId);
- }
- });
+ if (isolate == null) {
+ // The isolate does not exist. Return the VM object instead.
+ //
+ // TODO(turnidge): Generate a service error?
+ return this;
+ }
+ if (objectId == null) {
+ return isolate.reload();
+ } else {
+ return isolate.get(objectId);
+ }
+ });
}
var obj = _cache[id];
@@ -1119,15 +1119,16 @@ class Class extends ServiceObject {
}
}
-class ScriptLine {
- @reflectable final int line;
- @reflectable final String text;
+class ScriptLine extends Observable {
+ final int line;
+ final String text;
+ @observable int hits;
ScriptLine(this.line, this.text);
}
class Script extends ServiceObject {
- @reflectable final lines = new ObservableList<ScriptLine>();
- @reflectable final hits = new ObservableMap<int, int>();
+ final lines = new ObservableList<ScriptLine>();
+ final _hits = new Map<int, int>();
@observable String kind;
@observable int firstTokenPos;
@observable int lastTokenPos;
@@ -1196,12 +1197,14 @@ class Script extends ServiceObject {
void _processHits(List scriptHits) {
// Update hits table.
+ _hits.clear();
for (var i = 0; i < scriptHits.length; i += 2) {
var line = scriptHits[i];
var hit = scriptHits[i + 1]; // hit status.
assert(line >= 1); // Lines start at 1.
- hits[line] = hit;
+ _hits[line] = hit;
}
+ _applyHitsToLines();
}
void _processSource(String source) {
@@ -1221,6 +1224,17 @@ class Script extends ServiceObject {
for (var i = 0; i < sourceLines.length; i++) {
lines.add(new ScriptLine(i + 1, sourceLines[i]));
}
+ _applyHitsToLines();
+ }
+
+ void _applyHitsToLines() {
+ if (lines.length == 0) {
+ return;
+ }
+ for (var line in lines) {
+ var hits = _hits[line.line];
+ line.hits = hits;
+ }
}
}
« no previous file with comments | « runtime/bin/vmservice/client/lib/src/elements/script_view.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698