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 // 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 1503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1514 | 1514 |
1515 var loadedChunks = _chunksInProgress; | 1515 var loadedChunks = _chunksInProgress; |
1516 _chunksInProgress = null; | 1516 _chunksInProgress = null; |
1517 | 1517 |
1518 if (_snapshotFetch != null) { | 1518 if (_snapshotFetch != null) { |
1519 _snapshotFetch.add(new RawHeapSnapshot(loadedChunks, event.nodeCount)); | 1519 _snapshotFetch.add(new RawHeapSnapshot(loadedChunks, event.nodeCount)); |
1520 _snapshotFetch.close(); | 1520 _snapshotFetch.close(); |
1521 } | 1521 } |
1522 } | 1522 } |
1523 | 1523 |
1524 Stream fetchHeapSnapshot(collectGarbage) { | 1524 static String _rootsToString(M.HeapSnapshotRoots roots) { |
Cutch
2016/11/28 18:11:12
I think this works too:
roots.toString().split('.
rmacnak
2016/11/28 22:57:56
The names don't match. The service enum naming con
| |
1525 switch (roots) { | |
1526 case M.HeapSnapshotRoots.user: return "User"; | |
1527 case M.HeapSnapshotRoots.vm: return "VM"; | |
1528 } | |
1529 return null; | |
1530 } | |
1531 | |
1532 Stream fetchHeapSnapshot(M.HeapSnapshotRoots roots, bool collectGarbage) { | |
1525 if (_snapshotFetch == null || _snapshotFetch.isClosed) { | 1533 if (_snapshotFetch == null || _snapshotFetch.isClosed) { |
1526 _snapshotFetch = new StreamController.broadcast(); | 1534 _snapshotFetch = new StreamController.broadcast(); |
1527 // isolate.vm.streamListen('_Graph'); | 1535 // isolate.vm.streamListen('_Graph'); |
1528 isolate.invokeRpcNoUpgrade( | 1536 isolate.invokeRpcNoUpgrade('_requestHeapSnapshot', |
1529 '_requestHeapSnapshot', {'collectGarbage': collectGarbage}); | 1537 {'roots': _rootsToString(roots), |
1538 'collectGarbage': collectGarbage}); | |
1530 } | 1539 } |
1531 return _snapshotFetch.stream; | 1540 return _snapshotFetch.stream; |
1532 } | 1541 } |
1533 | 1542 |
1534 void updateHeapsFromMap(Map map) { | 1543 void updateHeapsFromMap(Map map) { |
1535 newSpace.update(map['new']); | 1544 newSpace.update(map['new']); |
1536 oldSpace.update(map['old']); | 1545 oldSpace.update(map['old']); |
1537 } | 1546 } |
1538 | 1547 |
1539 void _update(Map map, bool mapIsRef) { | 1548 void _update(Map map, bool mapIsRef) { |
(...skipping 2857 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4397 var v = list[i]; | 4406 var v = list[i]; |
4398 if ((v is Map) && _isServiceMap(v)) { | 4407 if ((v is Map) && _isServiceMap(v)) { |
4399 list[i] = owner.getFromMap(v); | 4408 list[i] = owner.getFromMap(v); |
4400 } else if (v is List) { | 4409 } else if (v is List) { |
4401 _upgradeList(v, owner); | 4410 _upgradeList(v, owner); |
4402 } else if (v is Map) { | 4411 } else if (v is Map) { |
4403 _upgradeMap(v, owner); | 4412 _upgradeMap(v, owner); |
4404 } | 4413 } |
4405 } | 4414 } |
4406 } | 4415 } |
OLD | NEW |