LruArrayPool.smali
.class public final Lcom/bumptech/glide/load/engine/bitmap_recycle/LruArrayPool;
.super Ljava/lang/Object;
.source "LruArrayPool.java"
# interfaces
.implements Lcom/bumptech/glide/load/engine/bitmap_recycle/ArrayPool;
# annotations
.annotation system Ldalvik/annotation/MemberClasses;
value = {
Lcom/bumptech/glide/load/engine/bitmap_recycle/LruArrayPool$Key;,
Lcom/bumptech/glide/load/engine/bitmap_recycle/LruArrayPool$KeyPool;
}
.end annotation
# static fields
.field private static final DEFAULT_SIZE:I
.field static final MAX_OVER_SIZE_MULTIPLE:I
.field private static final SINGLE_ARRAY_MAX_SIZE_DIVISOR:I
# instance fields
.field private final adapters:Ljava/util/Map;
.annotation system Ldalvik/annotation/Signature;
value = {
"Ljava/util/Map<",
"Ljava/lang/Class<",
"*>;",
"Lcom/bumptech/glide/load/engine/bitmap_recycle/ArrayAdapterInterface<",
"*>;>;"
}
.end annotation
.end field
.field private currentSize:I
.field private final groupedMap:Lcom/bumptech/glide/load/engine/bitmap_recycle/GroupedLinkedMap;
.annotation system Ldalvik/annotation/Signature;
value = {
"Lcom/bumptech/glide/load/engine/bitmap_recycle/GroupedLinkedMap<",
"Lcom/bumptech/glide/load/engine/bitmap_recycle/LruArrayPool$Key;",
"Ljava/lang/Object;",
">;"
}
.end annotation
.end field
.field private final keyPool:Lcom/bumptech/glide/load/engine/bitmap_recycle/LruArrayPool$KeyPool;
.field private final maxSize:I
.field private final sortedSizes:Ljava/util/Map;
.annotation system Ldalvik/annotation/Signature;
value = {
"Ljava/util/Map<",
"Ljava/lang/Class<",
"*>;",
"Ljava/util/NavigableMap<",
"Ljava/lang/Integer;",
"Ljava/lang/Integer;",
">;>;"
}
.end annotation
.end field
# direct methods
.method static constructor <clinit>()V
.registers 1
const v0, 0x40156f
invoke-static {v0}, Lnp/NPFog;->d(I)I
move-result v0
sput v0, Lcom/bumptech/glide/load/engine/bitmap_recycle/LruArrayPool;->DEFAULT_SIZE:I
const v0, 0x1567
invoke-static {v0}, Lnp/NPFog;->d(I)I
move-result v0
sput v0, Lcom/bumptech/glide/load/engine/bitmap_recycle/LruArrayPool;->MAX_OVER_SIZE_MULTIPLE:I
const v0, 0x156d
invoke-static {v0}, Lnp/NPFog;->d(I)I
move-result v0
sput v0, Lcom/bumptech/glide/load/engine/bitmap_recycle/LruArrayPool;->SINGLE_ARRAY_MAX_SIZE_DIVISOR:I
return-void
.end method
.method public constructor <init>()V
.registers 2
.line 37
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
.line 29
new-instance v0, Lcom/bumptech/glide/load/engine/bitmap_recycle/GroupedLinkedMap;
invoke-direct {v0}, Lcom/bumptech/glide/load/engine/bitmap_recycle/GroupedLinkedMap;-><init>()V
iput-object v0, p0, Lcom/bumptech/glide/load/engine/bitmap_recycle/LruArrayPool;->groupedMap:Lcom/bumptech/glide/load/engine/bitmap_recycle/GroupedLinkedMap;
.line 30
new-instance v0, Lcom/bumptech/glide/load/engine/bitmap_recycle/LruArrayPool$KeyPool;
invoke-direct {v0}, Lcom/bumptech/glide/load/engine/bitmap_recycle/LruArrayPool$KeyPool;-><init>()V
iput-object v0, p0, Lcom/bumptech/glide/load/engine/bitmap_recycle/LruArrayPool;->keyPool:Lcom/bumptech/glide/load/engine/bitmap_recycle/LruArrayPool$KeyPool;
.line 31
new-instance v0, Ljava/util/HashMap;
invoke-direct {v0}, Ljava/util/HashMap;-><init>()V
iput-object v0, p0, Lcom/bumptech/glide/load/engine/bitmap_recycle/LruArrayPool;->sortedSizes:Ljava/util/Map;
.line 32
new-instance v0, Ljava/util/HashMap;
invoke-direct {v0}, Ljava/util/HashMap;-><init>()V
iput-object v0, p0, Lcom/bumptech/glide/load/engine/bitmap_recycle/LruArrayPool;->adapters:Ljava/util/Map;
.line 38
const/high16 v0, 0x400000
iput v0, p0, Lcom/bumptech/glide/load/engine/bitmap_recycle/LruArrayPool;->maxSize:I
.line 39
return-void
.end method
.method public constructor <init>(I)V
.registers 3
.param p1, "maxSize" # I
.line 46
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
.line 29
new-instance v0, Lcom/bumptech/glide/load/engine/bitmap_recycle/GroupedLinkedMap;
invoke-direct {v0}, Lcom/bumptech/glide/load/engine/bitmap_recycle/GroupedLinkedMap;-><init>()V
iput-object v0, p0, Lcom/bumptech/glide/load/engine/bitmap_recycle/LruArrayPool;->groupedMap:Lcom/bumptech/glide/load/engine/bitmap_recycle/GroupedLinkedMap;
.line 30
new-instance v0, Lcom/bumptech/glide/load/engine/bitmap_recycle/LruArrayPool$KeyPool;
invoke-direct {v0}, Lcom/bumptech/glide/load/engine/bitmap_recycle/LruArrayPool$KeyPool;-><init>()V
iput-object v0, p0, Lcom/bumptech/glide/load/engine/bitmap_recycle/LruArrayPool;->keyPool:Lcom/bumptech/glide/load/engine/bitmap_recycle/LruArrayPool$KeyPool;
.line 31
new-instance v0, Ljava/util/HashMap;
invoke-direct {v0}, Ljava/util/HashMap;-><init>()V
iput-object v0, p0, Lcom/bumptech/glide/load/engine/bitmap_recycle/LruArrayPool;->sortedSizes:Ljava/util/Map;
.line 32
new-instance v0, Ljava/util/HashMap;
invoke-direct {v0}, Ljava/util/HashMap;-><init>()V
iput-object v0, p0, Lcom/bumptech/glide/load/engine/bitmap_recycle/LruArrayPool;->adapters:Ljava/util/Map;
.line 47
iput p1, p0, Lcom/bumptech/glide/load/engine/bitmap_recycle/LruArrayPool;->maxSize:I
.line 48
return-void
.end method
.method private decrementArrayOfSize(ILjava/lang/Class;)V
.registers 8
.param p1, "size" # I
.annotation system Ldalvik/annotation/Signature;
value = {
"(I",
"Ljava/lang/Class<",
"*>;)V"
}
.end annotation
.line 165
.local p2, "arrayClass":Ljava/lang/Class;, "Ljava/lang/Class<*>;"
invoke-direct {p0, p2}, Lcom/bumptech/glide/load/engine/bitmap_recycle/LruArrayPool;->getSizesForAdapter(Ljava/lang/Class;)Ljava/util/NavigableMap;
move-result-object v0
.line 166
.local v0, "sizes":Ljava/util/NavigableMap;, "Ljava/util/NavigableMap<Ljava/lang/Integer;Ljava/lang/Integer;>;"
invoke-static {p1}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;
move-result-object v1
invoke-interface {v0, v1}, Ljava/util/NavigableMap;->get(Ljava/lang/Object;)Ljava/lang/Object;
move-result-object v1
check-cast v1, Ljava/lang/Integer;
.line 167
.local v1, "current":Ljava/lang/Integer;
if-eqz v1, :cond_30
.line 171
invoke-virtual {v1}, Ljava/lang/Integer;->intValue()I
move-result v2
const/4 v3, 0x1
if-ne v2, v3, :cond_1f
.line 172
invoke-static {p1}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;
move-result-object v2
invoke-interface {v0, v2}, Ljava/util/NavigableMap;->remove(Ljava/lang/Object;)Ljava/lang/Object;
goto :goto_2f
.line 174
:cond_1f
invoke-static {p1}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;
move-result-object v2
invoke-virtual {v1}, Ljava/lang/Integer;->intValue()I
move-result v4
sub-int/2addr v4, v3
invoke-static {v4}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;
move-result-object v3
invoke-interface {v0, v2, v3}, Ljava/util/NavigableMap;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
.line 176
:goto_2f
return-void
.line 168
:cond_30
new-instance v2, Ljava/lang/NullPointerException;
new-instance v3, Ljava/lang/StringBuilder;
invoke-direct {v3}, Ljava/lang/StringBuilder;-><init>()V
const-string v4, "Tried to decrement empty size, size: "
invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
invoke-virtual {v3, p1}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
const-string v4, ", this: "
invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
invoke-virtual {v3, p0}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
invoke-virtual {v3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v3
invoke-direct {v2, v3}, Ljava/lang/NullPointerException;-><init>(Ljava/lang/String;)V
throw v2
.end method
.method private evict()V
.registers 2
.line 148
iget v0, p0, Lcom/bumptech/glide/load/engine/bitmap_recycle/LruArrayPool;->maxSize:I
invoke-direct {p0, v0}, Lcom/bumptech/glide/load/engine/bitmap_recycle/LruArrayPool;->evictToSize(I)V
.line 149
return-void
.end method
.method private evictToSize(I)V
.registers 7
.param p1, "size" # I
.line 152
:goto_0
iget v0, p0, Lcom/bumptech/glide/load/engine/bitmap_recycle/LruArrayPool;->currentSize:I
if-le v0, p1, :cond_53
.line 153
iget-object v0, p0, Lcom/bumptech/glide/load/engine/bitmap_recycle/LruArrayPool;->groupedMap:Lcom/bumptech/glide/load/engine/bitmap_recycle/GroupedLinkedMap;
invoke-virtual {v0}, Lcom/bumptech/glide/load/engine/bitmap_recycle/GroupedLinkedMap;->removeLast()Ljava/lang/Object;
move-result-object v0
.line 154
.local v0, "evicted":Ljava/lang/Object;
invoke-static {v0}, Lcom/bumptech/glide/util/Preconditions;->checkNotNull(Ljava/lang/Object;)Ljava/lang/Object;
.line 155
invoke-direct {p0, v0}, Lcom/bumptech/glide/load/engine/bitmap_recycle/LruArrayPool;->getAdapterFromObject(Ljava/lang/Object;)Lcom/bumptech/glide/load/engine/bitmap_recycle/ArrayAdapterInterface;
move-result-object v1
.line 156
.local v1, "arrayAdapter":Lcom/bumptech/glide/load/engine/bitmap_recycle/ArrayAdapterInterface;, "Lcom/bumptech/glide/load/engine/bitmap_recycle/ArrayAdapterInterface<Ljava/lang/Object;>;"
iget v2, p0, Lcom/bumptech/glide/load/engine/bitmap_recycle/LruArrayPool;->currentSize:I
invoke-interface {v1, v0}, Lcom/bumptech/glide/load/engine/bitmap_recycle/ArrayAdapterInterface;->getArrayLength(Ljava/lang/Object;)I
move-result v3
invoke-interface {v1}, Lcom/bumptech/glide/load/engine/bitmap_recycle/ArrayAdapterInterface;->getElementSizeInBytes()I
move-result v4
mul-int v3, v3, v4
sub-int/2addr v2, v3
iput v2, p0, Lcom/bumptech/glide/load/engine/bitmap_recycle/LruArrayPool;->currentSize:I
.line 157
invoke-interface {v1, v0}, Lcom/bumptech/glide/load/engine/bitmap_recycle/ArrayAdapterInterface;->getArrayLength(Ljava/lang/Object;)I
move-result v2
invoke-virtual {v0}, Ljava/lang/Object;->getClass()Ljava/lang/Class;
move-result-object v3
invoke-direct {p0, v2, v3}, Lcom/bumptech/glide/load/engine/bitmap_recycle/LruArrayPool;->decrementArrayOfSize(ILjava/lang/Class;)V
.line 158
invoke-interface {v1}, Lcom/bumptech/glide/load/engine/bitmap_recycle/ArrayAdapterInterface;->getTag()Ljava/lang/String;
move-result-object v2
const/4 v3, 0x2
invoke-static {v2, v3}, Landroid/util/Log;->isLoggable(Ljava/lang/String;I)Z
move-result v2
if-eqz v2, :cond_52
.line 159
invoke-interface {v1}, Lcom/bumptech/glide/load/engine/bitmap_recycle/ArrayAdapterInterface;->getTag()Ljava/lang/String;
move-result-object v2
new-instance v3, Ljava/lang/StringBuilder;
invoke-direct {v3}, Ljava/lang/StringBuilder;-><init>()V
const-string v4, "evicted: "
invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
invoke-interface {v1, v0}, Lcom/bumptech/glide/load/engine/bitmap_recycle/ArrayAdapterInterface;->getArrayLength(Ljava/lang/Object;)I
move-result v4
invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
invoke-virtual {v3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v3
invoke-static {v2, v3}, Landroid/util/Log;->v(Ljava/lang/String;Ljava/lang/String;)I
.line 161
.end local v0 # "evicted":Ljava/lang/Object;
.end local v1 # "arrayAdapter":Lcom/bumptech/glide/load/engine/bitmap_recycle/ArrayAdapterInterface;, "Lcom/bumptech/glide/load/engine/bitmap_recycle/ArrayAdapterInterface<Ljava/lang/Object;>;"
:cond_52
goto :goto_0
.line 162
:cond_53
return-void
.end method
.method private getAdapterFromObject(Ljava/lang/Object;)Lcom/bumptech/glide/load/engine/bitmap_recycle/ArrayAdapterInterface;
.registers 3
.annotation system Ldalvik/annotation/Signature;
value = {
"<T:",
"Ljava/lang/Object;",
">(TT;)",
"Lcom/bumptech/glide/load/engine/bitmap_recycle/ArrayAdapterInterface<",
"TT;>;"
}
.end annotation
.line 189
.local p1, "object":Ljava/lang/Object;, "TT;"
invoke-virtual {p1}, Ljava/lang/Object;->getClass()Ljava/lang/Class;
move-result-object v0
invoke-direct {p0, v0}, Lcom/bumptech/glide/load/engine/bitmap_recycle/LruArrayPool;->getAdapterFromType(Ljava/lang/Class;)Lcom/bumptech/glide/load/engine/bitmap_recycle/ArrayAdapterInterface;
move-result-object v0
return-object v0
.end method
.method private getAdapterFromType(Ljava/lang/Class;)Lcom/bumptech/glide/load/engine/bitmap_recycle/ArrayAdapterInterface;
.registers 6
.annotation system Ldalvik/annotation/Signature;
value = {
"<T:",
"Ljava/lang/Object;",
">(",
"Ljava/lang/Class<",
"TT;>;)",
"Lcom/bumptech/glide/load/engine/bitmap_recycle/ArrayAdapterInterface<",
"TT;>;"
}
.end annotation
.line 194
.local p1, "arrayPoolClass":Ljava/lang/Class;, "Ljava/lang/Class<TT;>;"
iget-object v0, p0, Lcom/bumptech/glide/load/engine/bitmap_recycle/LruArrayPool;->adapters:Ljava/util/Map;
invoke-interface {v0, p1}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object;
move-result-object v0
check-cast v0, Lcom/bumptech/glide/load/engine/bitmap_recycle/ArrayAdapterInterface;
.line 195
.local v0, "adapter":Lcom/bumptech/glide/load/engine/bitmap_recycle/ArrayAdapterInterface;, "Lcom/bumptech/glide/load/engine/bitmap_recycle/ArrayAdapterInterface<*>;"
if-nez v0, :cond_48
.line 196
const-class v1, [I
invoke-virtual {p1, v1}, Ljava/lang/Object;->equals(Ljava/lang/Object;)Z
move-result v1
if-eqz v1, :cond_19
.line 197
new-instance v1, Lcom/bumptech/glide/load/engine/bitmap_recycle/IntegerArrayAdapter;
invoke-direct {v1}, Lcom/bumptech/glide/load/engine/bitmap_recycle/IntegerArrayAdapter;-><init>()V
move-object v0, v1
goto :goto_27
.line 198
:cond_19
const-class v1, [B
invoke-virtual {p1, v1}, Ljava/lang/Object;->equals(Ljava/lang/Object;)Z
move-result v1
if-eqz v1, :cond_2d
.line 199
new-instance v1, Lcom/bumptech/glide/load/engine/bitmap_recycle/ByteArrayAdapter;
invoke-direct {v1}, Lcom/bumptech/glide/load/engine/bitmap_recycle/ByteArrayAdapter;-><init>()V
move-object v0, v1
.line 204
:goto_27
iget-object v1, p0, Lcom/bumptech/glide/load/engine/bitmap_recycle/LruArrayPool;->adapters:Ljava/util/Map;
invoke-interface {v1, p1, v0}, Ljava/util/Map;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
goto :goto_48
.line 201
:cond_2d
new-instance v1, Ljava/lang/IllegalArgumentException;
new-instance v2, Ljava/lang/StringBuilder;
invoke-direct {v2}, Ljava/lang/StringBuilder;-><init>()V
const-string v3, "No array pool found for: "
invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
.line 202
invoke-virtual {p1}, Ljava/lang/Class;->getSimpleName()Ljava/lang/String;
move-result-object v3
invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v2
invoke-direct {v1, v2}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
throw v1
.line 206
:cond_48
:goto_48
return-object v0
.end method
.method private getArrayForKey(Lcom/bumptech/glide/load/engine/bitmap_recycle/LruArrayPool$Key;)Ljava/lang/Object;
.registers 3
.param p1, "key" # Lcom/bumptech/glide/load/engine/bitmap_recycle/LruArrayPool$Key;
.annotation system Ldalvik/annotation/Signature;
value = {
"<T:",
"Ljava/lang/Object;",
">(",
"Lcom/bumptech/glide/load/engine/bitmap_recycle/LruArrayPool$Key;",
")TT;"
}
.end annotation
.line 116
iget-object v0, p0, Lcom/bumptech/glide/load/engine/bitmap_recycle/LruArrayPool;->groupedMap:Lcom/bumptech/glide/load/engine/bitmap_recycle/GroupedLinkedMap;
invoke-virtual {v0, p1}, Lcom/bumptech/glide/load/engine/bitmap_recycle/GroupedLinkedMap;->get(Lcom/bumptech/glide/load/engine/bitmap_recycle/Poolable;)Ljava/lang/Object;
move-result-object v0
return-object v0
.end method
.method private getForKey(Lcom/bumptech/glide/load/engine/bitmap_recycle/LruArrayPool$Key;Ljava/lang/Class;)Ljava/lang/Object;
.registers 8
.param p1, "key" # Lcom/bumptech/glide/load/engine/bitmap_recycle/LruArrayPool$Key;
.annotation system Ldalvik/annotation/Signature;
value = {
"<T:",
"Ljava/lang/Object;",
">(",
"Lcom/bumptech/glide/load/engine/bitmap_recycle/LruArrayPool$Key;",
"Ljava/lang/Class<",
"TT;>;)TT;"
}
.end annotation
.line 96
.local p2, "arrayClass":Ljava/lang/Class;, "Ljava/lang/Class<TT;>;"
invoke-direct {p0, p2}, Lcom/bumptech/glide/load/engine/bitmap_recycle/LruArrayPool;->getAdapterFromType(Ljava/lang/Class;)Lcom/bumptech/glide/load/engine/bitmap_recycle/ArrayAdapterInterface;
move-result-object v0
.line 97
.local v0, "arrayAdapter":Lcom/bumptech/glide/load/engine/bitmap_recycle/ArrayAdapterInterface;, "Lcom/bumptech/glide/load/engine/bitmap_recycle/ArrayAdapterInterface<TT;>;"
invoke-direct {p0, p1}, Lcom/bumptech/glide/load/engine/bitmap_recycle/LruArrayPool;->getArrayForKey(Lcom/bumptech/glide/load/engine/bitmap_recycle/LruArrayPool$Key;)Ljava/lang/Object;
move-result-object v1
.line 98
.local v1, "result":Ljava/lang/Object;, "TT;"
if-eqz v1, :cond_20
.line 99
iget v2, p0, Lcom/bumptech/glide/load/engine/bitmap_recycle/LruArrayPool;->currentSize:I
invoke-interface {v0, v1}, Lcom/bumptech/glide/load/engine/bitmap_recycle/ArrayAdapterInterface;->getArrayLength(Ljava/lang/Object;)I
move-result v3
invoke-interface {v0}, Lcom/bumptech/glide/load/engine/bitmap_recycle/ArrayAdapterInterface;->getElementSizeInBytes()I
move-result v4
mul-int v3, v3, v4
sub-int/2addr v2, v3
iput v2, p0, Lcom/bumptech/glide/load/engine/bitmap_recycle/LruArrayPool;->currentSize:I
.line 100
invoke-interface {v0, v1}, Lcom/bumptech/glide/load/engine/bitmap_recycle/ArrayAdapterInterface;->getArrayLength(Ljava/lang/Object;)I
move-result v2
invoke-direct {p0, v2, p2}, Lcom/bumptech/glide/load/engine/bitmap_recycle/LruArrayPool;->decrementArrayOfSize(ILjava/lang/Class;)V
.line 103
:cond_20
if-nez v1, :cond_52
.line 104
invoke-interface {v0}, Lcom/bumptech/glide/load/engine/bitmap_recycle/ArrayAdapterInterface;->getTag()Ljava/lang/String;
move-result-object v2
const/4 v3, 0x2
invoke-static {v2, v3}, Landroid/util/Log;->isLoggable(Ljava/lang/String;I)Z
move-result v2
if-eqz v2, :cond_4c
.line 105
invoke-interface {v0}, Lcom/bumptech/glide/load/engine/bitmap_recycle/ArrayAdapterInterface;->getTag()Ljava/lang/String;
move-result-object v2
new-instance v3, Ljava/lang/StringBuilder;
invoke-direct {v3}, Ljava/lang/StringBuilder;-><init>()V
const-string v4, "Allocated "
invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
iget v4, p1, Lcom/bumptech/glide/load/engine/bitmap_recycle/LruArrayPool$Key;->size:I
invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
const-string v4, " bytes"
invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
invoke-virtual {v3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v3
invoke-static {v2, v3}, Landroid/util/Log;->v(Ljava/lang/String;Ljava/lang/String;)I
.line 107
:cond_4c
iget v2, p1, Lcom/bumptech/glide/load/engine/bitmap_recycle/LruArrayPool$Key;->size:I
invoke-interface {v0, v2}, Lcom/bumptech/glide/load/engine/bitmap_recycle/ArrayAdapterInterface;->newArray(I)Ljava/lang/Object;
move-result-object v1
.line 109
:cond_52
return-object v1
.end method
.method private getSizesForAdapter(Ljava/lang/Class;)Ljava/util/NavigableMap;
.registers 4
.annotation system Ldalvik/annotation/Signature;
value = {
"(",
"Ljava/lang/Class<",
"*>;)",
"Ljava/util/NavigableMap<",
"Ljava/lang/Integer;",
"Ljava/lang/Integer;",
">;"
}
.end annotation
.line 179
.local p1, "arrayClass":Ljava/lang/Class;, "Ljava/lang/Class<*>;"
iget-object v0, p0, Lcom/bumptech/glide/load/engine/bitmap_recycle/LruArrayPool;->sortedSizes:Ljava/util/Map;
invoke-interface {v0, p1}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object;
move-result-object v0
check-cast v0, Ljava/util/NavigableMap;
.line 180
.local v0, "sizes":Ljava/util/NavigableMap;, "Ljava/util/NavigableMap<Ljava/lang/Integer;Ljava/lang/Integer;>;"
if-nez v0, :cond_15
.line 181
new-instance v1, Ljava/util/TreeMap;
invoke-direct {v1}, Ljava/util/TreeMap;-><init>()V
move-object v0, v1
.line 182
iget-object v1, p0, Lcom/bumptech/glide/load/engine/bitmap_recycle/LruArrayPool;->sortedSizes:Ljava/util/Map;
invoke-interface {v1, p1, v0}, Ljava/util/Map;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
.line 184
:cond_15
return-object v0
.end method
.method private isNoMoreThanHalfFull()Z
.registers 3
.line 129
iget v0, p0, Lcom/bumptech/glide/load/engine/bitmap_recycle/LruArrayPool;->currentSize:I
if-eqz v0, :cond_d
iget v1, p0, Lcom/bumptech/glide/load/engine/bitmap_recycle/LruArrayPool;->maxSize:I
div-int/2addr v1, v0
const/4 v0, 0x2
if-lt v1, v0, :cond_b
goto :goto_d
:cond_b
const/4 v0, 0x0
goto :goto_e
:cond_d
:goto_d
const/4 v0, 0x1
:goto_e
return v0
.end method
.method private isSmallEnoughForReuse(I)Z
.registers 3
.param p1, "byteSize" # I
.line 120
iget v0, p0, Lcom/bumptech/glide/load/engine/bitmap_recycle/LruArrayPool;->maxSize:I
div-int/lit8 v0, v0, 0x2
if-gt p1, v0, :cond_8
const/4 v0, 0x1
goto :goto_9
:cond_8
const/4 v0, 0x0
:goto_9
return v0
.end method
.method private mayFillRequest(ILjava/lang/Integer;)Z
.registers 5
.param p1, "requestedSize" # I
.param p2, "actualSize" # Ljava/lang/Integer;
.line 124
if-eqz p2, :cond_12
.line 125
invoke-direct {p0}, Lcom/bumptech/glide/load/engine/bitmap_recycle/LruArrayPool;->isNoMoreThanHalfFull()Z
move-result v0
if-nez v0, :cond_10
invoke-virtual {p2}, Ljava/lang/Integer;->intValue()I
move-result v0
mul-int/lit8 v1, p1, 0x8
if-gt v0, v1, :cond_12
:cond_10
const/4 v0, 0x1
goto :goto_13
:cond_12
const/4 v0, 0x0
.line 124
:goto_13
return v0
.end method
# virtual methods
.method public declared-synchronized clearMemory()V
.registers 2
monitor-enter p0
.line 134
const/4 v0, 0x0
:try_start_2
invoke-direct {p0, v0}, Lcom/bumptech/glide/load/engine/bitmap_recycle/LruArrayPool;->evictToSize(I)V
:try_end_5
.catchall {:try_start_2 .. :try_end_5} :catchall_7
.line 135
monitor-exit p0
return-void
.line 133
.end local p0 # "this":Lcom/bumptech/glide/load/engine/bitmap_recycle/LruArrayPool;
:catchall_7
move-exception v0
monitor-exit p0
throw v0
.end method
.method public declared-synchronized get(ILjava/lang/Class;)Ljava/lang/Object;
.registers 6
.param p1, "size" # I
.annotation system Ldalvik/annotation/Signature;
value = {
"<T:",
"Ljava/lang/Object;",
">(I",
"Ljava/lang/Class<",
"TT;>;)TT;"
}
.end annotation
.local p2, "arrayClass":Ljava/lang/Class;, "Ljava/lang/Class<TT;>;"
monitor-enter p0
.line 85
:try_start_1
invoke-direct {p0, p2}, Lcom/bumptech/glide/load/engine/bitmap_recycle/LruArrayPool;->getSizesForAdapter(Ljava/lang/Class;)Ljava/util/NavigableMap;
move-result-object v0
invoke-static {p1}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;
move-result-object v1
invoke-interface {v0, v1}, Ljava/util/NavigableMap;->ceilingKey(Ljava/lang/Object;)Ljava/lang/Object;
move-result-object v0
check-cast v0, Ljava/lang/Integer;
.line 87
.local v0, "possibleSize":Ljava/lang/Integer;
invoke-direct {p0, p1, v0}, Lcom/bumptech/glide/load/engine/bitmap_recycle/LruArrayPool;->mayFillRequest(ILjava/lang/Integer;)Z
move-result v1
if-eqz v1, :cond_20
.line 88
iget-object v1, p0, Lcom/bumptech/glide/load/engine/bitmap_recycle/LruArrayPool;->keyPool:Lcom/bumptech/glide/load/engine/bitmap_recycle/LruArrayPool$KeyPool;
invoke-virtual {v0}, Ljava/lang/Integer;->intValue()I
move-result v2
invoke-virtual {v1, v2, p2}, Lcom/bumptech/glide/load/engine/bitmap_recycle/LruArrayPool$KeyPool;->get(ILjava/lang/Class;)Lcom/bumptech/glide/load/engine/bitmap_recycle/LruArrayPool$Key;
move-result-object v1
.local v1, "key":Lcom/bumptech/glide/load/engine/bitmap_recycle/LruArrayPool$Key;
goto :goto_26
.line 90
.end local v1 # "key":Lcom/bumptech/glide/load/engine/bitmap_recycle/LruArrayPool$Key;
.end local p0 # "this":Lcom/bumptech/glide/load/engine/bitmap_recycle/LruArrayPool;
:cond_20
iget-object v1, p0, Lcom/bumptech/glide/load/engine/bitmap_recycle/LruArrayPool;->keyPool:Lcom/bumptech/glide/load/engine/bitmap_recycle/LruArrayPool$KeyPool;
invoke-virtual {v1, p1, p2}, Lcom/bumptech/glide/load/engine/bitmap_recycle/LruArrayPool$KeyPool;->get(ILjava/lang/Class;)Lcom/bumptech/glide/load/engine/bitmap_recycle/LruArrayPool$Key;
move-result-object v1
.line 92
.restart local v1 # "key":Lcom/bumptech/glide/load/engine/bitmap_recycle/LruArrayPool$Key;
:goto_26
invoke-direct {p0, v1, p2}, Lcom/bumptech/glide/load/engine/bitmap_recycle/LruArrayPool;->getForKey(Lcom/bumptech/glide/load/engine/bitmap_recycle/LruArrayPool$Key;Ljava/lang/Class;)Ljava/lang/Object;
move-result-object v2
:try_end_2a
.catchall {:try_start_1 .. :try_end_2a} :catchall_2c
monitor-exit p0
return-object v2
.line 84
.end local v0 # "possibleSize":Ljava/lang/Integer;
.end local v1 # "key":Lcom/bumptech/glide/load/engine/bitmap_recycle/LruArrayPool$Key;
.end local p1 # "size":I
.end local p2 # "arrayClass":Ljava/lang/Class;, "Ljava/lang/Class<TT;>;"
:catchall_2c
move-exception p1
monitor-exit p0
throw p1
.end method
.method getCurrentSize()I
.registers 9
.line 211
const/4 v0, 0x0
.line 212
.local v0, "currentSize":I
iget-object v1, p0, Lcom/bumptech/glide/load/engine/bitmap_recycle/LruArrayPool;->sortedSizes:Ljava/util/Map;
invoke-interface {v1}, Ljava/util/Map;->keySet()Ljava/util/Set;
move-result-object v1
invoke-interface {v1}, Ljava/util/Set;->iterator()Ljava/util/Iterator;
move-result-object v1
:goto_b
invoke-interface {v1}, Ljava/util/Iterator;->hasNext()Z
move-result v2
if-eqz v2, :cond_58
invoke-interface {v1}, Ljava/util/Iterator;->next()Ljava/lang/Object;
move-result-object v2
check-cast v2, Ljava/lang/Class;
.line 213
.local v2, "type":Ljava/lang/Class;, "Ljava/lang/Class<*>;"
iget-object v3, p0, Lcom/bumptech/glide/load/engine/bitmap_recycle/LruArrayPool;->sortedSizes:Ljava/util/Map;
invoke-interface {v3, v2}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object;
move-result-object v3
check-cast v3, Ljava/util/NavigableMap;
invoke-interface {v3}, Ljava/util/NavigableMap;->keySet()Ljava/util/Set;
move-result-object v3
invoke-interface {v3}, Ljava/util/Set;->iterator()Ljava/util/Iterator;
move-result-object v3
:goto_27
invoke-interface {v3}, Ljava/util/Iterator;->hasNext()Z
move-result v4
if-eqz v4, :cond_57
invoke-interface {v3}, Ljava/util/Iterator;->next()Ljava/lang/Object;
move-result-object v4
check-cast v4, Ljava/lang/Integer;
.line 214
.local v4, "size":Ljava/lang/Integer;
invoke-direct {p0, v2}, Lcom/bumptech/glide/load/engine/bitmap_recycle/LruArrayPool;->getAdapterFromType(Ljava/lang/Class;)Lcom/bumptech/glide/load/engine/bitmap_recycle/ArrayAdapterInterface;
move-result-object v5
.line 215
.local v5, "adapter":Lcom/bumptech/glide/load/engine/bitmap_recycle/ArrayAdapterInterface;, "Lcom/bumptech/glide/load/engine/bitmap_recycle/ArrayAdapterInterface<*>;"
invoke-virtual {v4}, Ljava/lang/Integer;->intValue()I
move-result v6
iget-object v7, p0, Lcom/bumptech/glide/load/engine/bitmap_recycle/LruArrayPool;->sortedSizes:Ljava/util/Map;
invoke-interface {v7, v2}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object;
move-result-object v7
check-cast v7, Ljava/util/NavigableMap;
invoke-interface {v7, v4}, Ljava/util/NavigableMap;->get(Ljava/lang/Object;)Ljava/lang/Object;
move-result-object v7
check-cast v7, Ljava/lang/Integer;
invoke-virtual {v7}, Ljava/lang/Integer;->intValue()I
move-result v7
mul-int v6, v6, v7
invoke-interface {v5}, Lcom/bumptech/glide/load/engine/bitmap_recycle/ArrayAdapterInterface;->getElementSizeInBytes()I
move-result v7
mul-int v6, v6, v7
add-int/2addr v0, v6
.line 216
.end local v4 # "size":Ljava/lang/Integer;
.end local v5 # "adapter":Lcom/bumptech/glide/load/engine/bitmap_recycle/ArrayAdapterInterface;, "Lcom/bumptech/glide/load/engine/bitmap_recycle/ArrayAdapterInterface<*>;"
goto :goto_27
.line 217
.end local v2 # "type":Ljava/lang/Class;, "Ljava/lang/Class<*>;"
:cond_57
goto :goto_b
.line 218
:cond_58
return v0
.end method
.method public declared-synchronized getExact(ILjava/lang/Class;)Ljava/lang/Object;
.registers 5
.param p1, "size" # I
.annotation system Ldalvik/annotation/Signature;
value = {
"<T:",
"Ljava/lang/Object;",
">(I",
"Ljava/lang/Class<",
"TT;>;)TT;"
}
.end annotation
.local p2, "arrayClass":Ljava/lang/Class;, "Ljava/lang/Class<TT;>;"
monitor-enter p0
.line 79
:try_start_1
iget-object v0, p0, Lcom/bumptech/glide/load/engine/bitmap_recycle/LruArrayPool;->keyPool:Lcom/bumptech/glide/load/engine/bitmap_recycle/LruArrayPool$KeyPool;
invoke-virtual {v0, p1, p2}, Lcom/bumptech/glide/load/engine/bitmap_recycle/LruArrayPool$KeyPool;->get(ILjava/lang/Class;)Lcom/bumptech/glide/load/engine/bitmap_recycle/LruArrayPool$Key;
move-result-object v0
.line 80
.local v0, "key":Lcom/bumptech/glide/load/engine/bitmap_recycle/LruArrayPool$Key;
invoke-direct {p0, v0, p2}, Lcom/bumptech/glide/load/engine/bitmap_recycle/LruArrayPool;->getForKey(Lcom/bumptech/glide/load/engine/bitmap_recycle/LruArrayPool$Key;Ljava/lang/Class;)Ljava/lang/Object;
move-result-object v1
:try_end_b
.catchall {:try_start_1 .. :try_end_b} :catchall_d
monitor-exit p0
return-object v1
.line 78
.end local v0 # "key":Lcom/bumptech/glide/load/engine/bitmap_recycle/LruArrayPool$Key;
.end local p0 # "this":Lcom/bumptech/glide/load/engine/bitmap_recycle/LruArrayPool;
.end local p1 # "size":I
.end local p2 # "arrayClass":Ljava/lang/Class;, "Ljava/lang/Class<TT;>;"
:catchall_d
move-exception p1
monitor-exit p0
throw p1
.end method
.method public declared-synchronized put(Ljava/lang/Object;)V
.registers 12
.annotation system Ldalvik/annotation/Signature;
value = {
"<T:",
"Ljava/lang/Object;",
">(TT;)V"
}
.end annotation
.local p1, "array":Ljava/lang/Object;, "TT;"
monitor-enter p0
.line 59
:try_start_1
invoke-virtual {p1}, Ljava/lang/Object;->getClass()Ljava/lang/Class;
move-result-object v0
.line 61
.local v0, "arrayClass":Ljava/lang/Class;, "Ljava/lang/Class<TT;>;"
invoke-direct {p0, v0}, Lcom/bumptech/glide/load/engine/bitmap_recycle/LruArrayPool;->getAdapterFromType(Ljava/lang/Class;)Lcom/bumptech/glide/load/engine/bitmap_recycle/ArrayAdapterInterface;
move-result-object v1
.line 62
.local v1, "arrayAdapter":Lcom/bumptech/glide/load/engine/bitmap_recycle/ArrayAdapterInterface;, "Lcom/bumptech/glide/load/engine/bitmap_recycle/ArrayAdapterInterface<TT;>;"
invoke-interface {v1, p1}, Lcom/bumptech/glide/load/engine/bitmap_recycle/ArrayAdapterInterface;->getArrayLength(Ljava/lang/Object;)I
move-result v2
.line 63
.local v2, "size":I
invoke-interface {v1}, Lcom/bumptech/glide/load/engine/bitmap_recycle/ArrayAdapterInterface;->getElementSizeInBytes()I
move-result v3
mul-int v3, v3, v2
.line 64
.local v3, "arrayBytes":I
invoke-direct {p0, v3}, Lcom/bumptech/glide/load/engine/bitmap_recycle/LruArrayPool;->isSmallEnoughForReuse(I)Z
move-result v4
:try_end_17
.catchall {:try_start_1 .. :try_end_17} :catchall_56
if-nez v4, :cond_1b
.line 65
monitor-exit p0
return-void
.line 67
:cond_1b
:try_start_1b
iget-object v4, p0, Lcom/bumptech/glide/load/engine/bitmap_recycle/LruArrayPool;->keyPool:Lcom/bumptech/glide/load/engine/bitmap_recycle/LruArrayPool$KeyPool;
invoke-virtual {v4, v2, v0}, Lcom/bumptech/glide/load/engine/bitmap_recycle/LruArrayPool$KeyPool;->get(ILjava/lang/Class;)Lcom/bumptech/glide/load/engine/bitmap_recycle/LruArrayPool$Key;
move-result-object v4
.line 69
.local v4, "key":Lcom/bumptech/glide/load/engine/bitmap_recycle/LruArrayPool$Key;
iget-object v5, p0, Lcom/bumptech/glide/load/engine/bitmap_recycle/LruArrayPool;->groupedMap:Lcom/bumptech/glide/load/engine/bitmap_recycle/GroupedLinkedMap;
invoke-virtual {v5, v4, p1}, Lcom/bumptech/glide/load/engine/bitmap_recycle/GroupedLinkedMap;->put(Lcom/bumptech/glide/load/engine/bitmap_recycle/Poolable;Ljava/lang/Object;)V
.line 70
invoke-direct {p0, v0}, Lcom/bumptech/glide/load/engine/bitmap_recycle/LruArrayPool;->getSizesForAdapter(Ljava/lang/Class;)Ljava/util/NavigableMap;
move-result-object v5
.line 71
.local v5, "sizes":Ljava/util/NavigableMap;, "Ljava/util/NavigableMap<Ljava/lang/Integer;Ljava/lang/Integer;>;"
iget v6, v4, Lcom/bumptech/glide/load/engine/bitmap_recycle/LruArrayPool$Key;->size:I
invoke-static {v6}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;
move-result-object v6
invoke-interface {v5, v6}, Ljava/util/NavigableMap;->get(Ljava/lang/Object;)Ljava/lang/Object;
move-result-object v6
check-cast v6, Ljava/lang/Integer;
.line 72
.local v6, "current":Ljava/lang/Integer;
iget v7, v4, Lcom/bumptech/glide/load/engine/bitmap_recycle/LruArrayPool$Key;->size:I
invoke-static {v7}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;
move-result-object v7
const/4 v8, 0x1
if-nez v6, :cond_40
goto :goto_45
:cond_40
invoke-virtual {v6}, Ljava/lang/Integer;->intValue()I
move-result v9
add-int/2addr v8, v9
:goto_45
invoke-static {v8}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;
move-result-object v8
invoke-interface {v5, v7, v8}, Ljava/util/NavigableMap;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
.line 73
iget v7, p0, Lcom/bumptech/glide/load/engine/bitmap_recycle/LruArrayPool;->currentSize:I
add-int/2addr v7, v3
iput v7, p0, Lcom/bumptech/glide/load/engine/bitmap_recycle/LruArrayPool;->currentSize:I
.line 74
invoke-direct {p0}, Lcom/bumptech/glide/load/engine/bitmap_recycle/LruArrayPool;->evict()V
:try_end_54
.catchall {:try_start_1b .. :try_end_54} :catchall_56
.line 75
monitor-exit p0
return-void
.line 58
.end local v0 # "arrayClass":Ljava/lang/Class;, "Ljava/lang/Class<TT;>;"
.end local v1 # "arrayAdapter":Lcom/bumptech/glide/load/engine/bitmap_recycle/ArrayAdapterInterface;, "Lcom/bumptech/glide/load/engine/bitmap_recycle/ArrayAdapterInterface<TT;>;"
.end local v2 # "size":I
.end local v3 # "arrayBytes":I
.end local v4 # "key":Lcom/bumptech/glide/load/engine/bitmap_recycle/LruArrayPool$Key;
.end local v5 # "sizes":Ljava/util/NavigableMap;, "Ljava/util/NavigableMap<Ljava/lang/Integer;Ljava/lang/Integer;>;"
.end local v6 # "current":Ljava/lang/Integer;
.end local p0 # "this":Lcom/bumptech/glide/load/engine/bitmap_recycle/LruArrayPool;
.end local p1 # "array":Ljava/lang/Object;, "TT;"
:catchall_56
move-exception p1
monitor-exit p0
throw p1
.end method
.method public put(Ljava/lang/Object;Ljava/lang/Class;)V
.registers 3
.annotation system Ldalvik/annotation/Signature;
value = {
"<T:",
"Ljava/lang/Object;",
">(TT;",
"Ljava/lang/Class<",
"TT;>;)V"
}
.end annotation
.annotation runtime Ljava/lang/Deprecated;
.end annotation
.line 53
.local p1, "array":Ljava/lang/Object;, "TT;"
.local p2, "arrayClass":Ljava/lang/Class;, "Ljava/lang/Class<TT;>;"
invoke-virtual {p0, p1}, Lcom/bumptech/glide/load/engine/bitmap_recycle/LruArrayPool;->put(Ljava/lang/Object;)V
.line 54
return-void
.end method
.method public declared-synchronized trimMemory(I)V
.registers 3
.param p1, "level" # I
monitor-enter p0
.line 139
const/16 v0, 0x28
if-lt p1, v0, :cond_b
.line 140
:try_start_5
invoke-virtual {p0}, Lcom/bumptech/glide/load/engine/bitmap_recycle/LruArrayPool;->clearMemory()V
goto :goto_1a
.line 138
.end local p0 # "this":Lcom/bumptech/glide/load/engine/bitmap_recycle/LruArrayPool;
.end local p1 # "level":I
:catchall_9
move-exception p1
goto :goto_1c
.line 141
.restart local p1 # "level":I
:cond_b
const/16 v0, 0x14
if-ge p1, v0, :cond_13
const/16 v0, 0xf
if-ne p1, v0, :cond_1a
.line 143
:cond_13
iget v0, p0, Lcom/bumptech/glide/load/engine/bitmap_recycle/LruArrayPool;->maxSize:I
div-int/lit8 v0, v0, 0x2
invoke-direct {p0, v0}, Lcom/bumptech/glide/load/engine/bitmap_recycle/LruArrayPool;->evictToSize(I)V
:try_end_1a
.catchall {:try_start_5 .. :try_end_1a} :catchall_9
.line 145
:cond_1a
:goto_1a
monitor-exit p0
return-void
.line 138
.end local p1 # "level":I
:goto_1c
monitor-exit p0
throw p1
.end method