Skip to content
Open
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: 1 addition & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ jobs:
wget -qO- https://dcm.dev/pgp-key.public | sudo gpg --dearmor -o /usr/share/keyrings/dcm.gpg
echo 'deb [signed-by=/usr/share/keyrings/dcm.gpg arch=amd64] https://dcm.dev/debian stable main' | sudo tee /etc/apt/sources.list.d/dart_stable.list
sudo apt-get update
sudo apt-get install dcm=1.38.3-1 # To avoid errors add `-1` (build number) to the version
sudo apt-get install dcm=1.40.0-1 # To avoid errors add `-1` (build number) to the version
sudo chmod +x /usr/bin/dcm
echo "$(dcm --version)"
- name: Setup Dart SDK
Expand Down
2 changes: 1 addition & 1 deletion flutter-candidate.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
fab991537bf1ffb063579a0dd8a47cd4f2874618
ad22e79b227ce0d138228890ac7d28655a7dccf7
4 changes: 2 additions & 2 deletions packages/devtools_app/benchmark/web_bundle_size_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import 'package:path/path.dart' as path;
import 'package:test/test.dart';

// Benchmark size in kB.
const bundleSizeBenchmark = 6000;
const gzipBundleSizeBenchmark = 1750;
const bundleSizeBenchmark = 6200;
const gzipBundleSizeBenchmark = 1900;

