Skip to content

chore: remove more unused code #5949

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 20 commits into from
Oct 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
1f175fc
chore: remove more unused code
incendial Jun 25, 2023
d1842a2
chore: fix formatting
incendial Jun 25, 2023
cc35ffc
chore: fix analyzer issues
incendial Jun 25, 2023
ecb1429
fix: restore used parts
incendial Jun 25, 2023
7f453a5
chore: fix formatting
incendial Jun 25, 2023
8697511
Merge branch 'master' of https://github.com/flutter/devtools into rem…
incendial Jul 11, 2023
439d958
fix: revert incorrect changes
incendial Jul 11, 2023
27c8277
Merge remote-tracking branch 'origin' into remove-unused-code-v3
incendial Jul 23, 2023
688baa4
Merge branch 'master' of https://github.com/flutter/devtools into rem…
incendial Oct 1, 2023
1d1835e
chore: revert several changes
incendial Oct 1, 2023
8c8c821
chore: revert more changes
incendial Oct 1, 2023
a0eb74b
chore: revert more changes
incendial Oct 1, 2023
8359ced
Merge branch 'master' of https://github.com/flutter/devtools into rem…
incendial Oct 10, 2023
e90c5ad
chore: revert one more change
incendial Oct 10, 2023
08a3bc7
fix: fix remaining issues
incendial Oct 10, 2023
c19c466
Merge branch 'master' of https://github.com/flutter/devtools into rem…
incendial Oct 21, 2023
2118dbb
build: update package version
incendial Oct 21, 2023
61b8b0e
Merge branch 'master' of https://github.com/flutter/devtools into rem…
incendial Oct 23, 2023
1fcf676
Merge branch 'master' of https://github.com/flutter/devtools into rem…
incendial Oct 23, 2023
d228342
chore: revert now referenced method
incendial Oct 23, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,6 @@ class _NotificationState extends State<_Notification>
Flexible(
child: _NotificationMessage(
widget: widget,
context: context,
),
),
_DismissAction(
Expand All @@ -276,7 +275,6 @@ class _NotificationState extends State<_Notification>
)
: _NotificationMessage(
widget: widget,
context: context,
),
const SizedBox(height: defaultSpacing),
_NotificationActions(widget: widget),
Expand Down Expand Up @@ -313,11 +311,9 @@ class _DismissAction extends StatelessWidget {
class _NotificationMessage extends StatelessWidget {
const _NotificationMessage({
required this.widget,
required this.context,
});

final _Notification widget;
final BuildContext context;

@override
Widget build(BuildContext context) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,6 @@ class CodeView extends StatefulWidget {
this.lineRange,
this.initialPosition,
this.onSelected,
this.enableFileExplorer = true,
this.enableSearch = true,
this.enableHistory = true,
}) : super(key: key);

Expand All @@ -78,8 +76,6 @@ class CodeView extends StatefulWidget {
// the script's source in its entirety, with lines outside of the range being
// rendered as if they have been greyed out.
final LineRange? lineRange;
final bool enableFileExplorer;
final bool enableSearch;
final bool enableHistory;

final void Function(ScriptRef scriptRef, int line)? onSelected;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,7 @@ class InspectorController extends DisposableController
_refreshRateLimiter = RateLimiter(refreshFramesPerSecond, refresh);

inspectorTree.config = InspectorTreeConfig(
summaryTree: isSummaryTree,
treeType: treeType,
onNodeAdded: _onNodeAdded,
onHover: highlightShowNode,
onSelectionChange: selectionChanged,
onExpand: _onExpand,
onClientActiveChange: _onClientChange,
Expand Down Expand Up @@ -499,10 +496,6 @@ class InspectorController extends DisposableController
details?.setSubtreeRoot(subtreeRoot, subtreeSelection);
}

InspectorInstanceRef? getSubtreeRootValue() {
return subtreeRoot?.valueRef;
}

void setSubtreeRoot(
RemoteDiagnosticsNode? node,
RemoteDiagnosticsNode? selection,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,6 @@ class InspectorTreeController extends DisposableController
});
}

