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
0a2bfc31
Commit
0a2bfc31
authored
Oct 29, 2015
by
Jason Simmons
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1861 from jason-simmons/canvas_image_memory_leak_2
simplify the ImageDecoder native code binding
parents
fab160cf
f1b048f2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
17 deletions
+10
-17
image_decoder.dart
packages/flutter/lib/src/services/image_decoder.dart
+10
-17
No files found.
packages/flutter/lib/src/services/image_decoder.dart
View file @
0a2bfc31
...
...
@@ -3,30 +3,23 @@
// found in the LICENSE file.
import
'dart:async'
;
import
'dart:ui'
show
Image
,
ImageDecoder
,
ImageDecoderCallback
;
import
'dart:typed_data'
;
import
'dart:ui'
as
ui
;
import
'package:mojo/core.dart'
show
MojoDataPipeConsumer
;
final
Set
<
ImageDecoder
>
_activeDecoders
=
new
Set
<
ImageDecoder
>();
typedef
ImageDecoder
_DecoderFactory
(
ImageDecoderCallback
callback
);
Future
<
Image
>
_decode
(
_DecoderFactory
createDecoder
)
{
Completer
<
Image
>
completer
=
new
Completer
<
Image
>();
ImageDecoder
decoder
;
decoder
=
createDecoder
((
Image
image
)
{
_activeDecoders
.
remove
(
decoder
);
Future
<
ui
.
Image
>
decodeImageFromDataPipe
(
MojoDataPipeConsumer
consumerHandle
)
{
Completer
<
ui
.
Image
>
completer
=
new
Completer
<
ui
.
Image
>();
ui
.
decodeImageFromDataPipe
(
consumerHandle
.
handle
.
h
,
(
ui
.
Image
image
)
{
completer
.
complete
(
image
);
});
_activeDecoders
.
add
(
decoder
);
return
completer
.
future
;
}
Future
<
Image
>
decodeImageFromDataPipe
(
MojoDataPipeConsumer
consumerHandle
)
{
return
_decode
((
ImageDecoderCallback
callback
)
=>
new
ImageDecoder
.
consume
(
consumerHandle
.
handle
.
h
,
callback
)
);
}
Future
<
Image
>
decodeImageFromList
(
Uint8List
list
)
{
return
_decode
((
ImageDecoderCallback
callback
)
=>
new
ImageDecoder
.
fromList
(
list
,
callback
))
;
Future
<
ui
.
Image
>
decodeImageFromList
(
Uint8List
list
)
{
Completer
<
ui
.
Image
>
completer
=
new
Completer
<
ui
.
Image
>(
);
ui
.
decodeImageFromList
(
list
,
(
ui
.
Image
image
)
{
completer
.
complete
(
image
);
});
return
completer
.
future
;
}
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