MCPcopy Create free account
hub / github.com/Snapchat/Valdi / doCleanup

Method doCleanup

valdi/src/java/com/snap/valdi/utils/BitmapPool.kt:188–208  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

186 }
187
188 private fun doCleanup() {
189 val currentTime = System.nanoTime()
190
191 synchronized(cachedBitmaps) {
192 val it = cachedBitmaps.iterator()
193 while (it.hasNext()) {
194 val cachedBitmap = it.next()
195
196 if (currentTime >= cachedBitmap.expirationTime) {
197// logger.info("Discarding expired Bitmap of size ${cachedBitmap.getBitmap().width}x${cachedBitmap.getBitmap().height}")
198 it.remove()
199 cachedBitmap.destroy()
200 }
201 }
202
203 if (cachedBitmaps.isEmpty()) {
204 cleanUpTimer?.cancel()
205 cleanUpTimer = null
206 }
207 }
208 }
209
210 companion object {
211 // How long we keep the bitmaps alive after they were released

Callers

nothing calls this directly

Calls 7

nextMethod · 0.65
removeMethod · 0.65
destroyMethod · 0.65
cancelMethod · 0.65
iteratorMethod · 0.45
hasNextMethod · 0.45
isEmptyMethod · 0.45

Tested by

no test coverage detected