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 mocks; | 5 part of mocks; |
6 | 6 |
7 typedef M.FunctionCallTree SampleProfileMockLoadFunctionTreeCallback( | 7 typedef M.FunctionCallTree SampleProfileMockLoadFunctionTreeCallback( |
8 M.ProfileTreeDirection direction); | 8 M.ProfileTreeDirection direction); |
9 typedef M.CodeCallTree SampleProfileMockLoadCodeTreeCallback( | 9 typedef M.CodeCallTree SampleProfileMockLoadCodeTreeCallback( |
10 M.ProfileTreeDirection direction); | 10 M.ProfileTreeDirection direction); |
11 | 11 |
12 class SampleProfileMock implements M.SampleProfile { | 12 class SampleProfileMock implements M.SampleProfile { |
13 final SampleProfileMockLoadFunctionTreeCallback _loadFunctionTree; | 13 final SampleProfileMockLoadFunctionTreeCallback _loadFunctionTree; |
14 final SampleProfileMockLoadCodeTreeCallback _loadCodeTree; | 14 final SampleProfileMockLoadCodeTreeCallback _loadCodeTree; |
15 | 15 |
16 | |
17 final int sampleCount; | 16 final int sampleCount; |
18 final int stackDepth; | 17 final int stackDepth; |
19 final double sampleRate; | 18 final double sampleRate; |
20 final double timeSpan; | 19 final double timeSpan; |
| 20 final Iterable<M.ProfileCode> codes; |
| 21 final Iterable<M.ProfileFunction> functions; |
21 | 22 |
22 M.FunctionCallTree loadFunctionTree(M.ProfileTreeDirection direction) { | 23 M.FunctionCallTree loadFunctionTree(M.ProfileTreeDirection direction) { |
23 if (_loadFunctionTree != null) { | 24 if (_loadFunctionTree != null) { |
24 return _loadFunctionTree(direction); | 25 return _loadFunctionTree(direction); |
25 } | 26 } |
26 return null; | 27 return null; |
27 } | 28 } |
28 M.CodeCallTree loadCodeTree(M.ProfileTreeDirection direction) { | 29 M.CodeCallTree loadCodeTree(M.ProfileTreeDirection direction) { |
29 if (_loadCodeTree != null) { | 30 if (_loadCodeTree != null) { |
30 return _loadCodeTree(direction); | 31 return _loadCodeTree(direction); |
31 } | 32 } |
32 return null; | 33 return null; |
33 } | 34 } |
34 | 35 |
35 SampleProfileMock({this.sampleCount: 0, this.stackDepth: 0, | 36 SampleProfileMock({this.sampleCount: 0, this.stackDepth: 0, |
36 this.sampleRate: 1.0, this.timeSpan: 1.0, | 37 this.sampleRate: 1.0, this.timeSpan: 1.0, |
| 38 this.codes: const [], this.functions: const [], |
37 SampleProfileMockLoadFunctionTreeCallback loadFunctionTree, | 39 SampleProfileMockLoadFunctionTreeCallback loadFunctionTree, |
38 SampleProfileMockLoadCodeTreeCallback loadCodeTree}) | 40 SampleProfileMockLoadCodeTreeCallback loadCodeTree}) |
39 : _loadFunctionTree = loadFunctionTree, | 41 : _loadFunctionTree = loadFunctionTree, |
40 _loadCodeTree = loadCodeTree; | 42 _loadCodeTree = loadCodeTree; |
41 } | 43 } |
OLD | NEW |