Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
8 changes: 7 additions & 1 deletion analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@ analyzer:
- '**/build/**'
- '**.freezed.dart'
- tool/flutter-sdk/
- build/**
- android/**
- ios/**
- web/**
- windows/**
- macos/**
- linux/**

linter:
rules:
Expand Down Expand Up @@ -166,7 +173,6 @@ dart_code_metrics:
- integration_test/**
# Investigate internal usages of inspector_controller before removing.
- lib/src/screens/inspector/**_controller.dart
- lib/src/service/**
- lib/src/shared/**
- lib/src/standalone_ui/**
- test/**
Expand Down
6 changes: 6 additions & 0 deletions packages/devtools_app/analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ analyzer:
# these files if you want to ensure code is not invalid except where
# expected.
- test/test_infra/test_data/syntax_highlighting/**
- android/**
- ios/**
- web/**
- windows/**
- macos/**
- linux/**

dart_code_metrics:
metrics-exclude:
Expand Down
11 changes: 2 additions & 9 deletions packages/devtools_app/lib/src/service/service_extensions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -226,15 +226,6 @@ class ServiceExtensionDescription<T> extends extensions.ServiceExtension<T>
String get gaItemTooltipLink => '${gaItem}TooltipLink';
}

final debugAllowBanner = ToggleableServiceExtensionDescription<bool>.from(
extensions.debugAllowBanner,
title: 'Debug Banner',
iconAsset: 'icons/debug_banner@2x.png',
gaScreenName: gac.inspector,
gaItem: gac.debugBanner,
tooltip: 'Toggle Debug Banner',
);

final invertOversizedImages = ToggleableServiceExtensionDescription<bool>.from(
extensions.invertOversizedImages,
title: 'Highlight Oversized Images',
Expand Down Expand Up @@ -363,6 +354,8 @@ final slowAnimations = ToggleableServiceExtensionDescription<num>.from(
gaDocsItem: gac.slowAnimationDocs,
);

// TODO(https://github.com/flutter/devtools/issues/2780): hook this up in the UI.
// ignore: unused-code, TODO(https://github.com/flutter/devtools/issues/2780).
final togglePlatformMode = ServiceExtensionDescription<String>.from(
extensions.togglePlatformMode,
title: 'Override target platform',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ class TimelineStreamManager with DisposerMixin {
List<TimelineStream> get advancedStreams =>
_streamsWhere((stream) => stream.advanced);

@visibleForTesting
List<TimelineStream> get recordedStreams =>
_streamsWhere((stream) => stream.recorded.value);

Expand Down
35 changes: 5 additions & 30 deletions packages/devtools_app/lib/src/service/vm_service_wrapper.dart
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,9 @@ class VmServiceWrapper extends VmService {

final _activeStreams = <String, Future<Success>>{};

final activeFutures = <TrackedFuture<Object>>{};
final activeFutureNames = <String>[];

@visibleForTesting
Future<void> get allFuturesCompleted => _allFuturesCompleter.future;

Completer<bool> _allFuturesCompleter = Completer<bool>()
Expand Down Expand Up @@ -326,20 +327,6 @@ class VmServiceWrapper extends VmService {

// End Dart IO extension method wrappers.

/// Testing only method to indicate that we don't really need to await all
/// currently pending futures.
///
/// If you use this method be sure to indicate why you believe all pending
/// futures are safe to ignore. Currently the theory is this method should be
/// used after a hot restart to avoid bugs where we have zombie futures lying
/// around causing tests to flake.
@visibleForTesting
void doNotWaitForPendingFuturesBeforeExit() {
_allFuturesCompleter = Completer<bool>();
_allFuturesCompleter.complete(true);
activeFutures.clear();
}

@visibleForTesting
int vmServiceCallCount = 0;

Expand Down Expand Up @@ -383,15 +370,14 @@ class VmServiceWrapper extends VmService {
vmServiceCallCount++;
vmServiceCalls.add(name);

final trackedFuture = TrackedFuture(name, localFuture as Future<Object>);
if (_allFuturesCompleter.isCompleted) {
_allFuturesCompleter = Completer<bool>();
}
activeFutures.add(trackedFuture);
activeFutureNames.add(name);

void futureComplete() {
activeFutures.remove(trackedFuture);
if (activeFutures.isEmpty) {
activeFutureNames.remove(name);
if (activeFutureNames.isEmpty) {
_allFuturesCompleter.safeComplete(true);
}
}
Expand Down Expand Up @@ -428,10 +414,6 @@ class VmServiceWrapper extends VmService {
return parser(result.json);
}

/// Forces the VM to perform a full garbage collection.
Future<Success?> collectAllGarbage() =>
_privateRpcInvoke('collectAllGarbage', parser: Success.parse);

Future<InstanceRef?> getReachableSize(String isolateId, String targetId) =>
_privateRpcInvoke(
'getReachableSize',
Expand Down Expand Up @@ -512,10 +494,3 @@ class VmServiceWrapper extends VmService {
return response.dapResponse.body;
}
}

class TrackedFuture<T> {
TrackedFuture(this.name, this.future);

final String name;
final Future<T> future;
}
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,8 @@ class FlutterTestEnvironment {
const Duration(seconds: 20),
onTimeout: () {
throw 'Timed out waiting for futures to complete during teardown. '
'${_service.activeFutures.length} futures remained:\n\n'
' ${_service.activeFutures.map((tf) => tf.name).join('\n ')}';
'${_service.activeFutureNames.length} futures remained:\n\n'
' ${_service.activeFutureNames.join('\\n ')}';
},
);
await _flutter!.stop();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@

# The following line activates a set of recommended lints for Flutter apps,
# packages, and plugins designed to encourage good coding practices.
analyzer:
exclude:
- build/**
- android/**
- ios/**
- web/**
- windows/**
- macos/**
- linux/**
include: package:flutter_lints/flutter.yaml

linter:
Expand Down
9 changes: 9 additions & 0 deletions third_party/packages/widget_icons/analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -1 +1,10 @@
analyzer:
exclude:
- build/**
- android/**
- ios/**
- web/**
- windows/**
- macos/**
- linux/**
include: package:flutter_lints/flutter.yaml
Original file line number Diff line number Diff line change
@@ -1 +1,10 @@
analyzer:
exclude:
- build/**
- android/**
- ios/**
- web/**
- windows/**
- macos/**
- linux/**
include: package:flutter_lints/flutter.yaml
7 changes: 7 additions & 0 deletions tool/analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@ include: package:lints/recommended.yaml
analyzer:
exclude:
- flutter-sdk/
- build/**
- android/**
- ios/**
- web/**
- windows/**
- macos/**
- linux/**

linter:
rules:
Expand Down
Loading