Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ class DiskStorageCache(
}

@Throws(IOException::class)
override fun insert(key: CacheKey, callback: WriterCallback): BinaryResource {
override fun insert(key: CacheKey, writer: WriterCallback): BinaryResource {
// Write to a temp file, then move it into place. This allows more parallelism
// when writing files.
val cacheEvent = SettableCacheEvent.obtain().setCacheKey(key)
Expand All @@ -312,7 +312,7 @@ class DiskStorageCache(
// getting the file is synchronized
val inserter = startInsert(resourceId, key)
try {
inserter.writeData(callback, key)
inserter.writeData(writer, key)
// Committing the file is synchronized
val resource = endInsert(inserter, key, resourceId)
cacheEvent.setItemSize(resource.size()).setCacheSize(cacheStats.size)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ open class BitmapPoolBackend : LruBucketsPoolBackend<Bitmap>() {
return null
}

@Suppress("PARAMETER_NAME_CHANGED_ON_OVERRIDE")
override fun getSize(bitmap: Bitmap): Int = BitmapUtil.getSizeInBytes(bitmap)

protected fun isReusable(bitmap: Bitmap?): Boolean {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ class BucketsBitmapPool(
* Allocate a bitmap that has a backing memory allocation of 'size' bytes. This is configuration
* agnostic so the size is the actual size in bytes of the bitmap.
*
* @param size the 'size' in bytes of the bitmap
* @param bucketedSize the 'size' in bytes of the bitmap
* @return a new bitmap with the specified size in memory
*/
public override fun alloc(size: Int): Bitmap {
public override fun alloc(bucketedSize: Int): Bitmap {
return Bitmap.createBitmap(
1,
ceil(size / BitmapUtil.RGB_565_BYTES_PER_PIXEL.toDouble()).toInt(),
ceil(bucketedSize / BitmapUtil.RGB_565_BYTES_PER_PIXEL.toDouble()).toInt(),
Bitmap.Config.RGB_565,
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ class DiskCacheWriteProducer(
private val cacheKeyFactory: CacheKeyFactory,
private val inputProducer: Producer<EncodedImage>,
) : Producer<EncodedImage> {
override fun produceResults(consumer: Consumer<EncodedImage>, producerContext: ProducerContext) {
maybeStartInputProducer(consumer, producerContext)
override fun produceResults(consumer: Consumer<EncodedImage>, context: ProducerContext) {
maybeStartInputProducer(consumer, context)
}

private fun maybeStartInputProducer(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ class ThreadHandoffProducer<T>(

val statefulRunnable: StatefulProducerRunnable<T> =
object : StatefulProducerRunnable<T>(consumer, producerListener, context, PRODUCER_NAME) {
override fun onSuccess(ignored: T?) {
override fun onSuccess(result: T?) {
producerListener.onProducerFinishWithSuccess(context, PRODUCER_NAME, null)
inputProducer.produceResults(consumer, context)
}

override fun disposeResult(ignored: T?) = Unit
override fun disposeResult(result: T?) = Unit

@Throws(Exception::class)
override fun getResult(): T? {
Expand Down