Skip to content
Open
Show file tree
Hide file tree
Changes from 17 commits
Commits
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
7 changes: 4 additions & 3 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -163,11 +163,12 @@ dart_code_metrics:
# devtools_app/.
# TODO(https://github.com/flutter/devtools/issues/9906) remove these
# excludes as findings are resolved.
- integration_test/**
# Investigate internal usages of inspector_controller before removing.
# Investigate internal usages of inspector logic before removing.
- lib/src/screens/inspector/**_controller.dart
- lib/src/shared/diagnostics/inspector_service.dart
- lib/src/shared/diagnostics/diagnostics_node.dart

- lib/src/service/**
- lib/src/shared/**
- lib/src/standalone_ui/**
- test/**
rules:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
// Note: this test was modeled after the example test from Flutter Gallery:
// https://github.com/flutter/gallery/blob/master/test_benchmarks/benchmarks_test.dart

import 'dart:convert' show JsonEncoder;
import 'dart:io';

import 'package:collection/collection.dart';
import 'package:devtools_app/src/shared/primitives/utils.dart';
import 'package:devtools_test/helpers.dart';
import 'package:test/test.dart';
import 'package:web_benchmarks/metrics.dart';
Expand Down Expand Up @@ -92,10 +92,7 @@ Future<void> _runBenchmarks({bool useWasm = false}) async {

stdout.writeln('Web benchmark tests finished.');

expect(
const JsonEncoder.withIndent(' ').convert(taskResult.toJson()),
isA<String>(),
);
expect(taskResult.toJson().prettyPrint(), isA<String>());
expect(taskResult.scores.keys, hasLength(DevToolsBenchmark.values.length));

for (final devToolsBenchmark in DevToolsBenchmark.values) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import 'dart:convert';
import 'dart:io';

import 'package:devtools_app/src/shared/primitives/utils.dart';
import 'package:web_benchmarks/analysis.dart';

import 'utils.dart';
Expand Down Expand Up @@ -61,6 +62,6 @@ void compareBenchmarks(
stdout.writeln('Baseline comparison finished.');
stdout
..writeln('==== Comparison with baseline $baselineSource ====')
..writeln(const JsonEncoder.withIndent(' ').convert(delta.toJson()))
..writeln(delta.toJson().prettyPrint())
..writeln('==== End of baseline comparison ====');
}
Original file line number Diff line number Diff line change
Expand Up @@ -389,11 +389,9 @@ final class FlutterDaemonConstants {
static const paramsKey = 'params';
static const traceKey = 'trace';
static const wsUriKey = 'wsUri';
static const pidKey = 'pid';
static const appStopKey = 'app.stop';
static const appStartedKey = 'app.started';
static const appDebugPortKey = 'app.debugPort';
static const daemonConnectedKey = 'daemon.connected';
}

enum TestAppDevice {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
// found in the LICENSE file or at https://developers.google.com/open-source/licenses/bsd.

import 'dart:collection';
import 'dart:convert';

import 'package:collection/collection.dart';
import 'package:string_scanner/string_scanner.dart';

import '../../shared/primitives/utils.dart';

//TODO(jacobr): cleanup.
/// A namespace for [SpanParser] utilities.
extension SpanParser on Never {
Expand Down Expand Up @@ -68,12 +69,12 @@ class Grammar {

@override
String toString() {
return const JsonEncoder.withIndent(' ').convert({
return {
'name': name,
'scopeName': scopeName,
'topLevelMatcher': topLevelMatcher.toJson(),
'repository': repository.toJson(),
});
}.prettyPrint();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ class InspectorTreeController extends DisposableController
final int? gaId;

InspectorTreeNode createNode() =>
InspectorTreeNode(whenDirty: _handleDirtyNode);
InspectorTreeNode();

SearchTargetType _searchTarget = SearchTargetType.widget;
int _rootSetCount = 0;
Expand Down Expand Up @@ -284,15 +284,6 @@ class InspectorTreeController extends DisposableController
}
}

/// Resets the state if the root has been marked as dirty.
void _handleDirtyNode(InspectorTreeNode node) {
if (node == root) {
_cachedSelectedRow = null;
lastContentWidth = null;
_updateRows();
}
}

void setSearchTarget(SearchTargetType searchTarget) {
_searchTarget = searchTarget;
refreshSearchMatches();
Expand Down Expand Up @@ -448,10 +439,6 @@ class InspectorTreeController extends DisposableController
return inspectorRowHeight * index;
}

void nodeChanged(InspectorTreeNode node) {
node.isDirty = true;
}

void removeNodeFromParent(InspectorTreeNode node) {
node.parent?.removeChild(node);
}
Expand Down Expand Up @@ -767,7 +754,6 @@ class InspectorTreeController extends DisposableController
setupChildren(diagnostic, treeNode, children, expandChildren: true);
refreshTree(
updateTreeAction: () {
nodeChanged(treeNode);
if (treeNode == selection) {
expandPath(treeNode);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1016,8 +1016,6 @@ class LogData with SearchableDataMixin {
String? _details;
Future<String> Function()? detailsComputer;

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

String? get details => _details;

bool get needsComputing => !detailsComputed.isCompleted;
Expand All @@ -1040,8 +1038,8 @@ class LogData with SearchableDataMixin {
}

try {
return prettyPrinter
.convert(jsonDecode(details!))
return (jsonDecode(details!) as Object?)
.prettyPrint()
.replaceAll(r'\n', '\n')
.trim();
} catch (_) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// found in the LICENSE file or at https://developers.google.com/open-source/licenses/bsd.

// ignore_for_file: non_constant_identifier_names
// ignore_for_file: unused-code, platform specific imports.

import 'dart:async';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ bool get isAnalyticsEnabled =>
/// Whether the analytics controller has been initialized.
bool get isAnalyticsControllerInitialized => _analyticsController != null;

typedef AsyncAnalyticsCallback = FutureOr<void> Function();

class AnalyticsController {
AnalyticsController({
required bool enabled,
Expand All @@ -67,6 +65,7 @@ class AnalyticsController {
ValueListenable<bool> get shouldPrompt => _shouldPrompt;
final ValueNotifier<bool> _shouldPrompt;

@visibleForTesting
bool get analyticsInitialized => _analyticsInitialized;
bool _analyticsInitialized = false;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,6 @@ const inspectorSettings = 'inspectorSettings';
const loggingSettings = 'loggingSettings';
const refreshPubRoots = 'refreshPubRoots';

enum InspectorDetailsViewType { layoutExplorer, widgetDetailsTree }

final defaultDetailsViewToLayoutExplorer =
InspectorDetailsViewType.layoutExplorer.name;
final defaultDetailsViewToWidgetDetails =
InspectorDetailsViewType.widgetDetailsTree.name;

enum HomeScreenEvents { connectToApp, connectToNewApp, viewVmFlags }

// Logging UX actions:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ part of '../constants.dart';
enum CpuProfilerEvents {
profileGranularity,
loadAllCpuSamples,
profileAppStartUp,
cpuProfileFlameChartHelp,
cpuProfileProcessingTime,
openDataFile,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@ enum PerformanceEvents {
disableOpacityLayers,
disablePhysicalShapeLayers,
countWidgetBuilds('trackRebuildWidgets'),
collectRasterStats,
clearRasterStats,
fullScreenLayerImage,
clearRebuildStats,
perfettoLoadTrace,
perfettoScrollToTimeRange,
Expand Down Expand Up @@ -55,6 +52,5 @@ enum PerformanceDocs {
shaderCompilationDocs,
shaderCompilationDocsTooltipLink,
impellerDocsLink,
impellerDocsLinkFromRasterStats,
platformChannelsDocs,
}
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ class InspectorScreenMetrics extends ScreenAnalyticsMetrics {
});

static const summaryTreeGaId = 0;
static const detailsTreeGaId = 1;

/// The number of times the root has been set, since the
/// [InspectorTreeController] with id [inspectorTreeControllerId], has been
Expand Down
17 changes: 6 additions & 11 deletions packages/devtools_app/lib/src/shared/charts/chart_trace.dart
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ class PaintCharacteristics {

/// If specified Y scale is computed and min value is fixed.
/// Will assert if new data point is less than min specified.
// ignore: unused-code, TODO(https://github.com/flutter/devtools/issues/9910) seems like a bug.
double? fixedMinY;

/// If specified Y scale is computed and max value is fixed.
Expand Down Expand Up @@ -88,11 +89,7 @@ class PaintCharacteristics {
}

class Trace {
Trace(this.controller, this._chartType, this.characteristics) {
final minY = characteristics.fixedMinY ?? 0.0;
final maxY = characteristics.fixedMaxY ?? 0.0;
yAxis = AxisScale(minY, maxY, 30);
}
Trace(this.controller, this._chartType, this.characteristics);

final ChartController controller;

Expand All @@ -113,6 +110,7 @@ class Trace {
/// -------------------------------
late bool stacked;

// ignore: unused-code, false positive used in asserts.
String? name;

double dataYMax = 0;
Expand Down Expand Up @@ -155,8 +153,6 @@ class Trace {

ChartType get chartType => _chartType;

AxisScale? yAxis;

void clearData() {
_data.clear();
controller.dirty = true;
Expand All @@ -173,7 +169,6 @@ class Trace {
);
} else if (datum.y > dataYMax) {
dataYMax = datum.y.toDouble();
yAxis = AxisScale(0, dataYMax, 30);
}

if (datum.y > controller.yMaxValue) {
Expand Down Expand Up @@ -298,7 +293,6 @@ class AxisScale {
fraction = 0;
}
return AxisScale._(
minPoint: minPoint,
maxPoint: maxPoint,
maxTicks: maxTicks,
tickSpacing: tickSpacing,
Expand All @@ -308,16 +302,17 @@ class AxisScale {
}

AxisScale._({
required this.minPoint,
required this.maxPoint,
required this.maxTicks,
required this.tickSpacing,
required this.labelUnitExponent,
required this.labelTicks,
});

final double minPoint, maxPoint;
@visibleForTesting
final double maxPoint;

@visibleForTesting
final double maxTicks;

final double tickSpacing;
Expand Down
Loading
Loading