Skip to content

Commit

Permalink
-
Browse files Browse the repository at this point in the history
  • Loading branch information
polina-c committed Apr 25, 2024
1 parent 8ba09a6 commit 1c48245
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@ class EventChartController extends ChartController {
_setupTraces();
setFixedYRange(visibleVmEvent, extensionEvent);
setupData();

addAutoDisposeListener(memoryTimeline.sampleAdded, () {
if (memoryTimeline.sampleAdded.value != null) {
addSample(memoryTimeline.sampleAdded.value!);
}
});
}

final ValueListenable<bool> paused;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class MemoryAndroidChartState extends State<MemoryAndroidChart>

void _init() {
cancelListeners();
addAutoDisposeListener(widget.chart.traceChanged);
addAutoDisposeListener(widget.chart.memoryTimeline.sampleAdded);
}

@override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,7 @@ class MemoryEventsPaneState extends State<MemoryEventsPane>
void _init() {
cancelListeners();

// Monitor heap samples.
addAutoDisposeListener(_memoryTimeline.sampleAdded, () {
final value = _memoryTimeline.sampleAdded.value;
if (value == null) return;
setState(() => widget.chart.addSample(value));
});
addAutoDisposeListener(widget.chart.memoryTimeline.sampleAdded);
}

@override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@ import 'package:devtools_app_shared/ui.dart';
import 'package:devtools_app_shared/utils.dart';
import 'package:flutter/material.dart';

import '../../../../../../shared/charts/chart.dart';
import '../../../../../../shared/charts/chart_controller.dart';
import '../../../../../shared/charts/chart.dart';
import '../../../../../shared/charts/chart_controller.dart';
import '../controller/charts/vm_chart_controller.dart';

class MemoryVMChart extends StatefulWidget {
const MemoryVMChart(this.chart, {super.key});

final ChartController chart;
final VMChartController chart;

@override
MemoryVMChartState createState() => MemoryVMChartState();
Expand All @@ -27,7 +28,7 @@ class MemoryVMChartState extends State<MemoryVMChart> with AutoDisposeMixin {

void _init() {
cancelListeners();
addAutoDisposeListener(widget.chart.traceChanged);
addAutoDisposeListener(widget.chart.memoryTimeline.sampleAdded);
}

@override
Expand Down

0 comments on commit 1c48245

Please sign in to comment.