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

Side by Side Diff: runtime/observatory/lib/src/service/object.dart

Issue 959043003: Build script views programmatically. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 9 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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 service; 5 part of service;
6 6
7 /// A [ServiceObject] represents a persistent object within the vm. 7 /// A [ServiceObject] represents a persistent object within the vm.
8 abstract class ServiceObject extends Observable { 8 abstract class ServiceObject extends Observable {
9 static int LexicalSortName(ServiceObject o1, ServiceObject o2) { 9 static int LexicalSortName(ServiceObject o1, ServiceObject o2) {
10 return o1.name.compareTo(o2.name); 10 return o1.name.compareTo(o2.name);
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 if (this is! Isolate) { 301 if (this is! Isolate) {
302 params['targetId'] = id; 302 params['targetId'] = id;
303 } 303 }
304 return isolate.invokeRpcNoUpgrade('getCoverage', params).then( 304 return isolate.invokeRpcNoUpgrade('getCoverage', params).then(
305 (ObservableMap map) { 305 (ObservableMap map) {
306 var coverage = new ServiceObject._fromMap(isolate, map); 306 var coverage = new ServiceObject._fromMap(isolate, map);
307 assert(coverage.type == 'CodeCoverage'); 307 assert(coverage.type == 'CodeCoverage');
308 var coverageList = coverage['coverage']; 308 var coverageList = coverage['coverage'];
309 assert(coverageList != null); 309 assert(coverageList != null);
310 processCoverageData(coverageList); 310 processCoverageData(coverageList);
311 return this;
311 }); 312 });
312 } 313 }
313 } 314 }
314 315
315 abstract class ServiceObjectOwner extends ServiceObject { 316 abstract class ServiceObjectOwner extends ServiceObject {
316 /// Creates an empty [ServiceObjectOwner]. 317 /// Creates an empty [ServiceObjectOwner].
317 ServiceObjectOwner._empty(ServiceObjectOwner owner) : super._empty(owner); 318 ServiceObjectOwner._empty(ServiceObjectOwner owner) : super._empty(owner);
318 319
319 /// Builds a [ServiceObject] corresponding to the [id] from [map]. 320 /// Builds a [ServiceObject] corresponding to the [id] from [map].
320 /// The result may come from the cache. The result will not necessarily 321 /// The result may come from the cache. The result will not necessarily
(...skipping 1779 matching lines...) Expand 10 before | Expand all | Expand 10 after
2100 var line = scriptHits[i]; 2101 var line = scriptHits[i];
2101 var hit = scriptHits[i + 1]; // hit status. 2102 var hit = scriptHits[i + 1]; // hit status.
2102 assert(line >= 1); // Lines start at 1. 2103 assert(line >= 1); // Lines start at 1.
2103 var oldHits = _hits[line]; 2104 var oldHits = _hits[line];
2104 if (oldHits != null) { 2105 if (oldHits != null) {
2105 hit += oldHits; 2106 hit += oldHits;
2106 } 2107 }
2107 _hits[line] = hit; 2108 _hits[line] = hit;
2108 } 2109 }
2109 _applyHitsToLines(); 2110 _applyHitsToLines();
2111 notifyChange(null);
Cutch 2015/02/28 00:37:04 Add a comment about what this does.
rmacnak 2015/03/02 19:08:26 Done.
2110 } 2112 }
2111 2113
2112 void _processSource(String source) { 2114 void _processSource(String source) {
2113 // Preemptyively mark that this is not loaded. 2115 // Preemptyively mark that this is not loaded.
2114 _loaded = false; 2116 _loaded = false;
2115 if (source == null) { 2117 if (source == null) {
2116 return; 2118 return;
2117 } 2119 }
2118 var sourceLines = source.split('\n'); 2120 var sourceLines = source.split('\n');
2119 if (sourceLines.length == 0) { 2121 if (sourceLines.length == 0) {
2120 return; 2122 return;
2121 } 2123 }
2122 // We have the source to the script. This is now loaded. 2124 // We have the source to the script. This is now loaded.
2123 _loaded = true; 2125 _loaded = true;
2124 lines.clear(); 2126 lines.clear();
2125 Logger.root.info('Adding ${sourceLines.length} source lines for ${_url}'); 2127 Logger.root.info('Adding ${sourceLines.length} source lines for ${_url}');
2126 for (var i = 0; i < sourceLines.length; i++) { 2128 for (var i = 0; i < sourceLines.length; i++) {
2127 lines.add(new ScriptLine(this, i + 1, sourceLines[i])); 2129 lines.add(new ScriptLine(this, i + 1, sourceLines[i]));
2128 } 2130 }
2129 _applyHitsToLines(); 2131 _applyHitsToLines();
2132 notifyChange(null);
2130 } 2133 }
2131 2134
2132 void _applyHitsToLines() { 2135 void _applyHitsToLines() {
2133 for (var line in lines) { 2136 for (var line in lines) {
2134 var hits = _hits[line.line]; 2137 var hits = _hits[line.line];
2135 line.hits = hits; 2138 line.hits = hits;
2136 } 2139 }
2137 } 2140 }
2138 } 2141 }
2139 2142
(...skipping 669 matching lines...) Expand 10 before | Expand all | Expand 10 after
2809 var v = list[i]; 2812 var v = list[i];
2810 if ((v is ObservableMap) && _isServiceMap(v)) { 2813 if ((v is ObservableMap) && _isServiceMap(v)) {
2811 list[i] = owner.getFromMap(v); 2814 list[i] = owner.getFromMap(v);
2812 } else if (v is ObservableList) { 2815 } else if (v is ObservableList) {
2813 _upgradeObservableList(v, owner); 2816 _upgradeObservableList(v, owner);
2814 } else if (v is ObservableMap) { 2817 } else if (v is ObservableMap) {
2815 _upgradeObservableMap(v, owner); 2818 _upgradeObservableMap(v, owner);
2816 } 2819 }
2817 } 2820 }
2818 } 2821 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698