From 3c0ffbb1443d019b0748626d4c9e536373493f2e Mon Sep 17 00:00:00 2001 From: Anna Gringauze Date: Fri, 27 Jan 2023 12:02:54 -0800 Subject: [PATCH 1/2] Validate only needed summaries in expression_compiler_service --- dwds/lib/src/services/expression_compiler_service.dart | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/dwds/lib/src/services/expression_compiler_service.dart b/dwds/lib/src/services/expression_compiler_service.dart index 74cd13510..e94be84c3 100644 --- a/dwds/lib/src/services/expression_compiler_service.dart +++ b/dwds/lib/src/services/expression_compiler_service.dart @@ -71,7 +71,12 @@ class _Compiler { List experiments, bool verbose, ) async { - sdkConfiguration.validate(); + sdkConfiguration.validateSdkDir(); + if (soundNullSafety) { + sdkConfiguration.validateSoundSummaries(); + } else { + sdkConfiguration.validateWeakSummaries(); + } final librariesUri = sdkConfiguration.librariesUri!; final workerUri = sdkConfiguration.compilerWorkerUri!; From 3efadc560f8c7f8073bb0a8642a2bafeb5a8a5f8 Mon Sep 17 00:00:00 2001 From: Anna Gringauze Date: Wed, 22 Feb 2023 12:13:32 -0800 Subject: [PATCH 2/2] Remove unnecessary asyncs and awaits --- dwds/CHANGELOG.md | 1 + .../tool/update_dev_files.dart | 1 - .../tool/build_extension.dart | 1 - .../tool/update_dev_files.dart | 1 - dwds/debug_extension_mv3/web/background.dart | 2 -- dwds/lib/shared/batched_stream.dart | 2 +- dwds/lib/src/debugging/classes.dart | 6 ++--- dwds/lib/src/debugging/debugger.dart | 4 +-- dwds/lib/src/debugging/inspector.dart | 7 +++-- dwds/lib/src/debugging/instance.dart | 6 ++--- dwds/lib/src/debugging/libraries.dart | 2 +- dwds/lib/src/debugging/location.dart | 4 +-- dwds/lib/src/debugging/metadata/class.dart | 2 +- dwds/lib/src/debugging/metadata/function.dart | 2 +- dwds/lib/src/debugging/metadata/provider.dart | 3 +-- dwds/lib/src/debugging/skip_list.dart | 4 +-- dwds/lib/src/dwds_vm_client.dart | 2 +- dwds/lib/src/handlers/dev_handler.dart | 19 +++++++------- dwds/lib/src/loaders/legacy.dart | 8 +++--- .../readers/frontend_server_asset_reader.dart | 14 +++++----- .../readers/proxy_server_asset_reader.dart | 1 - dwds/lib/src/servers/extension_backend.dart | 1 - dwds/lib/src/services/app_debug_services.dart | 2 -- .../batched_expression_evaluator.dart | 2 +- .../src/services/chrome_proxy_service.dart | 26 +++++++++---------- dwds/lib/src/services/debug_service.dart | 2 +- .../services/expression_compiler_service.dart | 2 +- dwds/lib/src/utilities/dart_uri.dart | 2 +- dwds/lib/src/utilities/domain.dart | 2 +- dwds/lib/src/utilities/objects.dart | 2 +- dwds/lib/src/utilities/sdk_configuration.dart | 1 - dwds/lib/src/utilities/server.dart | 1 - dwds/test/build_daemon_breakpoint_test.dart | 1 - dwds/test/dart_uri_test.dart | 8 +++--- dwds/test/evaluate_circular_common.dart | 1 - dwds/test/fixtures/context.dart | 1 - .../test/frontend_server_breakpoint_test.dart | 1 - dwds/test/frontend_server_callstack_test.dart | 1 - dwds/test/instances/instance_test.dart | 1 - dwds/test/puppeteer/lifeline_test.dart | 1 - dwds/test/puppeteer/test_utils.dart | 1 - .../frontend_server_asset_reader_test.dart | 5 ++-- dwds/test/refresh_test.dart | 2 -- dwds/test/skip_list_test.dart | 10 +++---- dwds/web/reloader/manager.dart | 1 - 45 files changed, 71 insertions(+), 98 deletions(-) diff --git a/dwds/CHANGELOG.md b/dwds/CHANGELOG.md index 09fb15e34..25c7134cf 100644 --- a/dwds/CHANGELOG.md +++ b/dwds/CHANGELOG.md @@ -11,6 +11,7 @@ - Display records as a container of fields. - Remove test-only code from `sdk_configuration.dart`. - Move shared test-only code to a new `test_common` package. +- Convert unnecessary async code to sync. **Breaking changes** - Require `sdkConfigurationProvider` in `ExpressionCompilerService` diff --git a/dwds/debug_extension/tool/update_dev_files.dart b/dwds/debug_extension/tool/update_dev_files.dart index ece741349..a17d2fe20 100644 --- a/dwds/debug_extension/tool/update_dev_files.dart +++ b/dwds/debug_extension/tool/update_dev_files.dart @@ -2,7 +2,6 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -import 'dart:async'; import 'dart:io'; void main() async { diff --git a/dwds/debug_extension_mv3/tool/build_extension.dart b/dwds/debug_extension_mv3/tool/build_extension.dart index 05b35a1dc..56e4e135a 100644 --- a/dwds/debug_extension_mv3/tool/build_extension.dart +++ b/dwds/debug_extension_mv3/tool/build_extension.dart @@ -12,7 +12,6 @@ // - For prod: dart run tool/build_extension.dart prod // - For MV3: dart run tool/build_extension.dart --mv3 -import 'dart:async'; import 'dart:convert'; import 'dart:io'; diff --git a/dwds/debug_extension_mv3/tool/update_dev_files.dart b/dwds/debug_extension_mv3/tool/update_dev_files.dart index af4176069..de6311b8e 100644 --- a/dwds/debug_extension_mv3/tool/update_dev_files.dart +++ b/dwds/debug_extension_mv3/tool/update_dev_files.dart @@ -2,7 +2,6 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -import 'dart:async'; import 'dart:io'; void main() async { diff --git a/dwds/debug_extension_mv3/web/background.dart b/dwds/debug_extension_mv3/web/background.dart index e4e94229a..b2642a07b 100644 --- a/dwds/debug_extension_mv3/web/background.dart +++ b/dwds/debug_extension_mv3/web/background.dart @@ -5,8 +5,6 @@ @JS() library background; -import 'dart:async'; - import 'package:dwds/data/debug_info.dart'; import 'package:js/js.dart'; diff --git a/dwds/lib/shared/batched_stream.dart b/dwds/lib/shared/batched_stream.dart index 771c7f535..6bbc17c0f 100644 --- a/dwds/lib/shared/batched_stream.dart +++ b/dwds/lib/shared/batched_stream.dart @@ -39,7 +39,7 @@ class BatchedStreamController { Stream> get stream => _outputController.stream; /// Close the controller. - Future close() async { + Future close() { safeUnawaited(_inputController.close()); return _completer.future.then((value) => _outputController.close()); } diff --git a/dwds/lib/src/debugging/classes.dart b/dwds/lib/src/debugging/classes.dart index 78dc353c4..e9f24aa23 100644 --- a/dwds/lib/src/debugging/classes.dart +++ b/dwds/lib/src/debugging/classes.dart @@ -1,6 +1,6 @@ // Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file // for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file.import 'dart:async'; +// BSD-style license that can be found in the LICENSE file. import 'package:dwds/src/debugging/metadata/class.dart'; import 'package:dwds/src/loaders/strategy.dart'; @@ -191,7 +191,7 @@ class ClassHelper extends Domain { }); final fieldRefs = []; final fieldDescriptors = classDescriptor['fields'] as Map; - fieldDescriptors.forEach((name, descriptor) async { + fieldDescriptors.forEach((name, descriptor) { final classMetaData = ClassMetaData( jsName: descriptor['classRefName'], libraryId: descriptor['classRefLibraryId'], @@ -214,7 +214,7 @@ class ClassHelper extends Domain { final staticFieldDescriptors = classDescriptor['staticFields'] as Map; - staticFieldDescriptors.forEach((name, descriptor) async { + staticFieldDescriptors.forEach((name, descriptor) { fieldRefs.add( FieldRef( name: name, diff --git a/dwds/lib/src/debugging/debugger.dart b/dwds/lib/src/debugging/debugger.dart index 21d797d16..804ed0472 100644 --- a/dwds/lib/src/debugging/debugger.dart +++ b/dwds/lib/src/debugging/debugger.dart @@ -367,7 +367,7 @@ class Debugger extends Domain { // TODO(alanknight): Can these be moved to dart_scope.dart? final properties = await visibleProperties(debugger: this, frame: frame); final boundVariables = await Future.wait( - properties.map((property) async => await _boundVariable(property)), + properties.map(_boundVariable), ); // Filter out variables that do not come from dart code, such as native @@ -659,7 +659,7 @@ class Debugger extends Domain { // TODO(grouma) - In the future we should send all previously computed // skipLists. await _remoteDebugger.stepInto(params: { - 'skipList': await _skipLists.compute( + 'skipList': _skipLists.compute( scriptId, await _locations.locationsForUrl(url), ) diff --git a/dwds/lib/src/debugging/inspector.dart b/dwds/lib/src/debugging/inspector.dart index 795cf396d..9b6e92672 100644 --- a/dwds/lib/src/debugging/inspector.dart +++ b/dwds/lib/src/debugging/inspector.dart @@ -1,6 +1,6 @@ // Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file // for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file.import 'dart:async'; +// BSD-style license that can be found in the LICENSE file. import 'package:async/async.dart'; import 'package:collection/collection.dart'; @@ -114,9 +114,8 @@ class AppInspector implements AppInspectorInterface { final scripts = await scriptRefs; await DartUri.initialize(); - await DartUri.recordAbsoluteUris( - libraries.map((lib) => lib.uri).whereNotNull()); - await DartUri.recordAbsoluteUris( + DartUri.recordAbsoluteUris(libraries.map((lib) => lib.uri).whereNotNull()); + DartUri.recordAbsoluteUris( scripts.map((script) => script.uri).whereNotNull()); isolate.extensionRPCs?.addAll(await _getExtensionRpcs()); diff --git a/dwds/lib/src/debugging/instance.dart b/dwds/lib/src/debugging/instance.dart index 36eab3880..5d66d4b69 100644 --- a/dwds/lib/src/debugging/instance.dart +++ b/dwds/lib/src/debugging/instance.dart @@ -79,7 +79,7 @@ class InstanceHelper extends Domain { ..offset = (truncated ? offset : null); } - Future _closureInstanceFor(RemoteObject remoteObject) async { + Instance? _closureInstanceFor(RemoteObject remoteObject) { final objectId = remoteObject.objectId; if (objectId == null) return null; final result = Instance( @@ -354,8 +354,8 @@ class InstanceHelper extends Domain { count: count, elementCount: elements.length, length: length); final range = elements.sublist(0, rangeCount); - return Future.wait(range - .map((element) async => await _instanceRefForRemote(element.value))); + return Future.wait( + range.map((element) => _instanceRefForRemote(element.value))); } /// Return elements of the list from [properties]. diff --git a/dwds/lib/src/debugging/libraries.dart b/dwds/lib/src/debugging/libraries.dart index 7c9c3ba75..bed9938e3 100644 --- a/dwds/lib/src/debugging/libraries.dart +++ b/dwds/lib/src/debugging/libraries.dart @@ -1,6 +1,6 @@ // Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file // for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file.import 'dart:async'; +// BSD-style license that can be found in the LICENSE file. import 'package:collection/collection.dart'; import 'package:dwds/src/debugging/metadata/class.dart'; diff --git a/dwds/lib/src/debugging/location.dart b/dwds/lib/src/debugging/location.dart index 217dc3c4e..ca24294fc 100644 --- a/dwds/lib/src/debugging/location.dart +++ b/dwds/lib/src/debugging/location.dart @@ -270,11 +270,11 @@ class Locations { /// [module] refers to the JS path of a DDC module without the extension. /// /// This will populate the [_sourceToLocation] and [_moduleToLocations] maps. - Future> _locationsForModule(String module) async { + Future> _locationsForModule(String module) { final memoizer = _locationMemoizer.putIfAbsent(module, () => AsyncMemoizer()); - return await memoizer.runOnce(() async { + return memoizer.runOnce(() async { if (_moduleToLocations.containsKey(module)) { return _moduleToLocations[module]!; } diff --git a/dwds/lib/src/debugging/metadata/class.dart b/dwds/lib/src/debugging/metadata/class.dart index 343aa65ea..56fc7de3b 100644 --- a/dwds/lib/src/debugging/metadata/class.dart +++ b/dwds/lib/src/debugging/metadata/class.dart @@ -1,6 +1,6 @@ // Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file // for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file.import 'dart:async'; +// BSD-style license that can be found in the LICENSE file. import 'package:dwds/src/debugging/remote_debugger.dart'; import 'package:dwds/src/loaders/strategy.dart'; diff --git a/dwds/lib/src/debugging/metadata/function.dart b/dwds/lib/src/debugging/metadata/function.dart index 2a5333d7b..16916e37a 100644 --- a/dwds/lib/src/debugging/metadata/function.dart +++ b/dwds/lib/src/debugging/metadata/function.dart @@ -1,6 +1,6 @@ // Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file // for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file.import 'dart:async'; +// BSD-style license that can be found in the LICENSE file. import 'package:dwds/src/debugging/remote_debugger.dart'; import 'package:dwds/src/loaders/strategy.dart'; diff --git a/dwds/lib/src/debugging/metadata/provider.dart b/dwds/lib/src/debugging/metadata/provider.dart index 0184fdb3d..677bde885 100644 --- a/dwds/lib/src/debugging/metadata/provider.dart +++ b/dwds/lib/src/debugging/metadata/provider.dart @@ -1,8 +1,7 @@ // Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file // for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file.import 'dart:async'; +// BSD-style license that can be found in the LICENSE file. -import 'dart:async'; import 'dart:convert'; import 'package:async/async.dart'; diff --git a/dwds/lib/src/debugging/skip_list.dart b/dwds/lib/src/debugging/skip_list.dart index ccb4db25b..cacea7256 100644 --- a/dwds/lib/src/debugging/skip_list.dart +++ b/dwds/lib/src/debugging/skip_list.dart @@ -18,10 +18,10 @@ class SkipLists { /// https://chromedevtools.github.io/devtools-protocol/tot/Debugger/#method-stepInto /// /// Can return a cached value. - Future>> compute( + List> compute( String scriptId, Set locations, - ) async { + ) { if (_idToList.containsKey(scriptId)) return _idToList[scriptId]!; final sortedLocations = locations.toList() diff --git a/dwds/lib/src/dwds_vm_client.dart b/dwds/lib/src/dwds_vm_client.dart index baa2d7fbb..f82501812 100644 --- a/dwds/lib/src/dwds_vm_client.dart +++ b/dwds/lib/src/dwds_vm_client.dart @@ -148,7 +148,7 @@ class DwdsVmClient { } Future> hotRestart( - ChromeProxyService chromeProxyService, VmService client) async { + ChromeProxyService chromeProxyService, VmService client) { return _hotRestartQueue.run(() => _hotRestart(chromeProxyService, client)); } } diff --git a/dwds/lib/src/handlers/dev_handler.dart b/dwds/lib/src/handlers/dev_handler.dart index c4db774f3..b63482b29 100644 --- a/dwds/lib/src/handlers/dev_handler.dart +++ b/dwds/lib/src/handlers/dev_handler.dart @@ -117,9 +117,8 @@ class DevHandler { for (var handler in _sseHandlers.values) { handler.shutdown(); } - await Future.wait(_servicesByAppId.values.map((service) async { - await service.close(); - })); + await Future.wait( + _servicesByAppId.values.map((service) => service.close())); _servicesByAppId.clear(); }(); @@ -269,19 +268,19 @@ class DevHandler { if (message is DevToolsRequest) { await _handleDebugRequest(connection, injectedConnection); } else if (message is IsolateExit) { - await _handleIsolateExit(connection); + _handleIsolateExit(connection); } else if (message is IsolateStart) { await _handleIsolateStart(connection, injectedConnection); } else if (message is BatchedDebugEvents) { - await _servicesByAppId[connection.request.appId] + _servicesByAppId[connection.request.appId] ?.chromeProxyService .parseBatchedDebugEvents(message); } else if (message is DebugEvent) { - await _servicesByAppId[connection.request.appId] + _servicesByAppId[connection.request.appId] ?.chromeProxyService .parseDebugEvent(message); } else if (message is RegisterEvent) { - await _servicesByAppId[connection.request.appId] + _servicesByAppId[connection.request.appId] ?.chromeProxyService .parseRegisterEvent(message); } @@ -302,7 +301,7 @@ class DevHandler { } }); - safeUnawaited(injectedConnection.sink.done.then((_) async { + safeUnawaited(injectedConnection.sink.done.then((_) { _injectedConnections.remove(injectedConnection); final connection = appConnection; if (connection != null) { @@ -419,7 +418,7 @@ class DevHandler { return connection; } - Future _handleIsolateExit(AppConnection appConnection) async { + void _handleIsolateExit(AppConnection appConnection) { _servicesByAppId[appConnection.request.appId] ?.chromeProxyService .destroyIsolate(); @@ -432,7 +431,7 @@ class DevHandler { .createIsolate(appConnection); } - Future _listen() async { + void _listen() { _subs.add(_injected.devHandlerPaths.listen((devHandlerPath) async { final uri = Uri.parse(devHandlerPath); if (!_sseHandlers.containsKey(uri.path)) { diff --git a/dwds/lib/src/loaders/legacy.dart b/dwds/lib/src/loaders/legacy.dart index 9f3f3d8da..aa6c27a7f 100644 --- a/dwds/lib/src/loaders/legacy.dart +++ b/dwds/lib/src/loaders/legacy.dart @@ -100,8 +100,7 @@ class LegacyStrategy extends LoadStrategy { 'window.\$dartLoader.forceLoadModule("$clientScript");\n'; @override - Future moduleForServerPath( - String entrypoint, String serverPath) async => + Future moduleForServerPath(String entrypoint, String serverPath) => _moduleForServerPath(metadataProviderFor(entrypoint), serverPath); @override @@ -109,12 +108,11 @@ class LegacyStrategy extends LoadStrategy { _moduleInfoForProvider(metadataProviderFor(entrypoint)); @override - Future serverPathForModule(String entrypoint, String module) async => + Future serverPathForModule(String entrypoint, String module) => _serverPathForModule(metadataProviderFor(entrypoint), module); @override - Future sourceMapPathForModule( - String entrypoint, String module) async => + Future sourceMapPathForModule(String entrypoint, String module) => _sourceMapPathForModule(metadataProviderFor(entrypoint), module); @override diff --git a/dwds/lib/src/readers/frontend_server_asset_reader.dart b/dwds/lib/src/readers/frontend_server_asset_reader.dart index f9f088cd9..ecdc7cab0 100644 --- a/dwds/lib/src/readers/frontend_server_asset_reader.dart +++ b/dwds/lib/src/readers/frontend_server_asset_reader.dart @@ -85,22 +85,22 @@ class FrontendServerAssetReader implements AssetReader { /// Updates the internal caches by reading the Frontend Server output files. /// /// Will only read the incremental files on additional calls. - Future updateCaches() async { + void updateCaches() { if (!_haveReadOriginals) { - await _updateCaches(_mapOriginal, _jsonOriginal); + _updateCaches(_mapOriginal, _jsonOriginal); _haveReadOriginals = true; } else { - await _updateCaches(_mapIncremental, _jsonIncremental); + _updateCaches(_mapIncremental, _jsonIncremental); } } - Future _updateCaches(File map, File json) async { - if (!(await map.exists() && await json.exists())) { + void _updateCaches(File map, File json) { + if (!(map.existsSync() && json.existsSync())) { throw StateError('$map and $json do not exist.'); } - final sourceContents = await map.readAsBytes(); + final sourceContents = map.readAsBytesSync(); final sourceInfo = - jsonDecode(await json.readAsString()) as Map; + jsonDecode(json.readAsStringSync()) as Map; for (var key in sourceInfo.keys) { final info = sourceInfo[key]; _mapContents[key] = utf8.decode(sourceContents diff --git a/dwds/lib/src/readers/proxy_server_asset_reader.dart b/dwds/lib/src/readers/proxy_server_asset_reader.dart index e84889bdf..18edda6df 100644 --- a/dwds/lib/src/readers/proxy_server_asset_reader.dart +++ b/dwds/lib/src/readers/proxy_server_asset_reader.dart @@ -2,7 +2,6 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -import 'dart:async'; import 'dart:convert'; import 'dart:io'; diff --git a/dwds/lib/src/servers/extension_backend.dart b/dwds/lib/src/servers/extension_backend.dart index 219501a49..772b6aa50 100644 --- a/dwds/lib/src/servers/extension_backend.dart +++ b/dwds/lib/src/servers/extension_backend.dart @@ -2,7 +2,6 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -import 'dart:async'; import 'dart:io'; import 'package:async/async.dart'; diff --git a/dwds/lib/src/services/app_debug_services.dart b/dwds/lib/src/services/app_debug_services.dart index 770e1a5df..2e07a4479 100644 --- a/dwds/lib/src/services/app_debug_services.dart +++ b/dwds/lib/src/services/app_debug_services.dart @@ -2,8 +2,6 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -import 'dart:async'; - import 'package:dwds/src/dwds_vm_client.dart'; import 'package:dwds/src/events.dart'; import 'package:dwds/src/services/chrome_proxy_service.dart' diff --git a/dwds/lib/src/services/batched_expression_evaluator.dart b/dwds/lib/src/services/batched_expression_evaluator.dart index 75658c1c4..6881dcc2e 100644 --- a/dwds/lib/src/services/batched_expression_evaluator.dart +++ b/dwds/lib/src/services/batched_expression_evaluator.dart @@ -68,7 +68,7 @@ class BatchedExpressionEvaluator extends ExpressionEvaluator { return request.completer.future; } - Future _processRequest(List requests) async { + void _processRequest(List requests) { String? libraryUri; String? isolateId; Map? scope; diff --git a/dwds/lib/src/services/chrome_proxy_service.dart b/dwds/lib/src/services/chrome_proxy_service.dart index 63fa47199..8cb0b9e88 100644 --- a/dwds/lib/src/services/chrome_proxy_service.dart +++ b/dwds/lib/src/services/chrome_proxy_service.dart @@ -488,7 +488,7 @@ ${globalLoadStrategy.loadModuleSnippet}("dart_sdk").developer.invokeExtension( String expression, { Map? scope, bool? disableBreakpoints, - }) async { + }) { // TODO(798) - respect disableBreakpoints. return captureElapsedTime(() async { await isInitialized; @@ -512,7 +512,7 @@ ${globalLoadStrategy.loadModuleSnippet}("dart_sdk").developer.invokeExtension( @override Future evaluateInFrame( String isolateId, int frameIndex, String expression, - {Map? scope, bool? disableBreakpoints}) async { + {Map? scope, bool? disableBreakpoints}) { // TODO(798) - respect disableBreakpoints. return captureElapsedTime(() async { @@ -563,7 +563,7 @@ ${globalLoadStrategy.loadModuleSnippet}("dart_sdk").developer.invokeExtension( } @override - Future getIsolate(String isolateId) async { + Future getIsolate(String isolateId) { return captureElapsedTime(() async { await isInitialized; _checkIsolate('getIsolate', isolateId); @@ -587,8 +587,8 @@ ${globalLoadStrategy.loadModuleSnippet}("dart_sdk").developer.invokeExtension( } @override - Future getScripts(String isolateId) async { - return await captureElapsedTime(() async { + Future getScripts(String isolateId) { + return captureElapsedTime(() async { await isInitialized; _checkIsolate('getScripts', isolateId); return inspector.getScripts(); @@ -605,8 +605,8 @@ ${globalLoadStrategy.loadModuleSnippet}("dart_sdk").developer.invokeExtension( bool? forceCompile, bool? reportLines, List? libraryFilters, - }) async { - return await captureElapsedTime(() async { + }) { + return captureElapsedTime(() async { await isInitialized; _checkIsolate('getSourceReport', isolateId); return await inspector.getSourceReport( @@ -635,7 +635,7 @@ ${globalLoadStrategy.loadModuleSnippet}("dart_sdk").developer.invokeExtension( } @override - Future getVM() async { + Future getVM() { return captureElapsedTime(() async { await isInitialized; return _vm; @@ -739,7 +739,7 @@ ${globalLoadStrategy.loadModuleSnippet}("dart_sdk").developer.invokeExtension( } @override - Future registerService(String service, String alias) async { + Future registerService(String service, String alias) { return _rpcNotSupportedFuture('registerService'); } @@ -917,15 +917,15 @@ ${globalLoadStrategy.loadModuleSnippet}("dart_sdk").developer.invokeExtension( /// Parses the [BatchedDebugEvents] and emits corresponding Dart VM Service /// protocol [Event]s. - Future parseBatchedDebugEvents(BatchedDebugEvents debugEvents) async { + void parseBatchedDebugEvents(BatchedDebugEvents debugEvents) { for (var debugEvent in debugEvents.events) { - await parseDebugEvent(debugEvent); + parseDebugEvent(debugEvent); } } /// Parses the [DebugEvent] and emits a corresponding Dart VM Service /// protocol [Event]. - Future parseDebugEvent(DebugEvent debugEvent) async { + void parseDebugEvent(DebugEvent debugEvent) { if (terminatingIsolates) return; if (!_isIsolateRunning) return; final isolateRef = inspector.isolateRef; @@ -943,7 +943,7 @@ ${globalLoadStrategy.loadModuleSnippet}("dart_sdk").developer.invokeExtension( /// Parses the [RegisterEvent] and emits a corresponding Dart VM Service /// protocol [Event]. - Future parseRegisterEvent(RegisterEvent registerEvent) async { + void parseRegisterEvent(RegisterEvent registerEvent) { if (terminatingIsolates) return; if (!_isIsolateRunning) return; diff --git a/dwds/lib/src/services/debug_service.dart b/dwds/lib/src/services/debug_service.dart index 8392dad51..a4d6818f2 100644 --- a/dwds/lib/src/services/debug_service.dart +++ b/dwds/lib/src/services/debug_service.dart @@ -60,7 +60,7 @@ void Function(WebSocketChannel) _createNewConnectionHandler( VmServerConnection(inputStream, responseController.sink, serviceExtensionRegistry, chromeProxyService) .done - .whenComplete(() async { + .whenComplete(() { --_clientsConnected; if (!_acceptNewConnections && _clientsConnected == 0) { // DDS has disconnected so we can allow for clients to connect directly diff --git a/dwds/lib/src/services/expression_compiler_service.dart b/dwds/lib/src/services/expression_compiler_service.dart index 639e21880..aac6e6322 100644 --- a/dwds/lib/src/services/expression_compiler_service.dart +++ b/dwds/lib/src/services/expression_compiler_service.dart @@ -207,7 +207,7 @@ class _Compiler { /// /// Terminates the isolate running expression compiler worker /// and marks the service as stopped. - Future stop() async { + void stop() { _sendPort.send({'command': 'Shutdown'}); _receivePort.close(); _logger.info('Stopped.'); diff --git a/dwds/lib/src/utilities/dart_uri.dart b/dwds/lib/src/utilities/dart_uri.dart index a3f47aaba..88e81dc67 100644 --- a/dwds/lib/src/utilities/dart_uri.dart +++ b/dwds/lib/src/utilities/dart_uri.dart @@ -166,7 +166,7 @@ class DartUri { } /// Record all of the libraries, indexed by their absolute file: URI. - static Future recordAbsoluteUris(Iterable libraryUris) async { + static void recordAbsoluteUris(Iterable libraryUris) { for (var uri in libraryUris) { _recordAbsoluteUri(uri); } diff --git a/dwds/lib/src/utilities/domain.dart b/dwds/lib/src/utilities/domain.dart index 5e4191939..6fedc5d41 100644 --- a/dwds/lib/src/utilities/domain.dart +++ b/dwds/lib/src/utilities/domain.dart @@ -1,6 +1,6 @@ // Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file // for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file.import 'dart:async'; +// BSD-style license that can be found in the LICENSE file. import 'package:dwds/src/connections/app_connection.dart'; import 'package:dwds/src/debugging/remote_debugger.dart'; diff --git a/dwds/lib/src/utilities/objects.dart b/dwds/lib/src/utilities/objects.dart index bf13fd50a..4b3444e91 100644 --- a/dwds/lib/src/utilities/objects.dart +++ b/dwds/lib/src/utilities/objects.dart @@ -1,6 +1,6 @@ // Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file // for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file.import 'dart:async'; +// BSD-style license that can be found in the LICENSE file. /// A library for WebKit mirror objects and support code. These probably should /// get migrated into webkit_inspection_protocol over time. diff --git a/dwds/lib/src/utilities/sdk_configuration.dart b/dwds/lib/src/utilities/sdk_configuration.dart index dce469196..a1198eb2d 100644 --- a/dwds/lib/src/utilities/sdk_configuration.dart +++ b/dwds/lib/src/utilities/sdk_configuration.dart @@ -2,7 +2,6 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -import 'dart:async'; import 'dart:io'; import 'package:file/file.dart'; diff --git a/dwds/lib/src/utilities/server.dart b/dwds/lib/src/utilities/server.dart index 579733b6d..923962f77 100644 --- a/dwds/lib/src/utilities/server.dart +++ b/dwds/lib/src/utilities/server.dart @@ -2,7 +2,6 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -import 'dart:async'; import 'dart:io'; import 'package:dwds/src/services/chrome_debug_exception.dart'; diff --git a/dwds/test/build_daemon_breakpoint_test.dart b/dwds/test/build_daemon_breakpoint_test.dart index 8dd6fe192..50bb09f17 100644 --- a/dwds/test/build_daemon_breakpoint_test.dart +++ b/dwds/test/build_daemon_breakpoint_test.dart @@ -4,7 +4,6 @@ @TestOn('vm') @Timeout(Duration(minutes: 2)) -import 'dart:async'; import 'package:dwds/src/connections/debug_connection.dart'; import 'package:dwds/src/services/chrome_proxy_service.dart'; diff --git a/dwds/test/dart_uri_test.dart b/dwds/test/dart_uri_test.dart index 5e061bcea..390f7d638 100644 --- a/dwds/test/dart_uri_test.dart +++ b/dwds/test/dart_uri_test.dart @@ -65,7 +65,7 @@ void main() { group('initialized with empty configuration', () { setUpAll(() async { await DartUri.initialize(); - await DartUri.recordAbsoluteUris(['dart:io', 'dart:html']); + DartUri.recordAbsoluteUris(['dart:io', 'dart:html']); }); tearDownAll(DartUri.clear); @@ -78,7 +78,7 @@ void main() { group('initialized with current SDK directory', () { setUpAll(() async { await DartUri.initialize(); - await DartUri.recordAbsoluteUris(['dart:io', 'dart:html']); + DartUri.recordAbsoluteUris(['dart:io', 'dart:html']); }); tearDownAll(DartUri.clear); @@ -98,7 +98,7 @@ void main() { group('initialized with other SDK directory', () { setUpAll(() async { await DartUri.initialize(); - await DartUri.recordAbsoluteUris(['dart:io', 'dart:html']); + DartUri.recordAbsoluteUris(['dart:io', 'dart:html']); }); tearDownAll(() async { @@ -132,7 +132,7 @@ void main() { setUpAll(() async { configureLogWriter(customLogWriter: logWriter); await DartUri.initialize(); - await DartUri.recordAbsoluteUris(['dart:io', 'dart:html']); + DartUri.recordAbsoluteUris(['dart:io', 'dart:html']); }); tearDownAll(() async { diff --git a/dwds/test/evaluate_circular_common.dart b/dwds/test/evaluate_circular_common.dart index f7a0a450b..27812b7df 100644 --- a/dwds/test/evaluate_circular_common.dart +++ b/dwds/test/evaluate_circular_common.dart @@ -4,7 +4,6 @@ @TestOn('vm') @Timeout(Duration(minutes: 2)) -import 'dart:async'; import 'package:dwds/src/connections/debug_connection.dart'; import 'package:dwds/src/services/chrome_proxy_service.dart'; diff --git a/dwds/test/fixtures/context.dart b/dwds/test/fixtures/context.dart index bc8454882..b5a769866 100644 --- a/dwds/test/fixtures/context.dart +++ b/dwds/test/fixtures/context.dart @@ -2,7 +2,6 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -import 'dart:async'; import 'dart:convert'; import 'dart:io'; diff --git a/dwds/test/frontend_server_breakpoint_test.dart b/dwds/test/frontend_server_breakpoint_test.dart index f9498a353..0664f1511 100644 --- a/dwds/test/frontend_server_breakpoint_test.dart +++ b/dwds/test/frontend_server_breakpoint_test.dart @@ -4,7 +4,6 @@ @TestOn('vm') @Timeout(Duration(minutes: 2)) -import 'dart:async'; import 'package:dwds/src/connections/debug_connection.dart'; import 'package:dwds/src/services/chrome_proxy_service.dart'; diff --git a/dwds/test/frontend_server_callstack_test.dart b/dwds/test/frontend_server_callstack_test.dart index ec6566dfb..e4ed5ff16 100644 --- a/dwds/test/frontend_server_callstack_test.dart +++ b/dwds/test/frontend_server_callstack_test.dart @@ -4,7 +4,6 @@ @TestOn('vm') @Timeout(Duration(minutes: 2)) -import 'dart:async'; import 'package:dwds/src/connections/debug_connection.dart'; import 'package:dwds/src/services/chrome_proxy_service.dart'; diff --git a/dwds/test/instances/instance_test.dart b/dwds/test/instances/instance_test.dart index 8a1e4d60c..01fa041ee 100644 --- a/dwds/test/instances/instance_test.dart +++ b/dwds/test/instances/instance_test.dart @@ -3,7 +3,6 @@ // BSD-style license that can be found in the LICENSE file. @Timeout(Duration(minutes: 2)) -import 'dart:async'; import 'package:dwds/src/connections/debug_connection.dart'; import 'package:dwds/src/debugging/debugger.dart'; diff --git a/dwds/test/puppeteer/lifeline_test.dart b/dwds/test/puppeteer/lifeline_test.dart index 13a0359fd..4067f44d7 100644 --- a/dwds/test/puppeteer/lifeline_test.dart +++ b/dwds/test/puppeteer/lifeline_test.dart @@ -4,7 +4,6 @@ @Timeout(Duration(minutes: 12)) @Skip('https://github.com/dart-lang/webdev/issues/1788') -import 'dart:async'; import 'package:puppeteer/puppeteer.dart'; import 'package:test/test.dart'; diff --git a/dwds/test/puppeteer/test_utils.dart b/dwds/test/puppeteer/test_utils.dart index 5583e34b4..8be8dcd7a 100644 --- a/dwds/test/puppeteer/test_utils.dart +++ b/dwds/test/puppeteer/test_utils.dart @@ -2,7 +2,6 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -import 'dart:async'; import 'dart:io'; import 'package:path/path.dart' as p; diff --git a/dwds/test/readers/frontend_server_asset_reader_test.dart b/dwds/test/readers/frontend_server_asset_reader_test.dart index 619038873..f1b2fd04b 100644 --- a/dwds/test/readers/frontend_server_asset_reader_test.dart +++ b/dwds/test/readers/frontend_server_asset_reader_test.dart @@ -3,7 +3,6 @@ // BSD-style license that can be found in the LICENSE file. @Timeout(Duration(minutes: 2)) -import 'dart:async'; import 'dart:io'; import 'package:dwds/src/readers/frontend_server_asset_reader.dart'; @@ -42,7 +41,7 @@ void main() { p.join(tempFixtures.path, 'main.dart.dill'), packagesDir, ); - await assetReader.updateCaches(); + assetReader.updateCaches(); }); tearDown(() async { @@ -103,7 +102,7 @@ void main() { .writeAsString((await mapOriginal.readAsString()) .replaceAll('web/main.dart.lib.js', 'web/foo.dart.lib.js')); - await assetReader.updateCaches(); + assetReader.updateCaches(); final newResult = await assetReader.sourceMapContents('web/foo.dart.lib.js.map'); diff --git a/dwds/test/refresh_test.dart b/dwds/test/refresh_test.dart index 2fc125b9e..00a53208d 100644 --- a/dwds/test/refresh_test.dart +++ b/dwds/test/refresh_test.dart @@ -8,8 +8,6 @@ @Timeout(Duration(minutes: 2)) library refresh_test; -import 'dart:async'; - import 'package:dwds/src/connections/debug_connection.dart'; import 'package:dwds/src/services/chrome_proxy_service.dart'; import 'package:test/test.dart'; diff --git a/dwds/test/skip_list_test.dart b/dwds/test/skip_list_test.dart index c6f90d906..dff6ace93 100644 --- a/dwds/test/skip_list_test.dart +++ b/dwds/test/skip_list_test.dart @@ -31,7 +31,7 @@ void main() { }); test('do not include known ranges', () async { - final skipList = await skipLists.compute('123', { + final skipList = skipLists.compute('123', { Location.from( 'foo', TargetLineEntry(1, []), TargetEntry(2, 0, 0, 0), dartUri), Location.from( @@ -44,7 +44,7 @@ void main() { }); test('do not include start of the file', () async { - final skipList = await skipLists.compute('123', { + final skipList = skipLists.compute('123', { Location.from( 'foo', TargetLineEntry(0, []), TargetEntry(0, 0, 0, 0), dartUri), Location.from( @@ -56,7 +56,7 @@ void main() { }); test('does not depend on order of locations', () async { - final skipList = await skipLists.compute('123', { + final skipList = skipLists.compute('123', { Location.from( 'foo', TargetLineEntry(10, []), TargetEntry(20, 0, 0, 0), dartUri), Location.from( @@ -69,14 +69,14 @@ void main() { test('contains the provided id', () async { final id = '123'; - final skipList = await skipLists.compute(id, {}); + final skipList = skipLists.compute(id, {}); for (var range in skipList) { expect(range['scriptId'], id); } }); test('ignores the whole file if provided no locations', () async { - final skipList = await skipLists.compute('123', {}); + final skipList = skipLists.compute('123', {}); expect(skipList.length, 1); _validateRange(skipList.first, 0, 0, maxValue, maxValue); }); diff --git a/dwds/web/reloader/manager.dart b/dwds/web/reloader/manager.dart index a9d568aad..adb8e37bb 100644 --- a/dwds/web/reloader/manager.dart +++ b/dwds/web/reloader/manager.dart @@ -2,7 +2,6 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -import 'dart:async'; import 'dart:convert'; import 'dart:html';