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