| OLD | NEW |
| 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] is an object known to the VM service and is tied | 7 /// A [ServiceObject] is an object known to the VM service and is tied |
| 8 /// to an owning [Isolate]. | 8 /// to an owning [Isolate]. |
| 9 abstract class ServiceObject extends Observable { | 9 abstract class ServiceObject extends Observable { |
| 10 static int LexicalSortName(ServiceObject o1, ServiceObject o2) { | 10 static int LexicalSortName(ServiceObject o1, ServiceObject o2) { |
| (...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 380 return; | 380 return; |
| 381 } | 381 } |
| 382 if (map['type'] != 'ServiceEvent') { | 382 if (map['type'] != 'ServiceEvent') { |
| 383 Logger.root.severe( | 383 Logger.root.severe( |
| 384 "Expected 'ServiceEvent' but found '${map['type']}'"); | 384 "Expected 'ServiceEvent' but found '${map['type']}'"); |
| 385 return; | 385 return; |
| 386 } | 386 } |
| 387 | 387 |
| 388 // Extract the owning isolate from the event itself. | 388 // Extract the owning isolate from the event itself. |
| 389 String owningIsolateId = map['isolate']['id']; | 389 String owningIsolateId = map['isolate']['id']; |
| 390 _getIsolate(owningIsolateId).then((owningIsolate) { | 390 getIsolate(owningIsolateId).then((owningIsolate) { |
| 391 if (owningIsolate == null) { | 391 if (owningIsolate == null) { |
| 392 // TODO(koda): Do we care about GC events in VM isolate? | 392 // TODO(koda): Do we care about GC events in VM isolate? |
| 393 Logger.root.severe( | 393 Logger.root.severe( |
| 394 'Ignoring event with unknown isolate id: $owningIsolateId'); | 394 'Ignoring event with unknown isolate id: $owningIsolateId'); |
| 395 } else { | 395 } else { |
| 396 var event = new ServiceObject._fromMap(owningIsolate, map); | 396 var event = new ServiceObject._fromMap(owningIsolate, map); |
| 397 events.add(event); | 397 events.add(event); |
| 398 } | 398 } |
| 399 }); | 399 }); |
| 400 } | 400 } |
| (...skipping 18 matching lines...) Expand all Loading... |
| 419 return id.substring(0, m.end); | 419 return id.substring(0, m.end); |
| 420 } | 420 } |
| 421 | 421 |
| 422 Map<String,ServiceObject> _cache = new Map<String,ServiceObject>(); | 422 Map<String,ServiceObject> _cache = new Map<String,ServiceObject>(); |
| 423 Map<String,Isolate> _isolateCache = new Map<String,Isolate>(); | 423 Map<String,Isolate> _isolateCache = new Map<String,Isolate>(); |
| 424 | 424 |
| 425 ServiceObject getFromMap(ObservableMap map) { | 425 ServiceObject getFromMap(ObservableMap map) { |
| 426 throw new UnimplementedError(); | 426 throw new UnimplementedError(); |
| 427 } | 427 } |
| 428 | 428 |
| 429 Future<ServiceObject> _getIsolate(String isolateId) { | 429 // Note that this function does not reload the isolate if it found |
| 430 // in the cache. |
| 431 Future<ServiceObject> getIsolate(String isolateId) { |
| 430 if (isolateId == '') { | 432 if (isolateId == '') { |
| 431 return new Future.value(null); | 433 return new Future.value(null); |
| 432 } | 434 } |
| 433 Isolate isolate = _isolateCache[isolateId]; | 435 Isolate isolate = _isolateCache[isolateId]; |
| 434 if (isolate != null) { | 436 if (isolate != null) { |
| 435 return new Future.value(isolate); | 437 return new Future.value(isolate); |
| 436 } | 438 } |
| 437 // The isolate is not in the cache. Reload the vm and see if the | 439 // The isolate is not in the cache. Reload the vm and see if the |
| 438 // requested isolate is found. | 440 // requested isolate is found. |
| 441 // |
| 442 // TODO(turnidge): We don't want to reload all isolates so much. |
| 443 // Doesn't scale well. Change this to be more fine-grained. |
| 439 return reload().then((result) { | 444 return reload().then((result) { |
| 440 if (result is! VM) { | 445 if (result is! VM) { |
| 441 return null; | 446 return null; |
| 442 } | 447 } |
| 443 assert(result == this); | 448 assert(result == this); |
| 444 return _isolateCache[isolateId]; | 449 return _isolateCache[isolateId]; |
| 445 }); | 450 }); |
| 446 } | 451 } |
| 447 | 452 |
| 448 Future<ServiceObject> get(String id) { | 453 Future<ServiceObject> getDeprecated(String id) { |
| 449 assert(id.startsWith('/') == false); | 454 assert(id.startsWith('/') == false); |
| 450 // Isolates are handled specially, since they can cache sub-objects. | 455 // Isolates are handled specially, since they can cache sub-objects. |
| 451 if (id.startsWith(_isolatesPrefix)) { | 456 if (id.startsWith(_isolatesPrefix)) { |
| 452 String isolateId = _parseIsolateId(id); | 457 String isolateId = _parseIsolateId(id); |
| 453 String objectId = _parseObjectId(id); | 458 String objectId = _parseObjectId(id); |
| 454 return _getIsolate(isolateId).then((isolate) { | 459 return getIsolate(isolateId).then((isolate) { |
| 455 if (isolate == null) { | 460 if (isolate == null) { |
| 456 // The isolate does not exist. Return the VM object instead. | 461 // The isolate does not exist. Return the VM object instead. |
| 457 // | 462 // |
| 458 // TODO(turnidge): Generate a service error? | 463 // TODO(turnidge): Generate a service error? |
| 459 return this; | 464 return this; |
| 460 } | 465 } |
| 461 if (objectId == null) { | 466 if (objectId == null) { |
| 462 return isolate.reload(); | 467 return isolate.reload(); |
| 463 } else { | 468 } else { |
| 464 return isolate.get(objectId); | 469 return isolate.getDeprecated(objectId); |
| 465 } | 470 } |
| 466 }); | 471 }); |
| 467 } | 472 } |
| 468 | 473 |
| 469 var obj = _cache[id]; | 474 var obj = _cache[id]; |
| 470 if (obj != null) { | 475 if (obj != null) { |
| 471 return obj.reload(); | 476 return obj.reload(); |
| 472 } | 477 } |
| 473 | 478 |
| 474 // Cache miss. Get the object from the vm directly. | 479 // Cache miss. Get the object from the vm directly. |
| 475 return getAsMap(id).then((ObservableMap map) { | 480 return _getAsMapDeprecated(id).then((ObservableMap map) { |
| 476 var obj = new ServiceObject._fromMap(this, map); | 481 var obj = new ServiceObject._fromMap(this, map); |
| 477 if (obj.canCache) { | 482 if (obj.canCache) { |
| 478 _cache.putIfAbsent(id, () => obj); | 483 _cache.putIfAbsent(id, () => obj); |
| 479 } | 484 } |
| 480 return obj; | 485 return obj; |
| 481 }); | 486 }); |
| 482 } | 487 } |
| 483 | 488 |
| 484 dynamic _reviver(dynamic key, dynamic value) { | 489 dynamic _reviver(dynamic key, dynamic value) { |
| 485 return value; | 490 return value; |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 530 'Observatory is still functioning and you should try your' | 535 'Observatory is still functioning and you should try your' |
| 531 ' action again.', | 536 ' action again.', |
| 532 'message': 'Could not decode JSON: $e', | 537 'message': 'Could not decode JSON: $e', |
| 533 }))); | 538 }))); |
| 534 } | 539 } |
| 535 | 540 |
| 536 /// Gets [id] as an [ObservableMap] from the service directly. If | 541 /// Gets [id] as an [ObservableMap] from the service directly. If |
| 537 /// an error occurs, the future is completed as an error with a | 542 /// an error occurs, the future is completed as an error with a |
| 538 /// ServiceError or ServiceException. Therefore any chained then() calls | 543 /// ServiceError or ServiceException. Therefore any chained then() calls |
| 539 /// will only receive a map encoding a valid ServiceObject. | 544 /// will only receive a map encoding a valid ServiceObject. |
| 540 Future<ObservableMap> getAsMap(String id) { | 545 Future<ObservableMap> _getAsMapDeprecated(String id) { |
| 541 return getString(id).then((response) { | 546 return getStringDeprecated(id).then((response) { |
| 542 var map = _parseJSON(response); | 547 var map = _parseJSON(response); |
| 543 if (Tracer.current != null) { | 548 if (Tracer.current != null) { |
| 544 Tracer.current.trace("Received response for ${id}", map:map); | 549 Tracer.current.trace("Received response for ${id}", map:map); |
| 545 } | 550 } |
| 546 return _processMap(map); | 551 return _processMap(map); |
| 547 }).catchError((error) { | 552 }).catchError((error) { |
| 548 // ServiceError, forward to VM's ServiceError stream. | 553 // ServiceError, forward to VM's ServiceError stream. |
| 549 errors.add(error); | 554 errors.add(error); |
| 550 return new Future.error(error); | 555 return new Future.error(error); |
| 551 }, test: (e) => e is ServiceError).catchError((exception) { | 556 }, test: (e) => e is ServiceError).catchError((exception) { |
| 552 // ServiceException, forward to VM's ServiceException stream. | 557 // ServiceException, forward to VM's ServiceException stream. |
| 553 exceptions.add(exception); | 558 exceptions.add(exception); |
| 554 return new Future.error(exception); | 559 return new Future.error(exception); |
| 555 }, test: (e) => e is ServiceException); | 560 }, test: (e) => e is ServiceException); |
| 556 } | 561 } |
| 557 | 562 |
| 558 /// Get [id] as a [String] from the service directly. See [getAsMap]. | 563 /// Get [id] as a [String] from the service directly. See [getAsMap]. |
| 559 Future<String> getString(String id); | 564 Future<String> getStringDeprecated(String id); |
| 560 | 565 |
| 561 // Implemented in subclass. | 566 // Implemented in subclass. |
| 562 Future<String> invokeRpcRaw(String method, Map params); | 567 Future<String> invokeRpcRaw(String method, Map params); |
| 563 | 568 |
| 564 Future<ObservableMap> invokeRpcNoUpgrade(String method, Map params) { | 569 Future<ObservableMap> invokeRpcNoUpgrade(String method, Map params) { |
| 565 return invokeRpcRaw(method, params).then((String response) { | 570 return invokeRpcRaw(method, params).then((String response) { |
| 566 var map = _parseJSON(response); | 571 var map = _parseJSON(response); |
| 567 if (Tracer.current != null) { | 572 if (Tracer.current != null) { |
| 568 Tracer.current.trace("Received response for ${method}/${params}}", | 573 Tracer.current.trace("Received response for ${method}/${params}}", |
| 569 map:map); | 574 map:map); |
| 570 } | 575 } |
| 571 | 576 |
| 572 // Check for ill-formed responses. | 577 // Check for ill-formed responses. |
| 573 return _processMap(map); | 578 return _processMap(map); |
| 574 }).catchError((error) { | 579 }).catchError((error) { |
| 575 | 580 |
| 576 // ServiceError, forward to VM's ServiceError stream. | 581 // ServiceError, forward to VM's ServiceError stream. |
| 577 errors.add(error); | 582 errors.add(error); |
| 578 return new Future.error(error); | 583 return new Future.error(error); |
| 579 }, test: (e) => e is ServiceError).catchError((exception) { | 584 }, test: (e) => e is ServiceError).catchError((exception) { |
| 580 | 585 |
| 581 // ServiceException, forward to VM's ServiceException stream. | 586 // ServiceException, forward to VM's ServiceException stream. |
| 582 exceptions.add(exception); | 587 exceptions.add(exception); |
| 583 return new Future.error(exception); | 588 return new Future.error(exception); |
| 584 }, test: (e) => e is ServiceException); | 589 }, test: (e) => e is ServiceException); |
| 585 } | 590 } |
| 586 | 591 |
| 587 Future<ServiceObject> invokeRpc(String method, Map params) { | 592 Future<ServiceObject> invokeRpc(String method, Map params) { |
| 588 // TODO(turnidge): Once we start implementing "get" requests | |
| 589 // through the JsonRpc interface, we will need to start checking the | |
| 590 // cache before making the request here. For now, we just make the | |
| 591 // request without bothering with the cache. | |
| 592 return invokeRpcNoUpgrade(method, params).then((ObservableMap response) { | 593 return invokeRpcNoUpgrade(method, params).then((ObservableMap response) { |
| 593 var obj = new ServiceObject._fromMap(this, response); | 594 var obj = new ServiceObject._fromMap(this, response); |
| 594 » // TODO(turnidge): Put the object into the cache if we can. | 595 if (obj.canCache) { |
| 595 » return obj; | 596 _cache.putIfAbsent(id, () => obj); |
| 597 } |
| 598 return obj; |
| 596 }); | 599 }); |
| 597 } | 600 } |
| 598 | 601 |
| 599 Future<ObservableMap> _fetchDirect() { | 602 Future<ObservableMap> _fetchDirect() { |
| 600 return invokeRpcNoUpgrade('getVM', {}); | 603 return invokeRpcNoUpgrade('getVM', {}); |
| 601 } | 604 } |
| 602 | 605 |
| 603 /// Force the VM to disconnect. | 606 /// Force the VM to disconnect. |
| 604 void disconnect(); | 607 void disconnect(); |
| 605 /// Completes when the VM first connects. | 608 /// Completes when the VM first connects. |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 755 | 758 |
| 756 HeapSnapshot(this.isolate, ByteData data) : | 759 HeapSnapshot(this.isolate, ByteData data) : |
| 757 graph = new ObjectGraph(new ReadStream(data)), | 760 graph = new ObjectGraph(new ReadStream(data)), |
| 758 timeStamp = new DateTime.now() { | 761 timeStamp = new DateTime.now() { |
| 759 } | 762 } |
| 760 | 763 |
| 761 List<Future<ServiceObject>> getMostRetained({int classId, int limit}) { | 764 List<Future<ServiceObject>> getMostRetained({int classId, int limit}) { |
| 762 var result = []; | 765 var result = []; |
| 763 for (var v in graph.getMostRetained(classId: classId, limit: limit)) { | 766 for (var v in graph.getMostRetained(classId: classId, limit: limit)) { |
| 764 var address = v.addressForWordSize(isolate.vm.architectureBits ~/ 8); | 767 var address = v.addressForWordSize(isolate.vm.architectureBits ~/ 8); |
| 765 result.add(isolate.get( | 768 result.add(isolate.getDeprecated( |
| 766 'address/${address.toRadixString(16)}?ref=true').then((obj) { | 769 'address/${address.toRadixString(16)}?ref=true').then((obj) { |
| 767 obj.retainedSize = v.retainedSize; | 770 obj.retainedSize = v.retainedSize; |
| 768 return new Future(() => obj); | 771 return new Future(() => obj); |
| 769 })); | 772 })); |
| 770 } | 773 } |
| 771 return result; | 774 return result; |
| 772 } | 775 } |
| 773 | 776 |
| 774 | 777 |
| 775 } | 778 } |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 891 return obj; | 894 return obj; |
| 892 } | 895 } |
| 893 // Build the object from the map directly. | 896 // Build the object from the map directly. |
| 894 obj = new ServiceObject._fromMap(this, map); | 897 obj = new ServiceObject._fromMap(this, map); |
| 895 if (obj != null && obj.canCache) { | 898 if (obj != null && obj.canCache) { |
| 896 _cache[id] = obj; | 899 _cache[id] = obj; |
| 897 } | 900 } |
| 898 return obj; | 901 return obj; |
| 899 } | 902 } |
| 900 | 903 |
| 901 Future<ServiceObject> get(String id) { | 904 Future<ServiceObject> getDeprecated(String id) { |
| 902 // Do not allow null ids or empty ids. | 905 // Do not allow null ids or empty ids. |
| 903 assert(id != null && id != ''); | 906 assert(id != null && id != ''); |
| 904 var obj = _cache[id]; | 907 var obj = _cache[id]; |
| 905 if (obj != null) { | 908 if (obj != null) { |
| 906 return obj.reload(); | 909 return obj.reload(); |
| 907 } | 910 } |
| 908 // Cache miss. Get the object from the vm directly. | 911 // Cache miss. Get the object from the vm directly. |
| 909 return vm.getAsMap(relativeLink(id)).then((ObservableMap map) { | 912 return vm._getAsMapDeprecated(relativeLink(id)).then((ObservableMap map) { |
| 910 var obj = new ServiceObject._fromMap(this, map); | 913 var obj = new ServiceObject._fromMap(this, map); |
| 911 if (obj.canCache) { | 914 if (obj.canCache) { |
| 912 _cache.putIfAbsent(id, () => obj); | 915 _cache.putIfAbsent(id, () => obj); |
| 913 } | 916 } |
| 914 return obj; | 917 return obj; |
| 915 }); | 918 }); |
| 916 } | 919 } |
| 917 | 920 |
| 918 Future<ObservableMap> invokeRpcNoUpgrade(String method, Map params) { | 921 Future<ObservableMap> invokeRpcNoUpgrade(String method, Map params) { |
| 919 params['isolate'] = id; | 922 params['isolate'] = id; |
| 920 return vm.invokeRpcNoUpgrade(method, params); | 923 return vm.invokeRpcNoUpgrade(method, params); |
| 921 } | 924 } |
| 922 | 925 |
| 923 Future<ServiceObject> invokeRpc(String method, Map params) { | 926 Future<ServiceObject> invokeRpc(String method, Map params) { |
| 924 return invokeRpcNoUpgrade(method, params).then((ObservableMap response) { | 927 return invokeRpcNoUpgrade(method, params).then((ObservableMap response) { |
| 925 // TODO - needs to cache!!! move to constructor? | 928 var obj = new ServiceObject._fromMap(this, response); |
| 926 return new ServiceObject._fromMap(this, response); | 929 if (obj.canCache) { |
| 930 _cache.putIfAbsent(id, () => obj); |
| 931 } |
| 932 » return obj; |
| 927 }); | 933 }); |
| 928 } | 934 } |
| 929 | 935 |
| 936 Future<ServiceObject> getObject(String objectId) { |
| 937 assert(objectId != null && objectId != ''); |
| 938 var obj = _cache[objectId]; |
| 939 if (obj != null) { |
| 940 return obj.reload(); |
| 941 } |
| 942 Map params = { |
| 943 'objectId': objectId, |
| 944 }; |
| 945 return isolate.invokeRpc('getObject', params); |
| 946 } |
| 947 |
| 930 Future<ObservableMap> _fetchDirect() { | 948 Future<ObservableMap> _fetchDirect() { |
| 931 return invokeRpcNoUpgrade('getIsolate', {}); | 949 return invokeRpcNoUpgrade('getIsolate', {}); |
| 932 } | 950 } |
| 933 | 951 |
| 934 @observable Class objectClass; | 952 @observable Class objectClass; |
| 935 @observable final rootClasses = new ObservableList<Class>(); | 953 @observable final rootClasses = new ObservableList<Class>(); |
| 936 | 954 |
| 937 @observable Library rootLib; | 955 @observable Library rootLib; |
| 938 @observable ObservableList<Library> libraries = | 956 @observable ObservableList<Library> libraries = |
| 939 new ObservableList<Library>(); | 957 new ObservableList<Library>(); |
| (...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1322 | 1340 |
| 1323 final ObservableMap<String, ServiceMetric> dartMetrics = | 1341 final ObservableMap<String, ServiceMetric> dartMetrics = |
| 1324 new ObservableMap<String, ServiceMetric>(); | 1342 new ObservableMap<String, ServiceMetric>(); |
| 1325 | 1343 |
| 1326 final ObservableMap<String, ServiceMetric> vmMetrics = | 1344 final ObservableMap<String, ServiceMetric> vmMetrics = |
| 1327 new ObservableMap<String, ServiceMetric>(); | 1345 new ObservableMap<String, ServiceMetric>(); |
| 1328 | 1346 |
| 1329 Future<ObservableMap<String, ServiceMetric>> _refreshMetrics( | 1347 Future<ObservableMap<String, ServiceMetric>> _refreshMetrics( |
| 1330 String id, | 1348 String id, |
| 1331 ObservableMap<String, ServiceMetric> metricsMap) { | 1349 ObservableMap<String, ServiceMetric> metricsMap) { |
| 1332 return get(id).then((result) { | 1350 return getDeprecated(id).then((result) { |
| 1333 if (result is DartError) { | 1351 if (result is DartError) { |
| 1334 // TODO(turnidge): Handle this more gracefully. | 1352 // TODO(turnidge): Handle this more gracefully. |
| 1335 Logger.root.severe(result.message); | 1353 Logger.root.severe(result.message); |
| 1336 return null; | 1354 return null; |
| 1337 } | 1355 } |
| 1338 // Clear metrics map. | 1356 // Clear metrics map. |
| 1339 metricsMap.clear(); | 1357 metricsMap.clear(); |
| 1340 // Repopulate metrics map. | 1358 // Repopulate metrics map. |
| 1341 var members = result['members']; | 1359 var members = result['members']; |
| 1342 for (var metric in members) { | 1360 for (var metric in members) { |
| (...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1710 } | 1728 } |
| 1711 | 1729 |
| 1712 void _addSubclass(Class subclass) { | 1730 void _addSubclass(Class subclass) { |
| 1713 if (subclasses.contains(subclass)) { | 1731 if (subclasses.contains(subclass)) { |
| 1714 return; | 1732 return; |
| 1715 } | 1733 } |
| 1716 subclasses.add(subclass); | 1734 subclasses.add(subclass); |
| 1717 subclasses.sort(ServiceObject.LexicalSortName); | 1735 subclasses.sort(ServiceObject.LexicalSortName); |
| 1718 } | 1736 } |
| 1719 | 1737 |
| 1720 Future<ServiceObject> get(String command) { | |
| 1721 return isolate.get(id + "/$command"); | |
| 1722 } | |
| 1723 | |
| 1724 String toString() => 'Class($vmName)'; | 1738 String toString() => 'Class($vmName)'; |
| 1725 } | 1739 } |
| 1726 | 1740 |
| 1727 class Instance extends ServiceObject { | 1741 class Instance extends ServiceObject { |
| 1728 @observable Class clazz; | 1742 @observable Class clazz; |
| 1729 @observable int size; | 1743 @observable int size; |
| 1730 @observable int retainedSize; | 1744 @observable int retainedSize; |
| 1731 @observable String valueAsString; // If primitive. | 1745 @observable String valueAsString; // If primitive. |
| 1732 @observable bool valueAsStringIsTruncated; | 1746 @observable bool valueAsStringIsTruncated; |
| 1733 @observable ServiceFunction closureFunc; // If a closure. | 1747 @observable ServiceFunction closureFunc; // If a closure. |
| (...skipping 1079 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2813 new ObservableList<MetricSample>(); | 2827 new ObservableList<MetricSample>(); |
| 2814 int _sampleBufferSize = 100; | 2828 int _sampleBufferSize = 100; |
| 2815 int get sampleBufferSize => _sampleBufferSize; | 2829 int get sampleBufferSize => _sampleBufferSize; |
| 2816 set sampleBufferSize(int size) { | 2830 set sampleBufferSize(int size) { |
| 2817 _sampleBufferSize = size; | 2831 _sampleBufferSize = size; |
| 2818 _removeOld(); | 2832 _removeOld(); |
| 2819 } | 2833 } |
| 2820 | 2834 |
| 2821 Future<ObservableMap> _fetchDirect() { | 2835 Future<ObservableMap> _fetchDirect() { |
| 2822 // TODO(johnmmccutchan): Make this use json rpc. | 2836 // TODO(johnmmccutchan): Make this use json rpc. |
| 2823 return vm.getAsMap(link); | 2837 return vm._getAsMapDeprecated(link); |
| 2824 } | 2838 } |
| 2825 | 2839 |
| 2826 | 2840 |
| 2827 void addSample(MetricSample sample) { | 2841 void addSample(MetricSample sample) { |
| 2828 samples.add(sample); | 2842 samples.add(sample); |
| 2829 _removeOld(); | 2843 _removeOld(); |
| 2830 } | 2844 } |
| 2831 | 2845 |
| 2832 void _removeOld() { | 2846 void _removeOld() { |
| 2833 // TODO(johnmccutchan): If this becomes hot, consider using a circular | 2847 // TODO(johnmccutchan): If this becomes hot, consider using a circular |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2938 var v = list[i]; | 2952 var v = list[i]; |
| 2939 if ((v is ObservableMap) && _isServiceMap(v)) { | 2953 if ((v is ObservableMap) && _isServiceMap(v)) { |
| 2940 list[i] = owner.getFromMap(v); | 2954 list[i] = owner.getFromMap(v); |
| 2941 } else if (v is ObservableList) { | 2955 } else if (v is ObservableList) { |
| 2942 _upgradeObservableList(v, owner); | 2956 _upgradeObservableList(v, owner); |
| 2943 } else if (v is ObservableMap) { | 2957 } else if (v is ObservableMap) { |
| 2944 _upgradeObservableMap(v, owner); | 2958 _upgradeObservableMap(v, owner); |
| 2945 } | 2959 } |
| 2946 } | 2960 } |
| 2947 } | 2961 } |
| OLD | NEW |