Provide a non-null default value for the compute debug label in release mode (#49638)

This commit is contained in:
Jason Simmons 2020-01-28 16:43:01 -08:00 committed by GitHub
parent e7984bd4f6
commit 722b4277ca
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -12,9 +12,7 @@ import 'isolates.dart' as isolates;
/// The dart:io implementation of [isolate.compute].
Future<R> compute<Q, R>(isolates.ComputeCallback<Q, R> callback, Q message, { String debugLabel }) async {
if (!kReleaseMode) {
debugLabel ??= callback.toString();
}
debugLabel ??= kReleaseMode ? 'compute' : callback.toString();
final Flow flow = Flow.begin();
Timeline.startSync('$debugLabel: start', flow: flow);
final ReceivePort resultPort = ReceivePort();
@ -80,7 +78,7 @@ class _IsolateConfiguration<Q, R> {
Future<void> _spawn<Q, R>(_IsolateConfiguration<Q, FutureOr<R>> configuration) async {
R result;
await Timeline.timeSync(
'${configuration.debugLabel}',
configuration.debugLabel,
() async {
final FutureOr<R> applicationResult = await configuration.apply();
result = await applicationResult;