Skip to content

Batch debug events sent from injected client to dwds #1487

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 12 commits into from
Jan 21, 2022
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
2 changes: 2 additions & 0 deletions dwds/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
- Remove dead code for reading `'dart.developer.registerExtension'` and
`'dart.developer.postEvent'` events from the chrome console. These messages
haven't been written to the console since dwds v11.1.0 and Dart SDK v2.14.0.
- Batch debug events sent from injected client to dwds to relieve network load.
- Update `_fe_analyzer_shared` version to `33.0.0`

**Breaking changes:**

Expand Down
15 changes: 15 additions & 0 deletions dwds/lib/data/debug_event.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

// @dart = 2.9

import 'package:built_collection/built_collection.dart';
import 'package:built_value/built_value.dart';
import 'package:built_value/serializer.dart';

Expand All @@ -22,3 +23,17 @@ abstract class DebugEvent implements Built<DebugEvent, DebugEventBuilder> {

int get timestamp;
}

/// A batched group of events, currently always Debugger.scriptParsed
abstract class BatchedDebugEvents
implements Built<BatchedDebugEvents, BatchedDebugEventsBuilder> {
static Serializer<BatchedDebugEvents> get serializer =>
_$batchedDebugEventsSerializer;

factory BatchedDebugEvents([Function(BatchedDebugEventsBuilder) updates]) =
_$BatchedDebugEvents;

BatchedDebugEvents._();

BuiltList<DebugEvent> get events;
}
140 changes: 140 additions & 0 deletions dwds/lib/data/debug_event.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions dwds/lib/data/serializers.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ part 'serializers.g.dart';
/// Serializers for all the types used in DWDS communication.
@SerializersFor([
BatchedEvents,
BatchedDebugEvents,
BuildResult,
ConnectRequest,
DebugEvent,
Expand Down
4 changes: 4 additions & 0 deletions dwds/lib/data/serializers.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions dwds/lib/src/handlers/dev_handler.dart
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,10 @@ class DevHandler {
await _handleIsolateExit(appConnection);
} else if (message is IsolateStart) {
await _handleIsolateStart(appConnection, injectedConnection);
} else if (message is BatchedDebugEvents) {
await _servicesByAppId[appConnection.request.appId]
?.chromeProxyService
?.parseBatchedDebugEvents(message);
} else if (message is DebugEvent) {
await _servicesByAppId[appConnection.request.appId]
?.chromeProxyService
Expand Down
Loading