Improve execution context logging (#1206)
diff --git a/dwds/CHANGELOG.md b/dwds/CHANGELOG.md
index 3270d20..5d61945 100644
--- a/dwds/CHANGELOG.md
+++ b/dwds/CHANGELOG.md
@@ -1,3 +1,7 @@
+## 7.1.2 - UNRELEASED
+
+- Improve logging around execution contexts.
+
## 7.1.1
- Properly handle `requireJS` errors during hot restarts.
diff --git a/dwds/lib/src/debugging/execution_context.dart b/dwds/lib/src/debugging/execution_context.dart
index 57bb115..8bc1b26 100644
--- a/dwds/lib/src/debugging/execution_context.dart
+++ b/dwds/lib/src/debugging/execution_context.dart
@@ -5,6 +5,7 @@
import 'dart:async';
import 'package:async/async.dart';
+import 'package:logging/logging.dart';
import 'remote_debugger.dart';
@@ -16,6 +17,7 @@
/// The execution context in which to do remote evaluations.
class RemoteDebuggerExecutionContext extends ExecutionContext {
final RemoteDebugger _remoteDebugger;
+ final _logger = Logger('RemoteDebuggerExecutionContext');
// Contexts that may contain a Dart application.
StreamQueue<int> _contexts;
@@ -25,9 +27,11 @@
@override
Future<int> get id async {
if (_id != null) return _id;
+ _logger.fine('Looking for Dart execution context...');
while (await _contexts.hasNext
.timeout(const Duration(milliseconds: 50), onTimeout: () => false)) {
var context = await _contexts.next;
+ _logger.fine('Checking context id: $context');
try {
var result =
await _remoteDebugger.sendCommand('Runtime.evaluate', params: {
@@ -35,12 +39,14 @@
'contextId': context,
});
if (result.result['result']['value'] != null) {
+ _logger.fine('Found valid execution context: $context');
_id = context;
break;
}
} catch (_) {
// Errors may be thrown if we attempt to evaluate in a stale a context.
// Ignore and continue.
+ _logger.fine('Invalid execution context: $context');
}
}
if (_id == null) {
diff --git a/dwds/lib/src/version.dart b/dwds/lib/src/version.dart
index 5d7be62..4919dd0 100644
--- a/dwds/lib/src/version.dart
+++ b/dwds/lib/src/version.dart
@@ -1,2 +1,2 @@
// Generated code. Do not modify.
-const packageVersion = '7.1.1';
+const packageVersion = '7.1.2';
diff --git a/dwds/pubspec.yaml b/dwds/pubspec.yaml
index aebbdc6..c1055d0 100644
--- a/dwds/pubspec.yaml
+++ b/dwds/pubspec.yaml
@@ -1,6 +1,6 @@
name: dwds
# Every time this changes you need to run `pub run build_runner build`.
-version: 7.1.1
+version: 7.1.2
homepage: https://github.com/dart-lang/webdev/tree/master/dwds
description: >-
A service that proxies between the Chrome debug protocol and the Dart VM
diff --git a/frontend_server_common/lib/src/asset_server.dart b/frontend_server_common/lib/src/asset_server.dart
index 262801f..2d61908 100644
--- a/frontend_server_common/lib/src/asset_server.dart
+++ b/frontend_server_common/lib/src/asset_server.dart
@@ -17,7 +17,6 @@
import 'package:package_config/packages.dart'; // ignore: deprecated_member_use
import 'package:path/path.dart' as p;
import 'package:shelf/shelf.dart' as shelf;
-import 'package:shelf/shelf_io.dart' as shelf;
import 'utilities.dart';