RemoteDiagnosticsNode? subtreeRoot; // Optional.

InspectorTreeNode? get selection => _selection;
InspectorTreeNode? _selection;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import 'package:path/path.dart' as path;
import 'package:vm_service/vm_service.dart';

import '../../service/vm_service_wrapper.dart';
import '../../shared/console/eval/inspector_tree.dart';
import '../../shared/diagnostics/diagnostics_node.dart';
import '../../shared/diagnostics/inspector_service.dart';
import '../../shared/globals.dart';
Expand Down Expand Up @@ -64,100 +63,6 @@ Future<String> _retrieveFullStringValue(
Future.value(fallback);
}

class LoggingDetailsController {
LoggingDetailsController({
required this.onShowInspector,
required this.onShowDetails,
required this.createLoggingTree,
});

static const JsonEncoder jsonEncoder = JsonEncoder.withIndent(' ');

late LogData data;

/// Callback to execute to show the inspector.
final VoidCallback onShowInspector;

/// Callback to execute to show the data from the details tree in the view.
final OnShowDetails onShowDetails;

/// Callback to create an inspectorTree for the logging view of the correct
/// type.
final CreateLoggingTree createLoggingTree;

InspectorTreeController? tree;

void setData(LogData data) {
this.data = data;

tree = null;

if (data.node != null) {
tree = createLoggingTree(
onSelectionChange: () {
final InspectorTreeNode node = tree!.selection!;
unawaited(tree!.maybePopulateChildren(node));

// TODO(jacobr): node.diagnostic.isDiagnosticableValue isn't quite
// right.
final diagnosticLocal = node.diagnostic!;
if (diagnosticLocal.isDiagnosticableValue) {
// TODO(jacobr): warn if the selection can't be set as the node is
// stale which is likely if this is an old log entry.
onShowInspector();
unawaited(diagnosticLocal.setSelectionInspector(false));
}
},
);

final InspectorTreeNode root = tree!.setupInspectorTreeNode(
tree!.createNode(),
data.node!,
expandChildren: true,
expandProperties: true,
);
// No sense in collapsing the root node.
root.allowExpandCollapse = false;
tree!.root = root;
onShowDetails(tree: tree);

return;
}

// See if we need to asynchronously compute the log entry details.
if (data.needsComputing) {
onShowDetails(text: '');

unawaited(
data.compute().then((_) {
// If we're still displaying the same log entry, then update the UI with
// the calculated value.
if (this.data == data) {
_updateUIFromData();
}
}),
);
} else {
_updateUIFromData();
}
}

void _updateUIFromData() {
if (data.details?.startsWith('{') == true &&
data.details?.endsWith('}') == true) {
try {
// If the string decodes properly, then format the json.
final result = jsonDecode(data.details!);
onShowDetails(text: jsonEncoder.convert(result));
} catch (e) {
onShowDetails(text: data.details);
}
} else {
onShowDetails(text: data.details);
}
}
}

class LoggingController extends DisposableController
with
SearchControllerMixin<LogData>,
Expand Down Expand Up @@ -822,22 +727,6 @@ class LogData with SearchableDataMixin {
}
}

bool matchesFilter(String filter) {
if (kind.toLowerCase().contains(filter)) {
return true;
}

if (summary != null && summary!.toLowerCase().contains(filter)) {
return true;
}

if (_details != null && _details!.toLowerCase().contains(filter)) {
return true;
}

return false;
}

