Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
1fe677a3
Unverified
Commit
1fe677a3
authored
Jun 17, 2020
by
Alexandre Ardhuin
Committed by
GitHub
Jun 17, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update _isolates_io.dart for better nnbd migration (#59666)
parent
90fb2e80
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
5 deletions
+10
-5
_isolates_io.dart
packages/flutter/lib/src/foundation/_isolates_io.dart
+10
-5
No files found.
packages/flutter/lib/src/foundation/_isolates_io.dart
View file @
1fe677a3
...
...
@@ -18,6 +18,7 @@ Future<R> compute<Q, R>(isolates.ComputeCallback<Q, R> callback, Q message, { St
final
Flow
flow
=
Flow
.
begin
();
Timeline
.
startSync
(
'
$debugLabel
: start'
,
flow:
flow
);
final
ReceivePort
resultPort
=
ReceivePort
();
final
ReceivePort
exitPort
=
ReceivePort
();
final
ReceivePort
errorPort
=
ReceivePort
();
Timeline
.
finishSync
();
final
Isolate
isolate
=
await
Isolate
.
spawn
<
_IsolateConfiguration
<
Q
,
FutureOr
<
R
>>>(
...
...
@@ -30,7 +31,7 @@ Future<R> compute<Q, R>(isolates.ComputeCallback<Q, R> callback, Q message, { St
flow
.
id
,
),
errorsAreFatal:
true
,
onExit:
resul
tPort
.
sendPort
,
onExit:
exi
tPort
.
sendPort
,
onError:
errorPort
.
sendPort
,
);
final
Completer
<
R
>
result
=
Completer
<
R
>();
...
...
@@ -45,8 +46,13 @@ Future<R> compute<Q, R>(isolates.ComputeCallback<Q, R> callback, Q message, { St
result
.
completeError
(
exception
,
stack
);
}
});
exitPort
.
listen
((
dynamic
exitData
)
{
if
(!
result
.
isCompleted
)
{
result
.
completeError
(
Exception
(
'Isolate exited without result or error.'
));
}
});
resultPort
.
listen
((
dynamic
resultData
)
{
assert
(
resultData
==
null
||
resultData
is
R
);
assert
(
resultData
is
R
);
if
(!
result
.
isCompleted
)
result
.
complete
(
resultData
as
R
);
});
...
...
@@ -78,12 +84,11 @@ class _IsolateConfiguration<Q, R> {
}
Future
<
void
>
_spawn
<
Q
,
R
>(
_IsolateConfiguration
<
Q
,
FutureOr
<
R
>>
configuration
)
async
{
R
result
;
await
Timeline
.
timeSync
(
final
R
result
=
await
Timeline
.
timeSync
(
configuration
.
debugLabel
,
()
async
{
final
FutureOr
<
R
>
applicationResult
=
await
configuration
.
apply
();
re
sult
=
await
applicationResult
;
re
turn
await
applicationResult
;
},
flow:
Flow
.
step
(
configuration
.
flowId
),
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment