| Index: runtime/observatory/lib/src/repositories/sample_profile.dart
|
| diff --git a/runtime/observatory/lib/src/repositories/sample_profile.dart b/runtime/observatory/lib/src/repositories/sample_profile.dart
|
| index 0cf5b55e942e736f3080c5338233fa271afe3eeb..5ad82824a65d5b4a86fb8581e7706ec7201249cc 100644
|
| --- a/runtime/observatory/lib/src/repositories/sample_profile.dart
|
| +++ b/runtime/observatory/lib/src/repositories/sample_profile.dart
|
| @@ -6,17 +6,22 @@ part of repositories;
|
|
|
| String _tagToString(M.SampleProfileTag tag) {
|
| switch (tag) {
|
| - case M.SampleProfileTag.userVM: return 'UserVM';
|
| - case M.SampleProfileTag.userOnly: return 'UserOnly';
|
| - case M.SampleProfileTag.vmUser: return 'VMUser';
|
| - case M.SampleProfileTag.vmOnly: return 'VMOnly';
|
| - case M.SampleProfileTag.none: return 'None';
|
| + case M.SampleProfileTag.userVM:
|
| + return 'UserVM';
|
| + case M.SampleProfileTag.userOnly:
|
| + return 'UserOnly';
|
| + case M.SampleProfileTag.vmUser:
|
| + return 'VMUser';
|
| + case M.SampleProfileTag.vmOnly:
|
| + return 'VMOnly';
|
| + case M.SampleProfileTag.none:
|
| + return 'None';
|
| }
|
| throw new Exception('Unknown SampleProfileTag: $tag');
|
| }
|
|
|
| class SampleProfileLoadingProgressEvent
|
| - implements M.SampleProfileLoadingProgressEvent {
|
| + implements M.SampleProfileLoadingProgressEvent {
|
| final SampleProfileLoadingProgress progress;
|
| SampleProfileLoadingProgressEvent(this.progress);
|
| }
|
| @@ -35,7 +40,7 @@ class SampleProfileLoadingProgress extends M.SampleProfileLoadingProgress {
|
| M.SampleProfileLoadingStatus _status = M.SampleProfileLoadingStatus.fetching;
|
| double _progress = 0.0;
|
| final Stopwatch _fetchingTime = new Stopwatch();
|
| - final Stopwatch _loadingTime = new Stopwatch();
|
| + final Stopwatch _loadingTime = new Stopwatch();
|
| CpuProfile _profile;
|
|
|
| M.SampleProfileLoadingStatus get status => _status;
|
| @@ -44,22 +49,21 @@ class SampleProfileLoadingProgress extends M.SampleProfileLoadingProgress {
|
| Duration get loadingTime => _loadingTime.elapsed;
|
| CpuProfile get profile => _profile;
|
|
|
| - SampleProfileLoadingProgress(this.isolate, this.tag,
|
| - this.clear, {this.cls}) {
|
| - _run();
|
| + SampleProfileLoadingProgress(this.isolate, this.tag, this.clear, {this.cls}) {
|
| + _run();
|
| }
|
|
|
| Future _run() async {
|
| _fetchingTime.start();
|
| try {
|
| if (clear) {
|
| - await isolate.invokeRpc('_clearCpuProfile', { });
|
| + await isolate.invokeRpc('_clearCpuProfile', {});
|
| }
|
|
|
| final response = cls != null
|
| - ? await cls.getAllocationSamples(_tagToString(tag))
|
| - : await isolate.invokeRpc('_getCpuProfile',
|
| - { 'tags': _tagToString(tag) });
|
| + ? await cls.getAllocationSamples(_tagToString(tag))
|
| + : await isolate
|
| + .invokeRpc('_getCpuProfile', {'tags': _tagToString(tag)});
|
|
|
| _fetchingTime.stop();
|
| _loadingTime.start();
|
| @@ -69,7 +73,10 @@ class SampleProfileLoadingProgress extends M.SampleProfileLoadingProgress {
|
| CpuProfile profile = new CpuProfile();
|
|
|
| Stream<double> progress = profile.loadProgress(isolate, response);
|
| - progress.listen((value) { _progress = value; _triggerOnProgress(); });
|
| + progress.listen((value) {
|
| + _progress = value;
|
| + _triggerOnProgress();
|
| + });
|
|
|
| await progress.drain();
|
|
|
| @@ -98,7 +105,7 @@ class SampleProfileLoadingProgress extends M.SampleProfileLoadingProgress {
|
|
|
| void reuse() {
|
| _onProgress =
|
| - new StreamController<SampleProfileLoadingProgressEvent>.broadcast();
|
| + new StreamController<SampleProfileLoadingProgressEvent>.broadcast();
|
| (() async {
|
| _triggerOnProgress();
|
| _onProgress.close();
|
| @@ -110,8 +117,9 @@ class IsolateSampleProfileRepository
|
| implements M.IsolateSampleProfileRepository {
|
| SampleProfileLoadingProgress _last;
|
|
|
| - Stream<SampleProfileLoadingProgressEvent> get(M.IsolateRef i,
|
| - M.SampleProfileTag t, {bool clear: false, bool forceFetch: false}) {
|
| + Stream<SampleProfileLoadingProgressEvent> get(
|
| + M.IsolateRef i, M.SampleProfileTag t,
|
| + {bool clear: false, bool forceFetch: false}) {
|
| assert(clear != null);
|
| assert(forceFetch != null);
|
| S.Isolate isolate = i as S.Isolate;
|
| @@ -125,16 +133,15 @@ class IsolateSampleProfileRepository
|
| }
|
| }
|
|
|
| -class ClassSampleProfileRepository
|
| - implements M.ClassSampleProfileRepository {
|
| - Stream<SampleProfileLoadingProgressEvent> get(M.Isolate i, M.ClassRef c,
|
| - M.SampleProfileTag t) {
|
| +class ClassSampleProfileRepository implements M.ClassSampleProfileRepository {
|
| + Stream<SampleProfileLoadingProgressEvent> get(
|
| + M.Isolate i, M.ClassRef c, M.SampleProfileTag t) {
|
| S.Isolate isolate = i as S.Isolate;
|
| S.Class cls = c as S.Class;
|
| assert(isolate != null);
|
| assert(cls != null);
|
| - return new SampleProfileLoadingProgress(isolate, t,
|
| - false, cls: cls).onProgress;
|
| + return new SampleProfileLoadingProgress(isolate, t, false, cls: cls)
|
| + .onProgress;
|
| }
|
|
|
| Future enable(M.IsolateRef i, M.ClassRef c) {
|
|
|