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

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 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 if (this is! Isolate) { 306 if (this is! Isolate) {
307 params['targetId'] = id; 307 params['targetId'] = id;
308 } 308 }
309 return isolate.invokeRpcNoUpgrade('getCoverage', params).then( 309 return isolate.invokeRpcNoUpgrade('getCoverage', params).then(
310 (ObservableMap map) { 310 (ObservableMap map) {
311 var coverage = new ServiceObject._fromMap(isolate, map); 311 var coverage = new ServiceObject._fromMap(isolate, map);
312 assert(coverage.type == 'CodeCoverage'); 312 assert(coverage.type == 'CodeCoverage');
313 var coverageList = coverage['coverage']; 313 var coverageList = coverage['coverage'];
314 assert(coverageList != null); 314 assert(coverageList != null);
315 processCoverageData(coverageList); 315 processCoverageData(coverageList);
316 return this;
316 }); 317 });
317 } 318 }
318 } 319 }
319 320
320 abstract class ServiceObjectOwner extends ServiceObject { 321 abstract class ServiceObjectOwner extends ServiceObject {
321 /// Creates an empty [ServiceObjectOwner]. 322 /// Creates an empty [ServiceObjectOwner].
322 ServiceObjectOwner._empty(ServiceObjectOwner owner) : super._empty(owner); 323 ServiceObjectOwner._empty(ServiceObjectOwner owner) : super._empty(owner);
323 324
324 /// Builds a [ServiceObject] corresponding to the [id] from [map]. 325 /// Builds a [ServiceObject] corresponding to the [id] from [map].
325 /// The result may come from the cache. The result will not necessarily 326 /// The result may come from the cache. The result will not necessarily
(...skipping 1783 matching lines...) Expand 10 before | Expand all | Expand 10 after
2109 var line = scriptHits[i]; 2110 var line = scriptHits[i];
2110 var hit = scriptHits[i + 1]; // hit status. 2111 var hit = scriptHits[i + 1]; // hit status.
2111 assert(line >= 1); // Lines start at 1. 2112 assert(line >= 1); // Lines start at 1.
2112 var oldHits = _hits[line]; 2113 var oldHits = _hits[line];
2113 if (oldHits != null) { 2114 if (oldHits != null) {
2114 hit += oldHits; 2115 hit += oldHits;
2115 } 2116 }
2116 _hits[line] = hit; 2117 _hits[line] = hit;
2117 } 2118 }
2118 _applyHitsToLines(); 2119 _applyHitsToLines();
2120 // Notify any Observers that this Script's state has changed.
2121 notifyChange(null);
2119 } 2122 }
2120 2123
2121 void _processSource(String source) { 2124 void _processSource(String source) {
2122 // Preemptyively mark that this is not loaded. 2125 // Preemptyively mark that this is not loaded.
2123 _loaded = false; 2126 _loaded = false;
2124 if (source == null) { 2127 if (source == null) {
2125 return; 2128 return;
2126 } 2129 }
2127 var sourceLines = source.split('\n'); 2130 var sourceLines = source.split('\n');
2128 if (sourceLines.length == 0) { 2131 if (sourceLines.length == 0) {
2129 return; 2132 return;
2130 } 2133 }
2131 // We have the source to the script. This is now loaded. 2134 // We have the source to the script. This is now loaded.
2132 _loaded = true; 2135 _loaded = true;
2133 lines.clear(); 2136 lines.clear();
2134 Logger.root.info('Adding ${sourceLines.length} source lines for ${_url}'); 2137 Logger.root.info('Adding ${sourceLines.length} source lines for ${_url}');
2135 for (var i = 0; i < sourceLines.length; i++) { 2138 for (var i = 0; i < sourceLines.length; i++) {
2136 lines.add(new ScriptLine(this, i + 1, sourceLines[i])); 2139 lines.add(new ScriptLine(this, i + 1, sourceLines[i]));
2137 } 2140 }
2138 _applyHitsToLines(); 2141 _applyHitsToLines();
2142 // Notify any Observers that this Script's state has changed.
2143 notifyChange(null);
2139 } 2144 }
2140 2145
2141 void _applyHitsToLines() { 2146 void _applyHitsToLines() {
2142 for (var line in lines) { 2147 for (var line in lines) {
2143 var hits = _hits[line.line]; 2148 var hits = _hits[line.line];
2144 line.hits = hits; 2149 line.hits = hits;
2145 } 2150 }
2146 } 2151 }
2147 } 2152 }
2148 2153
(...skipping 669 matching lines...) Expand 10 before | Expand all | Expand 10 after
2818 var v = list[i]; 2823 var v = list[i];
2819 if ((v is ObservableMap) && _isServiceMap(v)) { 2824 if ((v is ObservableMap) && _isServiceMap(v)) {
2820 list[i] = owner.getFromMap(v); 2825 list[i] = owner.getFromMap(v);
2821 } else if (v is ObservableList) { 2826 } else if (v is ObservableList) {
2822 _upgradeObservableList(v, owner); 2827 _upgradeObservableList(v, owner);
2823 } else if (v is ObservableMap) { 2828 } else if (v is ObservableMap) {
2824 _upgradeObservableMap(v, owner); 2829 _upgradeObservableMap(v, owner);
2825 } 2830 }
2826 } 2831 }
2827 } 2832 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698