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: return 'UserVM'; | 9 case M.SampleProfileTag.userVM: return 'UserVM'; |
10 case M.SampleProfileTag.userOnly: return 'UserOnly'; | 10 case M.SampleProfileTag.userOnly: return 'UserOnly'; |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 _last.reuse(); | 120 _last.reuse(); |
121 } else { | 121 } else { |
122 _last = new SampleProfileLoadingProgress(isolate, t, clear); | 122 _last = new SampleProfileLoadingProgress(isolate, t, clear); |
123 } | 123 } |
124 return _last.onProgress; | 124 return _last.onProgress; |
125 } | 125 } |
126 } | 126 } |
127 | 127 |
128 class ClassSampleProfileRepository | 128 class ClassSampleProfileRepository |
129 implements M.ClassSampleProfileRepository { | 129 implements M.ClassSampleProfileRepository { |
130 Stream<SampleProfileLoadingProgressEvent> get(M.ClassRef c, | 130 Stream<SampleProfileLoadingProgressEvent> get(M.Isolate i, M.ClassRef c, |
131 M.SampleProfileTag t, {bool clear: false}) { | 131 M.SampleProfileTag t) { |
| 132 S.Isolate isolate = i as S.Isolate; |
| 133 S.Class cls = c as S.Class; |
| 134 assert(isolate != null); |
| 135 assert(cls != null); |
| 136 return new SampleProfileLoadingProgress(isolate, t, |
| 137 false, cls: cls).onProgress; |
| 138 } |
| 139 |
| 140 Future enable(M.IsolateRef i, M.ClassRef c) { |
132 S.Class cls = c as S.Class; | 141 S.Class cls = c as S.Class; |
133 assert(cls != null); | 142 assert(cls != null); |
134 return new SampleProfileLoadingProgress(cls.isolate, t, | 143 return cls.setTraceAllocations(true); |
135 clear, cls: cls).onProgress; | 144 } |
| 145 |
| 146 Future disable(M.IsolateRef i, M.ClassRef c) { |
| 147 S.Class cls = c as S.Class; |
| 148 assert(cls != null); |
| 149 return cls.setTraceAllocations(false); |
136 } | 150 } |
137 } | 151 } |
OLD | NEW |