@override
bool matchesSearchToken(RegExp regExpSearch) {
return (summary?.caseInsensitiveContains(regExpSearch) == true) ||
Expand All @@ -849,23 +738,19 @@ class LogData with SearchableDataMixin {
}

class FrameInfo {
FrameInfo(this.number, this.elapsedMs, this.startTimeMs);
FrameInfo(this.number, this.elapsedMs);

static const String eventName = 'Flutter.Frame';

static const double kTargetMaxFrameTimeMs = 1000.0 / 60;

static FrameInfo from(Map<String, dynamic> data) {
return FrameInfo(
data['number'],
data['elapsed'] / 1000,
data['startTime'] / 1000,
);
}

final int? number;
final num? elapsedMs;
final num? startTimeMs;

@override
String toString() => 'frame $number ${elapsedMs!.toStringAsFixed(1)}ms';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,19 +112,11 @@ class MemoryController extends DisposableController

final _refreshCharts = ValueNotifier<int>(0);

void refreshAllCharts() {
_refreshCharts.value++;
_updateAndroidChartVisibility();
}

/// Default is to display default tick width based on width of chart of the collected
/// data in the chart.
final _displayIntervalNotifier =
ValueNotifier<ChartInterval>(ChartInterval.theDefault);

ValueListenable<ChartInterval> get displayIntervalNotifier =>
_displayIntervalNotifier;

set displayInterval(ChartInterval interval) {
_displayIntervalNotifier.value = interval;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,6 @@ class DiffPaneController extends DisposableController {
/// informational item.
bool get hasSnapshots => core.snapshots.value.length > 1;

// This value should never be reset. It is incremented for every snapshot that
// is taken, and is used to assign a unique id to each [SnapshotListItem].
int _snapshotId = 0;

Future<void> takeSnapshot() async {
_isTakingSnapshot.value = true;
ga.select(
Expand All @@ -53,7 +49,6 @@ class DiffPaneController extends DisposableController {
);

final item = SnapshotInstanceItem(
id: _snapshotId++,
displayNumber: _nextDisplayNumber(),
isolateName: selectedIsolateName ?? '<isolate-not-detected>',
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,10 @@ class SnapshotInstanceItem extends SnapshotItem {
SnapshotInstanceItem({
required this.displayNumber,
required this.isolateName,
required this.id,
}) {
_isProcessing.value = true;
}

final int id;

final String isolateName;

AdaptedHeap? heap;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class LeaksPaneController {
List<LeakReport> reports,
) async {
final graph = (await snapshotMemoryInSelectedIsolate())!;
return NotGCedAnalyzerTask.fromSnapshot(graph, reports, selectedIsolateId!);
return NotGCedAnalyzerTask.fromSnapshot(graph, reports);
}

Future<void> requestLeaksAndSaveToYaml() async {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,9 @@ class NotGCedAnalyzerTask {
static Future<NotGCedAnalyzerTask> fromSnapshot(
HeapSnapshotGraph graph,
List<LeakReport> reports,
String isolateId,
) async {
return NotGCedAnalyzerTask(
heap: await AdaptedHeapData.fromHeapSnapshot(graph, isolateId: isolateId),
heap: await AdaptedHeapData.fromHeapSnapshot(graph),
reports: reports,
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,22 +115,18 @@ class SnapshotTaker {
final snapshot = await snapshotMemoryInSelectedIsolate();
_timeline?.addSnapshotEvent();
if (snapshot == null) return null;
final result =
await _adaptSnapshotGaWrapper(snapshot, isolateId: selectedIsolateId!);
final result = await _adaptSnapshotGaWrapper(snapshot);
return result;
}
}

Future<AdaptedHeapData> _adaptSnapshotGaWrapper(
HeapSnapshotGraph graph, {
required String isolateId,
}) async {
Future<AdaptedHeapData> _adaptSnapshotGaWrapper(HeapSnapshotGraph graph) async {
late final AdaptedHeapData result;
await ga.timeAsync(
gac.memory,
gac.MemoryTime.adaptSnapshot,
asyncOperation: () async => result =
await AdaptedHeapData.fromHeapSnapshot(graph, isolateId: isolateId),
asyncOperation: () async =>
result = await AdaptedHeapData.fromHeapSnapshot(graph),
screenMetricsProvider: () => MemoryScreenMetrics(
heapObjectsTotal: graph.objects.length,
),
Expand Down
Loading