void main() {
group('Web Compile', () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@ void main() {
'setFlag',
'requirePermissionToResume',
'getFlagList',
'getVM',
'getDartDevelopmentServiceVersion',
'getDartDevelopmentServiceVersion',
'getVM',
]),
reason:
'Unexpected order of vm service calls upon connection. '
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ class FlexLayoutExplorerWidgetState
alignmentEnumEntries = MainAxisAlignment.values;
selected = propertiesLocal.mainAxisAlignment;
} else {
alignmentEnumEntries = CrossAxisAlignment.values.toList(growable: true);
alignmentEnumEntries = CrossAxisAlignment.values.toList();
if (propertiesLocal.textBaseline == null) {
// TODO(albertusangga): Look for ways to visualize baseline when it is null
alignmentEnumEntries.remove(CrossAxisAlignment.baseline);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,7 @@ class FlutterFramesChartItem extends StatelessWidget {
child: Column(
children: [
// Dummy child so that the InkWell does not take up the entire column.
const Expanded(child: SizedBox()),
const Spacer(),
Row(
crossAxisAlignment: CrossAxisAlignment.end,
children: [ui, raster],
Expand Down
67 changes: 60 additions & 7 deletions packages/devtools_app/lib/src/service/vm_service_wrapper.dart
Original file line number Diff line number Diff line change
Expand Up @@ -230,50 +230,103 @@ class VmServiceWrapper extends VmService {

Stream<Event> get onExtensionEventWithHistorySafe {
return _maybeReturnStreamWithHistory(
onExtensionEventWithHistory,
EventStreams.kExtension,
ddsStream: onExtensionEventWithHistory,
fallbackStream: onExtensionEvent,
);
}

Stream<Event> get onLoggingEventWithHistorySafe {
return _maybeReturnStreamWithHistory(
onLoggingEventWithHistory,
EventStreams.kLogging,
ddsStream: onLoggingEventWithHistory,
fallbackStream: onLoggingEvent,
);
}

Stream<Event> get onStderrEventWithHistorySafe {
return _maybeReturnStreamWithHistory(
onStderrEventWithHistory,
EventStreams.kStderr,
ddsStream: onStderrEventWithHistory,
fallbackStream: onStderrEvent,
);
}

Stream<Event> get onStdoutEventWithHistorySafe {
return _maybeReturnStreamWithHistory(
onStdoutEventWithHistory,
EventStreams.kStdout,
ddsStream: onStdoutEventWithHistory,
fallbackStream: onStdoutEvent,
);
}

Stream<Event> get onTimerEventWithHistorySafe {
return _maybeReturnStreamWithHistory(
onTimerEventWithHistory,
EventStreams.kTimer,
ddsStream: onTimerEventWithHistory,
fallbackStream: onTimerEvent,
);
}

Stream<Event> _maybeReturnStreamWithHistory(
Stream<Event> ddsStream, {
String streamId, {
required Stream<Event> ddsStream,
required Stream<Event> fallbackStream,
}) {
assert(_supportedProtocolsInitialized.isCompleted);
if (_ddsSupported) {
return ddsStream;
return _streamWithHistoryIfCollected(
streamId,
ddsStream: ddsStream,
fallbackStream: fallbackStream,
);
}
return fallbackStream;
}

/// Returns [ddsStream] if DDS collects event history for [streamId], and
/// [fallbackStream] otherwise.
///
/// DDS only collects event history for a stream when the VM service it is
/// connected to supports that stream. For example, the web debug service
/// does not support the `Timer` stream, so DDS rejects `getStreamHistory`
/// requests for it with an invalid params error. The DDS history streams
/// (e.g. [DdsExtension.onTimerEventWithHistory]) call `getStreamHistory`
/// when first listened to, and that error cannot be handled by listeners, so
/// we check whether history is collected before using [ddsStream].
Stream<Event> _streamWithHistoryIfCollected(
String streamId, {
required Stream<Event> ddsStream,
required Stream<Event> fallbackStream,
}) async* {
final historyCollected = await _isStreamHistoryCollected.putIfAbsent(
streamId,
() => _checkStreamHistoryCollected(streamId),
);
yield* historyCollected ? ddsStream : fallbackStream;
}

/// Cache of whether DDS collects event history for a given stream id.
final _isStreamHistoryCollected = <String, Future<bool>>{};

Future<bool> _checkStreamHistoryCollected(String streamId) async {
try {
await getStreamHistory(streamId);
return true;
} on RPCError catch (e) {
if (e.code != RPCErrorKind.kInvalidParams.code) {
// Do not cache unexpected failures so that we check again next time.
unawaited(_isStreamHistoryCollected.remove(streamId));
rethrow;
}
_log.fine(
'Event history is not collected for stream "$streamId". Falling back '
'to the stream without history.',
);
return false;
}
}

// Begin Dart IO extension method wrappers. We wrap these methods so that we
// can override them in tests.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1270,7 +1270,7 @@ class InspectorObjectGroupManager {
void _setNextNull() {
_next = null;
if (_pendingNext != null) {
_pendingNext!.complete(null);
_pendingNext!.complete();
_pendingNext = null;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ List<DartObjectNode> createVariablesForBytes(
variables.add(
DartObjectNode.fromValue(
name: '[$name]',
value: result[i],
value: _formatSimdValue(result[i]) ?? result[i],
isolateRef: isolateRef,
artificialName: true,
),
Expand All @@ -464,6 +464,38 @@ List<DartObjectNode> createVariablesForBytes(
return variables;
}

/// The number of decimal places used to display the lanes of a [Float32x4] or
/// [Float64x2] value.
const _simdFloatFractionDigits = 6;

/// The number of hex digits used to display a 32-bit lane of an [Int32x4]
/// value.
const _simdInt32HexDigits = 8;

/// Returns a display string for [value] if it is a SIMD value ([Int32x4],
/// [Float32x4], or [Float64x2]), or null otherwise.
///
/// We format these values manually instead of relying on `toString()` because
/// the output of `toString()` for SIMD types is platform dependent (the Dart
/// VM returns the opaque string 'V128', and the web returns a different format
/// than the VM historically did). Formatting the lanes ourselves ensures that
/// users see the actual values on every platform.
String? _formatSimdValue(Object? value) {
String formatFloat(double lane) =>
lane.toStringAsFixed(_simdFloatFractionDigits);
String formatInt32(int lane) =>
lane.toUnsigned(32).toRadixString(16).padLeft(_simdInt32HexDigits, '0');

return switch (value) {
Int32x4(:final x, :final y, :final z, :final w) =>
'[${[x, y, z, w].map(formatInt32).join(', ')}]',
Float32x4(:final x, :final y, :final z, :final w) =>
'[${[x, y, z, w].map(formatFloat).join(', ')}]',
Float64x2(:final x, :final y) => '[${[x, y].map(formatFloat).join(', ')}]',
_ => null,
};
}

List<DartObjectNode> createVariablesForSets(
Instance instance,
IsolateRef? isolateRef,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ class RateLimiter {
_pendingRequest = Completer();
await callback();
} finally {
_pendingRequest!.complete(null);
_pendingRequest!.complete();
}
}

Expand Down
2 changes: 1 addition & 1 deletion packages/devtools_app/lib/src/shared/ui/hover.dart
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,7 @@ class _HoverCardTooltipState extends State<HoverCardTooltip> {
unawaited(
hoverCardDataFuture.then(
(data) => completer.complete(data),
onError: (_) => completer.complete(null),
onError: (_) => completer.complete(),
),
);
return completer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -372,13 +372,6 @@ void main() {
expect(
variable.children.first.displayValue,
'[ffffffff, 00000000, ffffffff, 00000000]',
skip: kIsWeb,
);
// Formatting is different on the web.
expect(
variable.children.first.displayValue,
'[-1, 0, -1, 0]',
skip: !kIsWeb,
);
});

Expand Down Expand Up @@ -408,12 +401,6 @@ void main() {
expect(
variable.children.first.displayValue,
'[0.000000, -232.199997, 2.330000, 9.000000]',
skip: kIsWeb,
);
expect(
variable.children.first.displayValue,
'[0, -232.1999969482422, 2.3299999237060547, 9]',
skip: !kIsWeb,
);
});

Expand All @@ -438,16 +425,7 @@ void main() {

await buildVariablesTree(variable);

expect(
variable.children.first.displayValue,
'[0.000000, -1232.222000]',
skip: kIsWeb,
);
expect(
variable.children.first.displayValue,
'[0, -1232.222]',
skip: !kIsWeb,
);
expect(variable.children.first.displayValue, '[0.000000, -1232.222000]');
});

test(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ void main() {
advanceClock(async);
expect(tracker.active.value, isTrue);

completer1.complete(null);
completer1.complete();
unawaited(completer1.future);
advanceClock(async);
expect(tracker.active.value, isTrue);

completer2.complete(null);
completer2.complete();
unawaited(completer2.future);
advanceClock(async);
expect(tracker.active.value, isFalse);
Expand All @@ -66,7 +66,7 @@ void main() {
advanceClock(async);
expect(tracker.active.value, isTrue);

completer2.complete(null);
completer2.complete();
unawaited(completer2.future);
advanceClock(async);
expect(tracker.active.value, isFalse);
Expand Down
1 change: 1 addition & 0 deletions packages/devtools_app_shared/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file or at https://developers.google.com/open-source/licenses/bsd.
-->
## 0.5.2-wip
* Removed redundant argument values.
* Fix a `RangeError` thrown by `SplitPane` when the number of children
changes between rebuilds.
* Fix garbage collection and timeout issues with the result list in `asyncEval` on both native VM and web.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -605,19 +605,19 @@ class EvalOnDartLibrary extends DisposableController
// This is an optimization to avoid sending stale requests across the wire.
void wrappedRequest() async {
if (isAlive != null && isAlive.disposed || disposed) {
response.complete(null);
response.complete();
return;
}
try {
final value = await request();
if (!disposed && value is! Sentinel) {
response.complete(value);
} else {
response.complete(null);
response.complete();
}
} catch (e) {
if (disposed || isAlive?.disposed == true) {
response.complete(null);
response.complete();
} else {
response.completeError(e);
}
Expand All @@ -629,7 +629,7 @@ class EvalOnDartLibrary extends DisposableController
wrappedRequest();
} else {
if (isAlive != null && isAlive.disposed || disposed) {
response.complete(null);
response.complete();
return response.future;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class IsolateState {
_isolateNow = null;
_isolateLoadCompleter.safeComplete(
null,
() => _isolateLoadCompleter = Completer()..complete(null),
() => _isolateLoadCompleter = Completer()..complete(),
);
_isPaused.dispose();
}
Expand Down
Loading
Loading