Unverified Commit 7358d590 authored by Jason Simmons's avatar Jason Simmons Committed by GitHub

Dart2 typesafe invocation of IsolateConfiguration callback (#15267)

parent 9d46ed2b
...@@ -84,6 +84,8 @@ class _IsolateConfiguration<Q, R> { ...@@ -84,6 +84,8 @@ class _IsolateConfiguration<Q, R> {
final SendPort resultPort; final SendPort resultPort;
final String debugLabel; final String debugLabel;
final int flowId; final int flowId;
R apply() => callback(message);
} }
void _spawn<Q, R>(_IsolateConfiguration<Q, R> configuration) { void _spawn<Q, R>(_IsolateConfiguration<Q, R> configuration) {
...@@ -91,7 +93,7 @@ void _spawn<Q, R>(_IsolateConfiguration<Q, R> configuration) { ...@@ -91,7 +93,7 @@ void _spawn<Q, R>(_IsolateConfiguration<Q, R> configuration) {
Timeline.timeSync( Timeline.timeSync(
'${configuration.debugLabel}', '${configuration.debugLabel}',
() { () {
result = configuration.callback(configuration.message); result = configuration.apply();
}, },
flow: Flow.step(configuration.flowId), flow: Flow.step(configuration.flowId),
); );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment