@@ -67,7 +67,7 @@ public void clear() {
67
67
this . _cache . Clear ( ) ;
68
68
this . _pendingImages . Clear ( ) ;
69
69
this . _currentSizeBytes = 0 ;
70
-
70
+
71
71
this . _lruKeys . Clear ( ) ;
72
72
}
73
73
@@ -86,10 +86,12 @@ public bool evict(object key) {
86
86
this . _lruKeys . Remove ( image . node ) ;
87
87
return true ;
88
88
}
89
+
89
90
return false ;
90
91
}
91
92
92
- public ImageStreamCompleter putIfAbsent ( object key , Func < ImageStreamCompleter > loader , ImageErrorListener onError = null ) {
93
+ public ImageStreamCompleter putIfAbsent ( object key , Func < ImageStreamCompleter > loader ,
94
+ ImageErrorListener onError = null ) {
93
95
D . assert ( key != null ) ;
94
96
D . assert ( loader != null ) ;
95
97
@@ -121,18 +123,18 @@ public ImageStreamCompleter putIfAbsent(object key, Func<ImageStreamCompleter> l
121
123
void listener ( ImageInfo info , bool syncCall ) {
122
124
int imageSize = info ? . image == null ? 0 : info . image . height * info . image . width * 4 ;
123
125
_CachedImage cachedImage = new _CachedImage ( result , imageSize ) ;
124
-
126
+
125
127
if ( this . maximumSizeBytes > 0 && imageSize > this . maximumSizeBytes ) {
126
128
this . _maximumSizeBytes = imageSize + 1000 ;
127
129
}
128
-
130
+
129
131
this . _currentSizeBytes += imageSize ;
130
132
131
133
if ( this . _pendingImages . TryGetValue ( key , out var loadedPendingImage ) ) {
132
134
loadedPendingImage . removeListener ( ) ;
133
135
this . _pendingImages . Remove ( key ) ;
134
136
}
135
-
137
+
136
138
D . assert ( ! this . _cache . ContainsKey ( key ) ) ;
137
139
this . _cache [ key ] = cachedImage ;
138
140
cachedImage . node = this . _lruKeys . AddLast ( key ) ;
@@ -172,7 +174,7 @@ public _CachedImage(ImageStreamCompleter completer, int sizeBytes) {
172
174
this . completer = completer ;
173
175
this . sizeBytes = sizeBytes ;
174
176
}
175
-
177
+
176
178
public ImageStreamCompleter completer ;
177
179
public int sizeBytes ;
178
180
public LinkedListNode < object > node ;
0 commit comments