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

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

Issue 2277543004: Converted Observatory script-inset & source-inset elements (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Converted Observatory eval-box element Created 4 years, 3 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
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 // Some value smaller than the object ring, so requesting a large array 7 // Some value smaller than the object ring, so requesting a large array
8 // doesn't result in an expired ref because the elements lapped it in the 8 // doesn't result in an expired ref because the elements lapped it in the
9 // object ring. 9 // object ring.
10 const int kDefaultFieldLimit = 100; 10 const int kDefaultFieldLimit = 100;
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 abstract class ServiceObjectOwner extends ServiceObject { 411 abstract class ServiceObjectOwner extends ServiceObject {
412 /// Creates an empty [ServiceObjectOwner]. 412 /// Creates an empty [ServiceObjectOwner].
413 ServiceObjectOwner._empty(ServiceObjectOwner owner) : super._empty(owner); 413 ServiceObjectOwner._empty(ServiceObjectOwner owner) : super._empty(owner);
414 414
415 /// Builds a [ServiceObject] corresponding to the [id] from [map]. 415 /// Builds a [ServiceObject] corresponding to the [id] from [map].
416 /// The result may come from the cache. The result will not necessarily 416 /// The result may come from the cache. The result will not necessarily
417 /// be [loaded]. 417 /// be [loaded].
418 ServiceObject getFromMap(ObservableMap map); 418 ServiceObject getFromMap(ObservableMap map);
419 } 419 }
420 420
421 abstract class Location { 421 abstract class Location implements M.Location {
422 Script get script; 422 Script get script;
423 int get tokenPos; 423 int get tokenPos;
424 } 424 }
425 425
426 /// A [SourceLocation] represents a location or range in the source code. 426 /// A [SourceLocation] represents a location or range in the source code.
427 class SourceLocation extends ServiceObject implements Location, 427 class SourceLocation extends ServiceObject implements Location,
428 M.SourceLocation { 428 M.SourceLocation {
429 Script script; 429 Script script;
430 int tokenPos; 430 int tokenPos;
431 int endTokenPos; 431 int endTokenPos;
(...skipping 30 matching lines...) Expand all
462 if (endTokenPos == null) { 462 if (endTokenPos == null) {
463 return '${script.name}:token(${tokenPos})'; 463 return '${script.name}:token(${tokenPos})';
464 } else { 464 } else {
465 return '${script.name}:tokens(${tokenPos}-${endTokenPos})'; 465 return '${script.name}:tokens(${tokenPos}-${endTokenPos})';
466 } 466 }
467 } 467 }
468 } 468 }
469 469
470 /// An [UnresolvedSourceLocation] represents a location in the source 470 /// An [UnresolvedSourceLocation] represents a location in the source
471 // code which has not been precisely mapped to a token position. 471 // code which has not been precisely mapped to a token position.
472 class UnresolvedSourceLocation extends ServiceObject implements Location { 472 class UnresolvedSourceLocation extends ServiceObject
473 implements Location,
474 M.UnresolvedSourceLocation {
473 Script script; 475 Script script;
474 String scriptUri; 476 String scriptUri;
475 int line; 477 int line;
476 int column; 478 int column;
477 int tokenPos; 479 int tokenPos;
478 480
479 Future<int> getLine() async { 481 Future<int> getLine() async {
480 if (tokenPos != null) { 482 if (tokenPos != null) {
481 await script.load(); 483 await script.load();
482 return script.tokenToLine(tokenPos); 484 return script.tokenToLine(tokenPos);
(...skipping 1220 matching lines...) Expand 10 before | Expand all | Expand 10 after
1703 } 1705 }
1704 1706
1705 Future<ObjectStore> getObjectStore() { 1707 Future<ObjectStore> getObjectStore() {
1706 return invokeRpcNoUpgrade('_getObjectStore', {}).then((map) { 1708 return invokeRpcNoUpgrade('_getObjectStore', {}).then((map) {
1707 ObjectStore objectStore = new ObjectStore._empty(this); 1709 ObjectStore objectStore = new ObjectStore._empty(this);
1708 objectStore._update(map, false); 1710 objectStore._update(map, false);
1709 return objectStore; 1711 return objectStore;
1710 }); 1712 });
1711 } 1713 }
1712 1714
1713 Future<ServiceObject> _eval(ServiceObject target, 1715 Future<ServiceObject> eval(ServiceObject target,
1714 String expression) { 1716 String expression) {
1715 Map params = { 1717 Map params = {
1716 'targetId': target.id, 1718 'targetId': target.id,
1717 'expression': expression, 1719 'expression': expression,
1718 }; 1720 };
1719 return invokeRpc('evaluate', params); 1721 return invokeRpc('evaluate', params);
1720 } 1722 }
1721 1723
1722 Future<ServiceObject> evalFrame(int frameIndex, 1724 Future<ServiceObject> evalFrame(int frameIndex,
1723 String expression) { 1725 String expression) {
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after
2202 2204
2203 LibraryDependency._(this.isImport, this.isDeferred, this.prefix, this.target); 2205 LibraryDependency._(this.isImport, this.isDeferred, this.prefix, this.target);
2204 2206
2205 static _fromMap(map) => new LibraryDependency._(map["isImport"], 2207 static _fromMap(map) => new LibraryDependency._(map["isImport"],
2206 map["isDeferred"], 2208 map["isDeferred"],
2207 map["prefix"], 2209 map["prefix"],
2208 map["target"]); 2210 map["target"]);
2209 } 2211 }
2210 2212
2211 2213
2212 class Library extends HeapObject implements M.LibraryRef { 2214 class Library extends HeapObject implements M.Library {
2213 @observable String uri; 2215 @observable String uri;
2214 @reflectable final dependencies = new ObservableList<LibraryDependency>(); 2216 @reflectable final dependencies = new ObservableList<LibraryDependency>();
2215 @reflectable final scripts = new ObservableList<Script>(); 2217 @reflectable final scripts = new ObservableList<Script>();
2216 @reflectable final classes = new ObservableList<Class>(); 2218 @reflectable final classes = new ObservableList<Class>();
2217 @reflectable final variables = new ObservableList<Field>(); 2219 @reflectable final variables = new ObservableList<Field>();
2218 @reflectable final functions = new ObservableList<ServiceFunction>(); 2220 @reflectable final functions = new ObservableList<ServiceFunction>();
2219 2221
2220 bool get immutable => false; 2222 bool get immutable => false;
2221 2223
2222 bool isDart(String libraryName) { 2224 bool isDart(String libraryName) {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
2254 classes.sort(ServiceObject.LexicalSortName); 2256 classes.sort(ServiceObject.LexicalSortName);
2255 variables.clear(); 2257 variables.clear();
2256 variables.addAll(map['variables']); 2258 variables.addAll(map['variables']);
2257 variables.sort(ServiceObject.LexicalSortName); 2259 variables.sort(ServiceObject.LexicalSortName);
2258 functions.clear(); 2260 functions.clear();
2259 functions.addAll(map['functions']); 2261 functions.addAll(map['functions']);
2260 functions.sort(ServiceObject.LexicalSortName); 2262 functions.sort(ServiceObject.LexicalSortName);
2261 } 2263 }
2262 2264
2263 Future<ServiceObject> evaluate(String expression) { 2265 Future<ServiceObject> evaluate(String expression) {
2264 return isolate._eval(this, expression); 2266 return isolate.eval(this, expression);
2265 } 2267 }
2266 2268
2267 Script get rootScript { 2269 Script get rootScript {
2268 for (Script script in scripts) { 2270 for (Script script in scripts) {
2269 if (script.uri == uri) return script; 2271 if (script.uri == uri) return script;
2270 } 2272 }
2271 return null; 2273 return null;
2272 } 2274 }
2273 2275
2274 String toString() => "Library($uri)"; 2276 String toString() => "Library($uri)";
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
2422 2424
2423 void _addSubclass(Class subclass) { 2425 void _addSubclass(Class subclass) {
2424 if (subclasses.contains(subclass)) { 2426 if (subclasses.contains(subclass)) {
2425 return; 2427 return;
2426 } 2428 }
2427 subclasses.add(subclass); 2429 subclasses.add(subclass);
2428 subclasses.sort(ServiceObject.LexicalSortName); 2430 subclasses.sort(ServiceObject.LexicalSortName);
2429 } 2431 }
2430 2432
2431 Future<ServiceObject> evaluate(String expression) { 2433 Future<ServiceObject> evaluate(String expression) {
2432 return isolate._eval(this, expression); 2434 return isolate.eval(this, expression);
2433 } 2435 }
2434 2436
2435 Future<ServiceObject> setTraceAllocations(bool enable) { 2437 Future<ServiceObject> setTraceAllocations(bool enable) {
2436 return isolate.invokeRpc('_setTraceClassAllocation', { 2438 return isolate.invokeRpc('_setTraceClassAllocation', {
2437 'enable': enable, 2439 'enable': enable,
2438 'classId': id, 2440 'classId': id,
2439 }); 2441 });
2440 } 2442 }
2441 2443
2442 Future<ServiceObject> getAllocationSamples([String tags = 'None']) { 2444 Future<ServiceObject> getAllocationSamples([String tags = 'None']) {
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
2746 if (isClosure) { 2748 if (isClosure) {
2747 return closureFunction.qualifiedName; 2749 return closureFunction.qualifiedName;
2748 } 2750 }
2749 if (valueAsString != null) { 2751 if (valueAsString != null) {
2750 return valueAsString; 2752 return valueAsString;
2751 } 2753 }
2752 return 'a ${clazz.name}'; 2754 return 'a ${clazz.name}';
2753 } 2755 }
2754 2756
2755 Future<ServiceObject> evaluate(String expression) { 2757 Future<ServiceObject> evaluate(String expression) {
2756 return isolate._eval(this, expression); 2758 return isolate.eval(this, expression);
2757 } 2759 }
2758 2760
2759 String toString() => 'Instance($shortName)'; 2761 String toString() => 'Instance($shortName)';
2760 } 2762 }
2761 2763
2762 2764
2763 class Context extends HeapObject implements M.Context { 2765 class Context extends HeapObject implements M.Context {
2764 @observable Context parentContext; 2766 @observable Context parentContext;
2765 @observable int length; 2767 @observable int length;
2766 @observable Iterable<ContextElement> variables; 2768 @observable Iterable<ContextElement> variables;
(...skipping 1528 matching lines...) Expand 10 before | Expand all | Expand 10 after
4295 var v = list[i]; 4297 var v = list[i];
4296 if ((v is ObservableMap) && _isServiceMap(v)) { 4298 if ((v is ObservableMap) && _isServiceMap(v)) {
4297 list[i] = owner.getFromMap(v); 4299 list[i] = owner.getFromMap(v);
4298 } else if (v is ObservableList) { 4300 } else if (v is ObservableList) {
4299 _upgradeObservableList(v, owner); 4301 _upgradeObservableList(v, owner);
4300 } else if (v is ObservableMap) { 4302 } else if (v is ObservableMap) {
4301 _upgradeObservableMap(v, owner); 4303 _upgradeObservableMap(v, owner);
4302 } 4304 }
4303 } 4305 }
4304 } 4306 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698