OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 repositories; | 5 part of repositories; |
6 | 6 |
7 String _tagToString(M.SampleProfileTag tag) { | 7 String _tagToString(M.SampleProfileTag tag) { |
8 switch (tag) { | 8 switch (tag) { |
9 case M.SampleProfileTag.userVM: | 9 case M.SampleProfileTag.userVM: |
10 return 'UserVM'; | 10 return 'UserVM'; |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 } | 63 } |
64 | 64 |
65 var response; | 65 var response; |
66 if (type == M.SampleProfileType.cpu) { | 66 if (type == M.SampleProfileType.cpu) { |
67 response = cls != null | 67 response = cls != null |
68 ? await cls.getAllocationSamples(_tagToString(tag)) | 68 ? await cls.getAllocationSamples(_tagToString(tag)) |
69 : await owner | 69 : await owner |
70 .invokeRpc('_getCpuProfile', {'tags': _tagToString(tag)}); | 70 .invokeRpc('_getCpuProfile', {'tags': _tagToString(tag)}); |
71 } else if (type == M.SampleProfileType.memory) { | 71 } else if (type == M.SampleProfileType.memory) { |
72 assert(owner is M.VM); | 72 assert(owner is M.VM); |
73 M.VM vm = owner as M.VM; | |
74 response = await owner.invokeRpc( | 73 response = await owner.invokeRpc( |
75 '_getNativeAllocationSamples', {'tags': _tagToString(tag)}); | 74 '_getNativeAllocationSamples', {'tags': _tagToString(tag)}); |
76 } else { | 75 } else { |
77 throw new Exception('Unknown M.SampleProfileType: $type'); | 76 throw new Exception('Unknown M.SampleProfileType: $type'); |
78 } | 77 } |
79 | 78 |
80 _fetchingTime.stop(); | 79 _fetchingTime.stop(); |
81 _loadingTime.start(); | 80 _loadingTime.start(); |
82 _status = M.SampleProfileLoadingStatus.loading; | 81 _status = M.SampleProfileLoadingStatus.loading; |
83 _triggerOnProgress(); | 82 _triggerOnProgress(); |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 assert(forceFetch != null); | 177 assert(forceFetch != null); |
179 if ((_last != null) && !forceFetch) { | 178 if ((_last != null) && !forceFetch) { |
180 _last.reuse(); | 179 _last.reuse(); |
181 } else { | 180 } else { |
182 _last = new SampleProfileLoadingProgress(vm, t, false, | 181 _last = new SampleProfileLoadingProgress(vm, t, false, |
183 type: M.SampleProfileType.memory); | 182 type: M.SampleProfileType.memory); |
184 } | 183 } |
185 return _last.onProgress; | 184 return _last.onProgress; |
186 } | 185 } |
187 } | 186 } |
OLD | NEW |