| 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 models; | 5 part of models; |
| 6 | 6 |
| 7 enum SampleProfileTag { | 7 enum SampleProfileTag { userVM, userOnly, vmUser, vmOnly, none } |
| 8 userVM, | |
| 9 userOnly, | |
| 10 vmUser, | |
| 11 vmOnly, | |
| 12 none | |
| 13 } | |
| 14 | 8 |
| 15 enum SampleProfileLoadingStatus { | 9 enum SampleProfileLoadingStatus { disabled, fetching, loading, loaded } |
| 16 disabled, | |
| 17 fetching, | |
| 18 loading, | |
| 19 loaded | |
| 20 } | |
| 21 | 10 |
| 22 bool isSampleProcessRunning(SampleProfileLoadingStatus status) { | 11 bool isSampleProcessRunning(SampleProfileLoadingStatus status) { |
| 23 switch (status) { | 12 switch (status) { |
| 24 case SampleProfileLoadingStatus.fetching: | 13 case SampleProfileLoadingStatus.fetching: |
| 25 case SampleProfileLoadingStatus.loading: | 14 case SampleProfileLoadingStatus.loading: |
| 26 return true; | 15 return true; |
| 27 default: | 16 default: |
| 28 return false; | 17 return false; |
| 29 } | 18 } |
| 30 } | 19 } |
| 31 | 20 |
| 32 abstract class SampleProfileLoadingProgressEvent { | 21 abstract class SampleProfileLoadingProgressEvent { |
| 33 SampleProfileLoadingProgress get progress; | 22 SampleProfileLoadingProgress get progress; |
| 34 } | 23 } |
| 35 | 24 |
| 36 abstract class SampleProfileLoadingProgress { | 25 abstract class SampleProfileLoadingProgress { |
| 37 SampleProfileLoadingStatus get status; | 26 SampleProfileLoadingStatus get status; |
| 38 double get progress; | 27 double get progress; |
| 39 Duration get fetchingTime; | 28 Duration get fetchingTime; |
| 40 Duration get loadingTime; | 29 Duration get loadingTime; |
| 41 SampleProfile get profile; | 30 SampleProfile get profile; |
| 42 } | 31 } |
| 43 | 32 |
| 44 abstract class ClassSampleProfileRepository { | 33 abstract class ClassSampleProfileRepository { |
| 45 Stream<SampleProfileLoadingProgressEvent> get(IsolateRef isolate, | 34 Stream<SampleProfileLoadingProgressEvent> get( |
| 46 ClassRef cls, SampleProfileTag tag); | 35 IsolateRef isolate, ClassRef cls, SampleProfileTag tag); |
| 47 Future enable(IsolateRef isolate, ClassRef cls); | 36 Future enable(IsolateRef isolate, ClassRef cls); |
| 48 Future disable(IsolateRef isolate, ClassRef cls); | 37 Future disable(IsolateRef isolate, ClassRef cls); |
| 49 } | 38 } |
| 50 | 39 |
| 51 abstract class IsolateSampleProfileRepository { | 40 abstract class IsolateSampleProfileRepository { |
| 52 Stream<SampleProfileLoadingProgressEvent> get(IsolateRef isolate, | 41 Stream<SampleProfileLoadingProgressEvent> get( |
| 53 SampleProfileTag tag, {bool clear: false, bool forceFetch: false}); | 42 IsolateRef isolate, SampleProfileTag tag, |
| 43 {bool clear: false, bool forceFetch: false}); |
| 54 } | 44 } |
| OLD | NEW |