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 14 matching lines...) Expand all Loading... |
25 final SampleProfileLoadingProgress progress; | 25 final SampleProfileLoadingProgress progress; |
26 SampleProfileLoadingProgressEvent(this.progress); | 26 SampleProfileLoadingProgressEvent(this.progress); |
27 } | 27 } |
28 | 28 |
29 class SampleProfileLoadingProgress extends M.SampleProfileLoadingProgress { | 29 class SampleProfileLoadingProgress extends M.SampleProfileLoadingProgress { |
30 StreamController<SampleProfileLoadingProgressEvent> _onProgress = | 30 StreamController<SampleProfileLoadingProgressEvent> _onProgress = |
31 new StreamController<SampleProfileLoadingProgressEvent>.broadcast(); | 31 new StreamController<SampleProfileLoadingProgressEvent>.broadcast(); |
32 Stream<SampleProfileLoadingProgressEvent> get onProgress => | 32 Stream<SampleProfileLoadingProgressEvent> get onProgress => |
33 _onProgress.stream; | 33 _onProgress.stream; |
34 | 34 |
35 final ServiceObjectOwner owner; | 35 final M.ServiceObjectOwner owner; |
36 final S.Class cls; | 36 final S.Class cls; |
37 final M.SampleProfileTag tag; | 37 final M.SampleProfileTag tag; |
38 final bool clear; | 38 final bool clear; |
39 final M.SampleProfileType type; | 39 final M.SampleProfileType type; |
40 | 40 |
41 M.SampleProfileLoadingStatus _status = M.SampleProfileLoadingStatus.fetching; | 41 M.SampleProfileLoadingStatus _status = M.SampleProfileLoadingStatus.fetching; |
42 double _progress = 0.0; | 42 double _progress = 0.0; |
43 final Stopwatch _fetchingTime = new Stopwatch(); | 43 final Stopwatch _fetchingTime = new Stopwatch(); |
44 final Stopwatch _loadingTime = new Stopwatch(); | 44 final Stopwatch _loadingTime = new Stopwatch(); |
45 CpuProfile _profile; | 45 CpuProfile _profile; |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 assert(cls != null); | 167 assert(cls != null); |
168 return cls.setTraceAllocations(false); | 168 return cls.setTraceAllocations(false); |
169 } | 169 } |
170 } | 170 } |
171 | 171 |
172 class NativeMemorySampleProfileRepository | 172 class NativeMemorySampleProfileRepository |
173 implements M.NativeMemorySampleProfileRepository { | 173 implements M.NativeMemorySampleProfileRepository { |
174 SampleProfileLoadingProgress _last; | 174 SampleProfileLoadingProgress _last; |
175 | 175 |
176 Stream<SampleProfileLoadingProgressEvent> get(M.VM vm, M.SampleProfileTag t, | 176 Stream<SampleProfileLoadingProgressEvent> get(M.VM vm, M.SampleProfileTag t, |
177 {bool forceFetch: false}) { | 177 {bool forceFetch: false, bool clear: false}) { |
178 assert(forceFetch != null); | 178 assert(forceFetch != null); |
179 if ((_last != null) && !forceFetch) { | 179 if ((_last != null) && !forceFetch) { |
180 _last.reuse(); | 180 _last.reuse(); |
181 } else { | 181 } else { |
182 _last = new SampleProfileLoadingProgress(vm, t, false, | 182 _last = new SampleProfileLoadingProgress(vm, t, false, |
183 type: M.SampleProfileType.memory); | 183 type: M.SampleProfileType.memory); |
184 } | 184 } |
185 return _last.onProgress; | 185 return _last.onProgress; |
186 } | 186 } |
187 } | 187 } |
OLD | NEW |