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 final int sampleCount; | 16 final int sampleCount; |
17 final int stackDepth; | 17 final int stackDepth; |
18 final double sampleRate; | 18 final double sampleRate; |
19 final double timeSpan; | 19 final double timeSpan; |
20 final Iterable<M.ProfileCode> codes; | 20 final Iterable<M.ProfileCode> codes; |
21 final Iterable<M.ProfileFunction> functions; | 21 final Iterable<M.ProfileFunction> functions; |
22 | 22 |
23 M.FunctionCallTree loadFunctionTree(M.ProfileTreeDirection direction) { | 23 M.FunctionCallTree loadFunctionTree(M.ProfileTreeDirection direction) { |
24 if (_loadFunctionTree != null) { | 24 if (_loadFunctionTree != null) { |
25 return _loadFunctionTree(direction); | 25 return _loadFunctionTree(direction); |
26 } | 26 } |
27 return null; | 27 return null; |
28 } | 28 } |
| 29 |
29 M.CodeCallTree loadCodeTree(M.ProfileTreeDirection direction) { | 30 M.CodeCallTree loadCodeTree(M.ProfileTreeDirection direction) { |
30 if (_loadCodeTree != null) { | 31 if (_loadCodeTree != null) { |
31 return _loadCodeTree(direction); | 32 return _loadCodeTree(direction); |
32 } | 33 } |
33 return null; | 34 return null; |
34 } | 35 } |
35 | 36 |
36 SampleProfileMock({this.sampleCount: 0, this.stackDepth: 0, | 37 SampleProfileMock( |
37 this.sampleRate: 1.0, this.timeSpan: 1.0, | 38 {this.sampleCount: 0, |
38 this.codes: const [], this.functions: const [], | 39 this.stackDepth: 0, |
| 40 this.sampleRate: 1.0, |
| 41 this.timeSpan: 1.0, |
| 42 this.codes: const [], |
| 43 this.functions: const [], |
39 SampleProfileMockLoadFunctionTreeCallback loadFunctionTree, | 44 SampleProfileMockLoadFunctionTreeCallback loadFunctionTree, |
40 SampleProfileMockLoadCodeTreeCallback loadCodeTree}) | 45 SampleProfileMockLoadCodeTreeCallback loadCodeTree}) |
41 : _loadFunctionTree = loadFunctionTree, | 46 : _loadFunctionTree = loadFunctionTree, |
42 _loadCodeTree = loadCodeTree; | 47 _loadCodeTree = loadCodeTree; |
43 } | 48 } |
OLD | NEW |