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
fecba558
Unverified
Commit
fecba558
authored
May 06, 2019
by
Michael Klimushyn
Committed by
GitHub
May 06, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove deprecated decodedCacheRatioCap (#32041)
parent
57d66664
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
2 additions
and
55 deletions
+2
-55
binding.dart
packages/flutter/lib/src/painting/binding.dart
+1
-44
binding_test.dart
packages/flutter/test/painting/binding_test.dart
+0
-10
painting_utils.dart
packages/flutter/test/painting/painting_utils.dart
+1
-1
No files found.
packages/flutter/lib/src/painting/binding.dart
View file @
fecba558
...
...
@@ -10,8 +10,6 @@ import 'package:flutter/services.dart' show ServicesBinding;
import
'image_cache.dart'
;
import
'shader_warm_up.dart'
;
const
double
_kDefaultDecodedCacheRatioCap
=
0.0
;
/// Binding for the painting library.
///
/// Hooks into the cache eviction logic to clear the image cache.
...
...
@@ -71,50 +69,9 @@ mixin PaintingBinding on BindingBase, ServicesBinding {
@protected
ImageCache
createImageCache
()
=>
ImageCache
();
/// The maximum multiple of the compressed image size used when caching an
/// animated image.
///
/// Individual frames of animated images can be cached into memory to avoid
/// using CPU to re-decode them for every loop in the animation. This behavior
/// will result in out-of-memory crashes when decoding large (or large numbers
/// of) animated images so is disabled by default. Set this value to control
/// how much memory each animated image is allowed to use for caching decoded
/// frames compared to its compressed size. For example, setting this to `2.0`
/// means that a 400KB GIF would be allowed at most to use 800KB of memory
/// caching unessential decoded frames. A setting of `1.0` or less disables
/// all caching of unessential decoded frames. See
/// [_kDefaultDecodedCacheRatioCap] for the default value.
///
/// @deprecated The in-memory cache of decoded frames causes issues with
/// memory consumption. Soon this API and the in-memory cache will be removed.
/// See
/// [flutter/flutter#26081](https://github.com/flutter/flutter/issues/26081)
/// for more context.
@deprecated
double
get
decodedCacheRatioCap
=>
_kDecodedCacheRatioCap
;
double
_kDecodedCacheRatioCap
=
_kDefaultDecodedCacheRatioCap
;
/// Changes the maximum multiple of compressed image size used when caching an
/// animated image.
///
/// Changing this value only affects new images, not images that have already
/// been decoded.
///
/// @deprecated The in-memory cache of decoded frames causes issues with
/// memory consumption. Soon this API and the in-memory cache will be removed.
/// See
/// [flutter/flutter#26081](https://github.com/flutter/flutter/issues/26081)
/// for more context.
@deprecated
set
decodedCacheRatioCap
(
double
value
)
{
assert
(
value
!=
null
);
assert
(
value
>=
0.0
);
_kDecodedCacheRatioCap
=
value
;
}
// ignore: deprecated_member_use_from_same_package
/// Calls through to [dart:ui] with [decodedCacheRatioCap] from [ImageCache].
Future
<
ui
.
Codec
>
instantiateImageCodec
(
Uint8List
list
)
{
return
ui
.
instantiateImageCodec
(
list
,
decodedCacheRatioCap:
decodedCacheRatioCap
);
// ignore: deprecated_member_use_from_same_package
return
ui
.
instantiateImageCodec
(
list
);
}
@override
...
...
packages/flutter/test/painting/binding_test.dart
View file @
fecba558
...
...
@@ -14,16 +14,6 @@ import 'painting_utils.dart';
void
main
(
)
{
final
PaintingBindingSpy
binding
=
PaintingBindingSpy
();
test
(
'decodedCacheRatio'
,
()
async
{
// final PaintingBinding binding = PaintingBinding.instance;
// Has default value.
expect
(
binding
.
decodedCacheRatioCap
,
isNot
(
null
));
// ignore: deprecated_member_use_from_same_package
// Can be set.
binding
.
decodedCacheRatioCap
=
1.0
;
// ignore: deprecated_member_use_from_same_package
expect
(
binding
.
decodedCacheRatioCap
,
1.0
);
// ignore: deprecated_member_use_from_same_package
});
test
(
'instantiateImageCodec used for loading images'
,
()
async
{
expect
(
binding
.
instantiateImageCodecCalledCount
,
0
);
...
...
packages/flutter/test/painting/painting_utils.dart
View file @
fecba558
...
...
@@ -16,7 +16,7 @@ class PaintingBindingSpy extends BindingBase with ServicesBinding, PaintingBindi
@override
Future
<
ui
.
Codec
>
instantiateImageCodec
(
Uint8List
list
)
{
counter
++;
return
ui
.
instantiateImageCodec
(
list
,
decodedCacheRatioCap:
decodedCacheRatioCap
);
// ignore: deprecated_member_use_from_same_package
return
ui
.
instantiateImageCodec
(
list
);
}
@override
...
...
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