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
52a7479d
Commit
52a7479d
authored
Jan 07, 2016
by
Adam Barth
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Limit the size of the image cache
Fixed #1009
parent
dfcc0c71
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
2 deletions
+9
-2
image_cache.dart
packages/flutter/lib/src/services/image_cache.dart
+8
-2
pubspec.yaml
packages/flutter/pubspec.yaml
+1
-0
No files found.
packages/flutter/lib/src/services/image_cache.dart
View file @
52a7479d
...
...
@@ -6,6 +6,7 @@ import 'dart:async';
import
'dart:ui'
as
ui
;
import
'package:mojo/mojo/url_response.mojom.dart'
;
import
'package:quiver/collection.dart'
;
import
'fetch.dart'
;
import
'image_decoder.dart'
;
...
...
@@ -35,11 +36,16 @@ class _UrlFetcher implements ImageProvider {
int
get
hashCode
=>
_url
.
hashCode
;
}
const
int
_kDefaultSize
=
1000
;
class
_ImageCache
{
_ImageCache
.
_
();
final
Map
<
ImageProvider
,
ImageResource
>
_cache
=
new
Map
<
ImageProvider
,
ImageResource
>();
final
LruMap
<
ImageProvider
,
ImageResource
>
_cache
=
new
LruMap
<
ImageProvider
,
ImageResource
>(
maximumSize:
_kDefaultSize
);
int
get
maximumSize
=>
_cache
.
maximumSize
;
void
set
maximumSize
(
int
value
)
{
_cache
.
maximumSize
=
value
;
}
ImageResource
loadProvider
(
ImageProvider
provider
)
{
return
_cache
.
putIfAbsent
(
provider
,
()
{
...
...
packages/flutter/pubspec.yaml
View file @
52a7479d
...
...
@@ -11,6 +11,7 @@ dependencies:
sky_engine
:
0.0.75
sky_services
:
0.0.75
vector_math
:
'
>=1.4.3
<2.0.0'
quiver
:
'
>=0.21.4
<0.22.0'
# See the comment in flutter_tools' pubspec.yaml. We have to pin it
# here also because sky_services depends on mojo_sdk which depends
...
...
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