CountingMemoryCache.smali
.class public Lcom/facebook/imagepipeline/cache/CountingMemoryCache;
.super Ljava/lang/Object;
.source "SourceFile"
# interfaces
.implements Lcom/facebook/imagepipeline/cache/MemoryCache;
.implements Lcom/facebook/common/memory/MemoryTrimmable;
# annotations
.annotation system Ldalvik/annotation/MemberClasses;
value = {
Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;,
Lcom/facebook/imagepipeline/cache/CountingMemoryCache$EntryStateObserver;,
Lcom/facebook/imagepipeline/cache/CountingMemoryCache$CacheTrimStrategy;
}
.end annotation
.annotation system Ldalvik/annotation/Signature;
value = {
"<K:",
"Ljava/lang/Object;",
"V:",
"Ljava/lang/Object;",
">",
"Ljava/lang/Object;",
"Lcom/facebook/imagepipeline/cache/MemoryCache<",
"TK;TV;>;",
"Lcom/facebook/common/memory/MemoryTrimmable;"
}
.end annotation
# instance fields
.field private final mCacheTrimStrategy:Lcom/facebook/imagepipeline/cache/CountingMemoryCache$CacheTrimStrategy;
.field public final mCachedEntries:Lcom/facebook/imagepipeline/cache/CountingLruMap;
.annotation build Lcom/facebook/common/internal/VisibleForTesting;
.end annotation
.annotation system Ldalvik/annotation/Signature;
value = {
"Lcom/facebook/imagepipeline/cache/CountingLruMap<",
"TK;",
"Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry<",
"TK;TV;>;>;"
}
.end annotation
.end field
.field public final mExclusiveEntries:Lcom/facebook/imagepipeline/cache/CountingLruMap;
.annotation build Lcom/facebook/common/internal/VisibleForTesting;
.end annotation
.annotation system Ldalvik/annotation/Signature;
value = {
"Lcom/facebook/imagepipeline/cache/CountingLruMap<",
"TK;",
"Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry<",
"TK;TV;>;>;"
}
.end annotation
.end field
.field private mLastCacheParamsCheck:J
.field public mMemoryCacheParams:Lcom/facebook/imagepipeline/cache/MemoryCacheParams;
.field private final mMemoryCacheParamsSupplier:Lcom/facebook/common/internal/Supplier;
.annotation system Ldalvik/annotation/Signature;
value = {
"Lcom/facebook/common/internal/Supplier<",
"Lcom/facebook/imagepipeline/cache/MemoryCacheParams;",
">;"
}
.end annotation
.end field
.field public final mOtherEntries:Ljava/util/Map;
.annotation build Lcom/facebook/common/internal/VisibleForTesting;
.end annotation
.annotation system Ldalvik/annotation/Signature;
value = {
"Ljava/util/Map<",
"Landroid/graphics/Bitmap;",
"Ljava/lang/Object;",
">;"
}
.end annotation
.end field
.field private final mValueDescriptor:Lcom/facebook/imagepipeline/cache/ValueDescriptor;
.annotation system Ldalvik/annotation/Signature;
value = {
"Lcom/facebook/imagepipeline/cache/ValueDescriptor<",
"TV;>;"
}
.end annotation
.end field
# direct methods
.method public constructor <init>(Lcom/facebook/imagepipeline/cache/ValueDescriptor;Lcom/facebook/imagepipeline/cache/CountingMemoryCache$CacheTrimStrategy;Lcom/facebook/common/internal/Supplier;)V
.registers 6
.annotation system Ldalvik/annotation/Signature;
value = {
"(",
"Lcom/facebook/imagepipeline/cache/ValueDescriptor<",
"TV;>;",
"Lcom/facebook/imagepipeline/cache/CountingMemoryCache$CacheTrimStrategy;",
"Lcom/facebook/common/internal/Supplier<",
"Lcom/facebook/imagepipeline/cache/MemoryCacheParams;",
">;)V"
}
.end annotation
.line 1
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
.line 2
new-instance v0, Ljava/util/WeakHashMap;
invoke-direct {v0}, Ljava/util/WeakHashMap;-><init>()V
iput-object v0, p0, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->mOtherEntries:Ljava/util/Map;
.line 3
iput-object p1, p0, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->mValueDescriptor:Lcom/facebook/imagepipeline/cache/ValueDescriptor;
.line 4
new-instance v0, Lcom/facebook/imagepipeline/cache/CountingLruMap;
invoke-direct {p0, p1}, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->wrapValueDescriptor(Lcom/facebook/imagepipeline/cache/ValueDescriptor;)Lcom/facebook/imagepipeline/cache/ValueDescriptor;
move-result-object v1
invoke-direct {v0, v1}, Lcom/facebook/imagepipeline/cache/CountingLruMap;-><init>(Lcom/facebook/imagepipeline/cache/ValueDescriptor;)V
iput-object v0, p0, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->mExclusiveEntries:Lcom/facebook/imagepipeline/cache/CountingLruMap;
.line 5
new-instance v0, Lcom/facebook/imagepipeline/cache/CountingLruMap;
invoke-direct {p0, p1}, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->wrapValueDescriptor(Lcom/facebook/imagepipeline/cache/ValueDescriptor;)Lcom/facebook/imagepipeline/cache/ValueDescriptor;
move-result-object p1
invoke-direct {v0, p1}, Lcom/facebook/imagepipeline/cache/CountingLruMap;-><init>(Lcom/facebook/imagepipeline/cache/ValueDescriptor;)V
iput-object v0, p0, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->mCachedEntries:Lcom/facebook/imagepipeline/cache/CountingLruMap;
.line 6
iput-object p2, p0, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->mCacheTrimStrategy:Lcom/facebook/imagepipeline/cache/CountingMemoryCache$CacheTrimStrategy;
.line 7
iput-object p3, p0, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->mMemoryCacheParamsSupplier:Lcom/facebook/common/internal/Supplier;
.line 8
invoke-interface {p3}, Lcom/facebook/common/internal/Supplier;->get()Ljava/lang/Object;
move-result-object p1
check-cast p1, Lcom/facebook/imagepipeline/cache/MemoryCacheParams;
iput-object p1, p0, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->mMemoryCacheParams:Lcom/facebook/imagepipeline/cache/MemoryCacheParams;
.line 9
invoke-static {}, Landroid/os/SystemClock;->uptimeMillis()J
move-result-wide p1
iput-wide p1, p0, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->mLastCacheParamsCheck:J
return-void
.end method
.method public static synthetic access$000(Lcom/facebook/imagepipeline/cache/CountingMemoryCache;Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;)V
.registers 2
invoke-direct {p0, p1}, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->releaseClientReference(Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;)V
return-void
.end method
.method private declared-synchronized canCacheNewValue(Ljava/lang/Object;)Z
.registers 5
.annotation system Ldalvik/annotation/Signature;
value = {
"(TV;)Z"
}
.end annotation
monitor-enter p0
.line 1
:try_start_1
iget-object v0, p0, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->mValueDescriptor:Lcom/facebook/imagepipeline/cache/ValueDescriptor;
invoke-interface {v0, p1}, Lcom/facebook/imagepipeline/cache/ValueDescriptor;->getSizeInBytes(Ljava/lang/Object;)I
move-result p1
.line 2
iget-object v0, p0, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->mMemoryCacheParams:Lcom/facebook/imagepipeline/cache/MemoryCacheParams;
iget v0, v0, Lcom/facebook/imagepipeline/cache/MemoryCacheParams;->maxCacheEntrySize:I
const/4 v1, 0x1
if-gt p1, v0, :cond_25
.line 3
invoke-virtual {p0}, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->getInUseCount()I
move-result v0
iget-object v2, p0, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->mMemoryCacheParams:Lcom/facebook/imagepipeline/cache/MemoryCacheParams;
iget v2, v2, Lcom/facebook/imagepipeline/cache/MemoryCacheParams;->maxCacheEntries:I
sub-int/2addr v2, v1
if-gt v0, v2, :cond_25
.line 4
invoke-virtual {p0}, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->getInUseSizeInBytes()I
move-result v0
iget-object v2, p0, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->mMemoryCacheParams:Lcom/facebook/imagepipeline/cache/MemoryCacheParams;
iget v2, v2, Lcom/facebook/imagepipeline/cache/MemoryCacheParams;->maxCacheSize:I
:try_end_21
.catchall {:try_start_1 .. :try_end_21} :catchall_28
sub-int/2addr v2, p1
if-gt v0, v2, :cond_25
goto :goto_26
:cond_25
const/4 v1, 0x0
.line 5
:goto_26
monitor-exit p0
return v1
:catchall_28
move-exception p1
monitor-exit p0
throw p1
.end method
.method private declared-synchronized decreaseClientCount(Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;)V
.registers 4
.annotation system Ldalvik/annotation/Signature;
value = {
"(",
"Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry<",
"TK;TV;>;)V"
}
.end annotation
monitor-enter p0
.line 1
:try_start_1
invoke-static {p1}, Lcom/facebook/common/internal/Preconditions;->checkNotNull(Ljava/lang/Object;)Ljava/lang/Object;
.line 2
iget v0, p1, Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;->clientCount:I
const/4 v1, 0x1
if-lez v0, :cond_b
const/4 v0, 0x1
goto :goto_c
:cond_b
const/4 v0, 0x0
:goto_c
invoke-static {v0}, Lcom/facebook/common/internal/Preconditions;->checkState(Z)V
.line 3
iget v0, p1, Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;->clientCount:I
sub-int/2addr v0, v1
iput v0, p1, Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;->clientCount:I
:try_end_14
.catchall {:try_start_1 .. :try_end_14} :catchall_16
.line 4
monitor-exit p0
return-void
:catchall_16
move-exception p1
monitor-exit p0
throw p1
.end method
.method private declared-synchronized increaseClientCount(Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;)V
.registers 4
.annotation system Ldalvik/annotation/Signature;
value = {
"(",
"Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry<",
"TK;TV;>;)V"
}
.end annotation
monitor-enter p0
.line 1
:try_start_1
invoke-static {p1}, Lcom/facebook/common/internal/Preconditions;->checkNotNull(Ljava/lang/Object;)Ljava/lang/Object;
.line 2
iget-boolean v0, p1, Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;->isOrphan:Z
const/4 v1, 0x1
if-nez v0, :cond_b
const/4 v0, 0x1
goto :goto_c
:cond_b
const/4 v0, 0x0
:goto_c
invoke-static {v0}, Lcom/facebook/common/internal/Preconditions;->checkState(Z)V
.line 3
iget v0, p1, Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;->clientCount:I
add-int/2addr v0, v1
iput v0, p1, Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;->clientCount:I
:try_end_14
.catchall {:try_start_1 .. :try_end_14} :catchall_16
.line 4
monitor-exit p0
return-void
:catchall_16
move-exception p1
monitor-exit p0
throw p1
.end method
.method private declared-synchronized makeOrphan(Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;)V
.registers 4
.annotation system Ldalvik/annotation/Signature;
value = {
"(",
"Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry<",
"TK;TV;>;)V"
}
.end annotation
monitor-enter p0
.line 1
:try_start_1
invoke-static {p1}, Lcom/facebook/common/internal/Preconditions;->checkNotNull(Ljava/lang/Object;)Ljava/lang/Object;
.line 2
iget-boolean v0, p1, Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;->isOrphan:Z
const/4 v1, 0x1
if-nez v0, :cond_b
const/4 v0, 0x1
goto :goto_c
:cond_b
const/4 v0, 0x0
:goto_c
invoke-static {v0}, Lcom/facebook/common/internal/Preconditions;->checkState(Z)V
.line 3
iput-boolean v1, p1, Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;->isOrphan:Z
:try_end_11
.catchall {:try_start_1 .. :try_end_11} :catchall_13
.line 4
monitor-exit p0
return-void
:catchall_13
move-exception p1
monitor-exit p0
throw p1
.end method
.method private declared-synchronized makeOrphans(Ljava/util/ArrayList;)V
.registers 3
.annotation system Ldalvik/annotation/Signature;
value = {
"(",
"Ljava/util/ArrayList<",
"Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry<",
"TK;TV;>;>;)V"
}
.end annotation
monitor-enter p0
if-eqz p1, :cond_1a
.line 1
:try_start_3
invoke-virtual {p1}, Ljava/util/ArrayList;->iterator()Ljava/util/Iterator;
move-result-object p1
:goto_7
invoke-interface {p1}, Ljava/util/Iterator;->hasNext()Z
move-result v0
if-eqz v0, :cond_1a
invoke-interface {p1}, Ljava/util/Iterator;->next()Ljava/lang/Object;
move-result-object v0
check-cast v0, Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;
.line 2
invoke-direct {p0, v0}, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->makeOrphan(Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;)V
:try_end_16
.catchall {:try_start_3 .. :try_end_16} :catchall_17
goto :goto_7
:catchall_17
move-exception p1
monitor-exit p0
throw p1
.line 3
:cond_1a
monitor-exit p0
return-void
.end method
.method private declared-synchronized maybeAddToExclusives(Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;)Z
.registers 4
.annotation system Ldalvik/annotation/Signature;
value = {
"(",
"Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry<",
"TK;TV;>;)Z"
}
.end annotation
monitor-enter p0
.line 1
:try_start_1
iget-boolean v0, p1, Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;->isOrphan:Z
if-nez v0, :cond_13
iget v0, p1, Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;->clientCount:I
if-nez v0, :cond_13
.line 2
iget-object v0, p0, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->mExclusiveEntries:Lcom/facebook/imagepipeline/cache/CountingLruMap;
iget-object v1, p1, Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;->key:Ljava/lang/Object;
invoke-virtual {v0, v1, p1}, Lcom/facebook/imagepipeline/cache/CountingLruMap;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
:try_end_10
.catchall {:try_start_1 .. :try_end_10} :catchall_16
const/4 p1, 0x1
.line 3
monitor-exit p0
return p1
:cond_13
const/4 p1, 0x0
.line 4
monitor-exit p0
return p1
:catchall_16
move-exception p1
monitor-exit p0
throw p1
.end method
.method private maybeClose(Ljava/util/ArrayList;)V
.registers 3
.annotation system Ldalvik/annotation/Signature;
value = {
"(",
"Ljava/util/ArrayList<",
"Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry<",
"TK;TV;>;>;)V"
}
.end annotation
if-eqz p1, :cond_1a
.line 1
invoke-virtual {p1}, Ljava/util/ArrayList;->iterator()Ljava/util/Iterator;
move-result-object p1
:goto_6
invoke-interface {p1}, Ljava/util/Iterator;->hasNext()Z
move-result v0
if-eqz v0, :cond_1a
invoke-interface {p1}, Ljava/util/Iterator;->next()Ljava/lang/Object;
move-result-object v0
check-cast v0, Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;
.line 2
invoke-direct {p0, v0}, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->referenceToClose(Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;)Lcom/facebook/common/references/CloseableReference;
move-result-object v0
invoke-static {v0}, Lcom/facebook/common/references/CloseableReference;->closeSafely(Lcom/facebook/common/references/CloseableReference;)V
goto :goto_6
:cond_1a
return-void
.end method
.method private maybeEvictEntries()V
.registers 5
.line 1
monitor-enter p0
.line 2
:try_start_1
iget-object v0, p0, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->mMemoryCacheParams:Lcom/facebook/imagepipeline/cache/MemoryCacheParams;
iget v1, v0, Lcom/facebook/imagepipeline/cache/MemoryCacheParams;->maxEvictionQueueEntries:I
iget v0, v0, Lcom/facebook/imagepipeline/cache/MemoryCacheParams;->maxCacheEntries:I
.line 3
invoke-virtual {p0}, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->getInUseCount()I
move-result v2
sub-int/2addr v0, v2
.line 4
invoke-static {v1, v0}, Ljava/lang/Math;->min(II)I
move-result v0
.line 5
iget-object v1, p0, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->mMemoryCacheParams:Lcom/facebook/imagepipeline/cache/MemoryCacheParams;
iget v2, v1, Lcom/facebook/imagepipeline/cache/MemoryCacheParams;->maxEvictionQueueSize:I
iget v1, v1, Lcom/facebook/imagepipeline/cache/MemoryCacheParams;->maxCacheSize:I
.line 6
invoke-virtual {p0}, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->getInUseSizeInBytes()I
move-result v3
sub-int/2addr v1, v3
.line 7
invoke-static {v2, v1}, Ljava/lang/Math;->min(II)I
move-result v1
.line 8
invoke-direct {p0, v0, v1}, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->trimExclusivelyOwnedEntries(II)Ljava/util/ArrayList;
move-result-object v0
.line 9
invoke-direct {p0, v0}, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->makeOrphans(Ljava/util/ArrayList;)V
.line 10
monitor-exit p0
:try_end_27
.catchall {:try_start_1 .. :try_end_27} :catchall_2e
.line 11
invoke-direct {p0, v0}, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->maybeClose(Ljava/util/ArrayList;)V
.line 12
invoke-direct {p0, v0}, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->maybeNotifyExclusiveEntryRemoval(Ljava/util/ArrayList;)V
return-void
:catchall_2e
move-exception v0
.line 13
:try_start_2f
monitor-exit p0
:try_end_30
.catchall {:try_start_2f .. :try_end_30} :catchall_2e
throw v0
.end method
.method private static maybeNotifyExclusiveEntryInsertion(Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;)V
.registers 3
.annotation system Ldalvik/annotation/Signature;
value = {
"<K:",
"Ljava/lang/Object;",
"V:",
"Ljava/lang/Object;",
">(",
"Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry<",
"TK;TV;>;)V"
}
.end annotation
if-eqz p0, :cond_c
.line 1
iget-object v0, p0, Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;->observer:Lcom/facebook/imagepipeline/cache/CountingMemoryCache$EntryStateObserver;
if-eqz v0, :cond_c
.line 2
iget-object p0, p0, Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;->key:Ljava/lang/Object;
const/4 v1, 0x1
invoke-interface {v0, p0, v1}, Lcom/facebook/imagepipeline/cache/CountingMemoryCache$EntryStateObserver;->onExclusivityChanged(Ljava/lang/Object;Z)V
:cond_c
return-void
.end method
.method private static maybeNotifyExclusiveEntryRemoval(Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;)V
.registers 3
.annotation system Ldalvik/annotation/Signature;
value = {
"<K:",
"Ljava/lang/Object;",
"V:",
"Ljava/lang/Object;",
">(",
"Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry<",
"TK;TV;>;)V"
}
.end annotation
if-eqz p0, :cond_c
.line 3
iget-object v0, p0, Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;->observer:Lcom/facebook/imagepipeline/cache/CountingMemoryCache$EntryStateObserver;
if-eqz v0, :cond_c
.line 4
iget-object p0, p0, Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;->key:Ljava/lang/Object;
const/4 v1, 0x0
invoke-interface {v0, p0, v1}, Lcom/facebook/imagepipeline/cache/CountingMemoryCache$EntryStateObserver;->onExclusivityChanged(Ljava/lang/Object;Z)V
:cond_c
return-void
.end method
.method private maybeNotifyExclusiveEntryRemoval(Ljava/util/ArrayList;)V
.registers 3
.annotation system Ldalvik/annotation/Signature;
value = {
"(",
"Ljava/util/ArrayList<",
"Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry<",
"TK;TV;>;>;)V"
}
.end annotation
if-eqz p1, :cond_16
.line 1
invoke-virtual {p1}, Ljava/util/ArrayList;->iterator()Ljava/util/Iterator;
move-result-object p1
:goto_6
invoke-interface {p1}, Ljava/util/Iterator;->hasNext()Z
move-result v0
if-eqz v0, :cond_16
invoke-interface {p1}, Ljava/util/Iterator;->next()Ljava/lang/Object;
move-result-object v0
check-cast v0, Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;
.line 2
invoke-static {v0}, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->maybeNotifyExclusiveEntryRemoval(Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;)V
goto :goto_6
:cond_16
return-void
.end method
.method private declared-synchronized maybeUpdateCacheParams()V
.registers 6
monitor-enter p0
.line 1
:try_start_1
iget-wide v0, p0, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->mLastCacheParamsCheck:J
iget-object v2, p0, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->mMemoryCacheParams:Lcom/facebook/imagepipeline/cache/MemoryCacheParams;
iget-wide v2, v2, Lcom/facebook/imagepipeline/cache/MemoryCacheParams;->paramsCheckIntervalMs:J
add-long/2addr v0, v2
.line 2
invoke-static {}, Landroid/os/SystemClock;->uptimeMillis()J
move-result-wide v2
:try_end_c
.catchall {:try_start_1 .. :try_end_c} :catchall_24
cmp-long v4, v0, v2
if-lez v4, :cond_12
.line 3
monitor-exit p0
return-void
.line 4
:cond_12
:try_start_12
invoke-static {}, Landroid/os/SystemClock;->uptimeMillis()J
move-result-wide v0
iput-wide v0, p0, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->mLastCacheParamsCheck:J
.line 5
iget-object v0, p0, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->mMemoryCacheParamsSupplier:Lcom/facebook/common/internal/Supplier;
invoke-interface {v0}, Lcom/facebook/common/internal/Supplier;->get()Ljava/lang/Object;
move-result-object v0
check-cast v0, Lcom/facebook/imagepipeline/cache/MemoryCacheParams;
iput-object v0, p0, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->mMemoryCacheParams:Lcom/facebook/imagepipeline/cache/MemoryCacheParams;
:try_end_22
.catchall {:try_start_12 .. :try_end_22} :catchall_24
.line 6
monitor-exit p0
return-void
:catchall_24
move-exception v0
monitor-exit p0
throw v0
.end method
.method private declared-synchronized newClientReference(Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;)Lcom/facebook/common/references/CloseableReference;
.registers 4
.annotation system Ldalvik/annotation/Signature;
value = {
"(",
"Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry<",
"TK;TV;>;)",
"Lcom/facebook/common/references/CloseableReference<",
"TV;>;"
}
.end annotation
monitor-enter p0
.line 1
:try_start_1
invoke-direct {p0, p1}, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->increaseClientCount(Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;)V
.line 2
iget-object v0, p1, Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;->valueRef:Lcom/facebook/common/references/CloseableReference;
.line 3
invoke-virtual {v0}, Lcom/facebook/common/references/CloseableReference;->get()Ljava/lang/Object;
move-result-object v0
new-instance v1, Lcom/facebook/imagepipeline/cache/CountingMemoryCache$2;
invoke-direct {v1, p0, p1}, Lcom/facebook/imagepipeline/cache/CountingMemoryCache$2;-><init>(Lcom/facebook/imagepipeline/cache/CountingMemoryCache;Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;)V
.line 4
invoke-static {v0, v1}, Lcom/facebook/common/references/CloseableReference;->of(Ljava/lang/Object;Lcom/facebook/common/references/ResourceReleaser;)Lcom/facebook/common/references/CloseableReference;
move-result-object p1
:try_end_13
.catchall {:try_start_1 .. :try_end_13} :catchall_15
monitor-exit p0
return-object p1
:catchall_15
move-exception p1
monitor-exit p0
throw p1
.end method
.method private declared-synchronized referenceToClose(Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;)Lcom/facebook/common/references/CloseableReference;
.registers 3
.annotation system Ldalvik/annotation/Signature;
value = {
"(",
"Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry<",
"TK;TV;>;)",
"Lcom/facebook/common/references/CloseableReference<",
"TV;>;"
}
.end annotation
monitor-enter p0
.line 1
:try_start_1
invoke-static {p1}, Lcom/facebook/common/internal/Preconditions;->checkNotNull(Ljava/lang/Object;)Ljava/lang/Object;
.line 2
iget-boolean v0, p1, Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;->isOrphan:Z
if-eqz v0, :cond_f
iget v0, p1, Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;->clientCount:I
if-nez v0, :cond_f
iget-object p1, p1, Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;->valueRef:Lcom/facebook/common/references/CloseableReference;
:try_end_e
.catchall {:try_start_1 .. :try_end_e} :catchall_12
goto :goto_10
:cond_f
const/4 p1, 0x0
:goto_10
monitor-exit p0
return-object p1
:catchall_12
move-exception p1
monitor-exit p0
throw p1
.end method
.method private releaseClientReference(Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;)V
.registers 4
.annotation system Ldalvik/annotation/Signature;
value = {
"(",
"Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry<",
"TK;TV;>;)V"
}
.end annotation
.line 1
invoke-static {p1}, Lcom/facebook/common/internal/Preconditions;->checkNotNull(Ljava/lang/Object;)Ljava/lang/Object;
.line 2
monitor-enter p0
.line 3
:try_start_4
invoke-direct {p0, p1}, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->decreaseClientCount(Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;)V
.line 4
invoke-direct {p0, p1}, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->maybeAddToExclusives(Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;)Z
move-result v0
.line 5
invoke-direct {p0, p1}, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->referenceToClose(Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;)Lcom/facebook/common/references/CloseableReference;
move-result-object v1
.line 6
monitor-exit p0
:try_end_10
.catchall {:try_start_4 .. :try_end_10} :catchall_21
.line 7
invoke-static {v1}, Lcom/facebook/common/references/CloseableReference;->closeSafely(Lcom/facebook/common/references/CloseableReference;)V
if-eqz v0, :cond_16
goto :goto_17
:cond_16
const/4 p1, 0x0
.line 8
:goto_17
invoke-static {p1}, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->maybeNotifyExclusiveEntryInsertion(Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;)V
.line 9
invoke-direct {p0}, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->maybeUpdateCacheParams()V
.line 10
invoke-direct {p0}, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->maybeEvictEntries()V
return-void
:catchall_21
move-exception p1
.line 11
:try_start_22
monitor-exit p0
:try_end_23
.catchall {:try_start_22 .. :try_end_23} :catchall_21
throw p1
.end method
.method private declared-synchronized trimExclusivelyOwnedEntries(II)Ljava/util/ArrayList;
.registers 6
.annotation system Ldalvik/annotation/Signature;
value = {
"(II)",
"Ljava/util/ArrayList<",
"Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry<",
"TK;TV;>;>;"
}
.end annotation
monitor-enter p0
const/4 v0, 0x0
.line 1
:try_start_2
invoke-static {p1, v0}, Ljava/lang/Math;->max(II)I
move-result p1
.line 2
invoke-static {p2, v0}, Ljava/lang/Math;->max(II)I
move-result p2
.line 3
iget-object v0, p0, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->mExclusiveEntries:Lcom/facebook/imagepipeline/cache/CountingLruMap;
invoke-virtual {v0}, Lcom/facebook/imagepipeline/cache/CountingLruMap;->getCount()I
move-result v0
if-gt v0, p1, :cond_1d
iget-object v0, p0, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->mExclusiveEntries:Lcom/facebook/imagepipeline/cache/CountingLruMap;
invoke-virtual {v0}, Lcom/facebook/imagepipeline/cache/CountingLruMap;->getSizeInBytes()I
move-result v0
:try_end_18
.catchall {:try_start_2 .. :try_end_18} :catchall_4a
if-gt v0, p2, :cond_1d
const/4 p1, 0x0
.line 4
monitor-exit p0
return-object p1
.line 5
:cond_1d
:try_start_1d
new-instance v0, Ljava/util/ArrayList;
invoke-direct {v0}, Ljava/util/ArrayList;-><init>()V
.line 6
:goto_22
iget-object v1, p0, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->mExclusiveEntries:Lcom/facebook/imagepipeline/cache/CountingLruMap;
invoke-virtual {v1}, Lcom/facebook/imagepipeline/cache/CountingLruMap;->getCount()I
move-result v1
if-gt v1, p1, :cond_35
iget-object v1, p0, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->mExclusiveEntries:Lcom/facebook/imagepipeline/cache/CountingLruMap;
invoke-virtual {v1}, Lcom/facebook/imagepipeline/cache/CountingLruMap;->getSizeInBytes()I
move-result v1
:try_end_30
.catchall {:try_start_1d .. :try_end_30} :catchall_4a
if-le v1, p2, :cond_33
goto :goto_35
.line 7
:cond_33
monitor-exit p0
return-object v0
.line 8
:cond_35
:goto_35
:try_start_35
iget-object v1, p0, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->mExclusiveEntries:Lcom/facebook/imagepipeline/cache/CountingLruMap;
invoke-virtual {v1}, Lcom/facebook/imagepipeline/cache/CountingLruMap;->getFirstKey()Ljava/lang/Object;
move-result-object v1
.line 9
iget-object v2, p0, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->mExclusiveEntries:Lcom/facebook/imagepipeline/cache/CountingLruMap;
invoke-virtual {v2, v1}, Lcom/facebook/imagepipeline/cache/CountingLruMap;->remove(Ljava/lang/Object;)Ljava/lang/Object;
.line 10
iget-object v2, p0, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->mCachedEntries:Lcom/facebook/imagepipeline/cache/CountingLruMap;
invoke-virtual {v2, v1}, Lcom/facebook/imagepipeline/cache/CountingLruMap;->remove(Ljava/lang/Object;)Ljava/lang/Object;
move-result-object v1
invoke-virtual {v0, v1}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z
:try_end_49
.catchall {:try_start_35 .. :try_end_49} :catchall_4a
goto :goto_22
:catchall_4a
move-exception p1
monitor-exit p0
throw p1
.end method
.method private wrapValueDescriptor(Lcom/facebook/imagepipeline/cache/ValueDescriptor;)Lcom/facebook/imagepipeline/cache/ValueDescriptor;
.registers 3
.annotation system Ldalvik/annotation/Signature;
value = {
"(",
"Lcom/facebook/imagepipeline/cache/ValueDescriptor<",
"TV;>;)",
"Lcom/facebook/imagepipeline/cache/ValueDescriptor<",
"Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry<",
"TK;TV;>;>;"
}
.end annotation
new-instance v0, Lcom/facebook/imagepipeline/cache/CountingMemoryCache$1;
invoke-direct {v0, p0, p1}, Lcom/facebook/imagepipeline/cache/CountingMemoryCache$1;-><init>(Lcom/facebook/imagepipeline/cache/CountingMemoryCache;Lcom/facebook/imagepipeline/cache/ValueDescriptor;)V
return-object v0
.end method
# virtual methods
.method public cache(Ljava/lang/Object;Lcom/facebook/common/references/CloseableReference;)Lcom/facebook/common/references/CloseableReference;
.registers 4
.annotation system Ldalvik/annotation/Signature;
value = {
"(TK;",
"Lcom/facebook/common/references/CloseableReference<",
"TV;>;)",
"Lcom/facebook/common/references/CloseableReference<",
"TV;>;"
}
.end annotation
const/4 v0, 0x0
.line 1
invoke-virtual {p0, p1, p2, v0}, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->cache(Ljava/lang/Object;Lcom/facebook/common/references/CloseableReference;Lcom/facebook/imagepipeline/cache/CountingMemoryCache$EntryStateObserver;)Lcom/facebook/common/references/CloseableReference;
move-result-object p1
return-object p1
.end method
.method public cache(Ljava/lang/Object;Lcom/facebook/common/references/CloseableReference;Lcom/facebook/imagepipeline/cache/CountingMemoryCache$EntryStateObserver;)Lcom/facebook/common/references/CloseableReference;
.registers 8
.annotation system Ldalvik/annotation/Signature;
value = {
"(TK;",
"Lcom/facebook/common/references/CloseableReference<",
"TV;>;",
"Lcom/facebook/imagepipeline/cache/CountingMemoryCache$EntryStateObserver<",
"TK;>;)",
"Lcom/facebook/common/references/CloseableReference<",
"TV;>;"
}
.end annotation
.line 2
invoke-static {p1}, Lcom/facebook/common/internal/Preconditions;->checkNotNull(Ljava/lang/Object;)Ljava/lang/Object;
.line 3
invoke-static {p2}, Lcom/facebook/common/internal/Preconditions;->checkNotNull(Ljava/lang/Object;)Ljava/lang/Object;
.line 4
invoke-direct {p0}, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->maybeUpdateCacheParams()V
.line 5
monitor-enter p0
.line 6
:try_start_a
iget-object v0, p0, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->mExclusiveEntries:Lcom/facebook/imagepipeline/cache/CountingLruMap;
invoke-virtual {v0, p1}, Lcom/facebook/imagepipeline/cache/CountingLruMap;->remove(Ljava/lang/Object;)Ljava/lang/Object;
move-result-object v0
check-cast v0, Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;
.line 7
iget-object v1, p0, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->mCachedEntries:Lcom/facebook/imagepipeline/cache/CountingLruMap;
invoke-virtual {v1, p1}, Lcom/facebook/imagepipeline/cache/CountingLruMap;->remove(Ljava/lang/Object;)Ljava/lang/Object;
move-result-object v1
check-cast v1, Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;
const/4 v2, 0x0
if-eqz v1, :cond_25
.line 8
invoke-direct {p0, v1}, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->makeOrphan(Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;)V
.line 9
invoke-direct {p0, v1}, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->referenceToClose(Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;)Lcom/facebook/common/references/CloseableReference;
move-result-object v1
goto :goto_26
:cond_25
move-object v1, v2
.line 10
:goto_26
invoke-virtual {p2}, Lcom/facebook/common/references/CloseableReference;->get()Ljava/lang/Object;
move-result-object v3
invoke-direct {p0, v3}, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->canCacheNewValue(Ljava/lang/Object;)Z
move-result v3
if-eqz v3, :cond_3d
.line 11
invoke-static {p1, p2, p3}, Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;->of(Ljava/lang/Object;Lcom/facebook/common/references/CloseableReference;Lcom/facebook/imagepipeline/cache/CountingMemoryCache$EntryStateObserver;)Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;
move-result-object p2
.line 12
iget-object p3, p0, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->mCachedEntries:Lcom/facebook/imagepipeline/cache/CountingLruMap;
invoke-virtual {p3, p1, p2}, Lcom/facebook/imagepipeline/cache/CountingLruMap;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
.line 13
invoke-direct {p0, p2}, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->newClientReference(Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;)Lcom/facebook/common/references/CloseableReference;
move-result-object v2
.line 14
:cond_3d
monitor-exit p0
:try_end_3e
.catchall {:try_start_a .. :try_end_3e} :catchall_48
.line 15
invoke-static {v1}, Lcom/facebook/common/references/CloseableReference;->closeSafely(Lcom/facebook/common/references/CloseableReference;)V
.line 16
invoke-static {v0}, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->maybeNotifyExclusiveEntryRemoval(Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;)V
.line 17
invoke-direct {p0}, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->maybeEvictEntries()V
return-object v2
:catchall_48
move-exception p1
.line 18
:try_start_49
monitor-exit p0
:try_end_4a
.catchall {:try_start_49 .. :try_end_4a} :catchall_48
throw p1
.end method
.method public clear()V
.registers 3
.line 1
monitor-enter p0
.line 2
:try_start_1
iget-object v0, p0, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->mExclusiveEntries:Lcom/facebook/imagepipeline/cache/CountingLruMap;
invoke-virtual {v0}, Lcom/facebook/imagepipeline/cache/CountingLruMap;->clear()Ljava/util/ArrayList;
move-result-object v0
.line 3
iget-object v1, p0, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->mCachedEntries:Lcom/facebook/imagepipeline/cache/CountingLruMap;
invoke-virtual {v1}, Lcom/facebook/imagepipeline/cache/CountingLruMap;->clear()Ljava/util/ArrayList;
move-result-object v1
.line 4
invoke-direct {p0, v1}, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->makeOrphans(Ljava/util/ArrayList;)V
.line 5
monitor-exit p0
:try_end_11
.catchall {:try_start_1 .. :try_end_11} :catchall_1b
.line 6
invoke-direct {p0, v1}, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->maybeClose(Ljava/util/ArrayList;)V
.line 7
invoke-direct {p0, v0}, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->maybeNotifyExclusiveEntryRemoval(Ljava/util/ArrayList;)V
.line 8
invoke-direct {p0}, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->maybeUpdateCacheParams()V
return-void
:catchall_1b
move-exception v0
.line 9
:try_start_1c
monitor-exit p0
:try_end_1d
.catchall {:try_start_1c .. :try_end_1d} :catchall_1b
throw v0
.end method
.method public declared-synchronized contains(Lcom/facebook/common/internal/Predicate;)Z
.registers 3
.annotation system Ldalvik/annotation/Signature;
value = {
"(",
"Lcom/facebook/common/internal/Predicate<",
"TK;>;)Z"
}
.end annotation
monitor-enter p0
.line 1
:try_start_1
iget-object v0, p0, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->mCachedEntries:Lcom/facebook/imagepipeline/cache/CountingLruMap;
invoke-virtual {v0, p1}, Lcom/facebook/imagepipeline/cache/CountingLruMap;->getMatchingEntries(Lcom/facebook/common/internal/Predicate;)Ljava/util/ArrayList;
move-result-object p1
invoke-virtual {p1}, Ljava/util/ArrayList;->isEmpty()Z
move-result p1
:try_end_b
.catchall {:try_start_1 .. :try_end_b} :catchall_f
xor-int/lit8 p1, p1, 0x1
monitor-exit p0
return p1
:catchall_f
move-exception p1
monitor-exit p0
throw p1
.end method
.method public declared-synchronized contains(Ljava/lang/Object;)Z
.registers 3
.annotation system Ldalvik/annotation/Signature;
value = {
"(TK;)Z"
}
.end annotation
monitor-enter p0
.line 2
:try_start_1
iget-object v0, p0, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->mCachedEntries:Lcom/facebook/imagepipeline/cache/CountingLruMap;
invoke-virtual {v0, p1}, Lcom/facebook/imagepipeline/cache/CountingLruMap;->contains(Ljava/lang/Object;)Z
move-result p1
:try_end_7
.catchall {:try_start_1 .. :try_end_7} :catchall_9
monitor-exit p0
return p1
:catchall_9
move-exception p1
monitor-exit p0
throw p1
.end method
.method public get(Ljava/lang/Object;)Lcom/facebook/common/references/CloseableReference;
.registers 4
.annotation system Ldalvik/annotation/Signature;
value = {
"(TK;)",
"Lcom/facebook/common/references/CloseableReference<",
"TV;>;"
}
.end annotation
.line 1
invoke-static {p1}, Lcom/facebook/common/internal/Preconditions;->checkNotNull(Ljava/lang/Object;)Ljava/lang/Object;
.line 2
monitor-enter p0
.line 3
:try_start_4
iget-object v0, p0, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->mExclusiveEntries:Lcom/facebook/imagepipeline/cache/CountingLruMap;
invoke-virtual {v0, p1}, Lcom/facebook/imagepipeline/cache/CountingLruMap;->remove(Ljava/lang/Object;)Ljava/lang/Object;
move-result-object v0
check-cast v0, Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;
.line 4
iget-object v1, p0, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->mCachedEntries:Lcom/facebook/imagepipeline/cache/CountingLruMap;
invoke-virtual {v1, p1}, Lcom/facebook/imagepipeline/cache/CountingLruMap;->get(Ljava/lang/Object;)Ljava/lang/Object;
move-result-object p1
check-cast p1, Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;
if-eqz p1, :cond_1b
.line 5
invoke-direct {p0, p1}, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->newClientReference(Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;)Lcom/facebook/common/references/CloseableReference;
move-result-object p1
goto :goto_1c
:cond_1b
const/4 p1, 0x0
.line 6
:goto_1c
monitor-exit p0
:try_end_1d
.catchall {:try_start_4 .. :try_end_1d} :catchall_27
.line 7
invoke-static {v0}, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->maybeNotifyExclusiveEntryRemoval(Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;)V
.line 8
invoke-direct {p0}, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->maybeUpdateCacheParams()V
.line 9
invoke-direct {p0}, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->maybeEvictEntries()V
return-object p1
:catchall_27
move-exception p1
.line 10
:try_start_28
monitor-exit p0
:try_end_29
.catchall {:try_start_28 .. :try_end_29} :catchall_27
throw p1
.end method
.method public declared-synchronized getCount()I
.registers 2
monitor-enter p0
:try_start_1
iget-object v0, p0, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->mCachedEntries:Lcom/facebook/imagepipeline/cache/CountingLruMap;
invoke-virtual {v0}, Lcom/facebook/imagepipeline/cache/CountingLruMap;->getCount()I
move-result v0
:try_end_7
.catchall {:try_start_1 .. :try_end_7} :catchall_9
monitor-exit p0
return v0
:catchall_9
move-exception v0
monitor-exit p0
throw v0
.end method
.method public declared-synchronized getEvictionQueueCount()I
.registers 2
monitor-enter p0
:try_start_1
iget-object v0, p0, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->mExclusiveEntries:Lcom/facebook/imagepipeline/cache/CountingLruMap;
invoke-virtual {v0}, Lcom/facebook/imagepipeline/cache/CountingLruMap;->getCount()I
move-result v0
:try_end_7
.catchall {:try_start_1 .. :try_end_7} :catchall_9
monitor-exit p0
return v0
:catchall_9
move-exception v0
monitor-exit p0
throw v0
.end method
.method public declared-synchronized getEvictionQueueSizeInBytes()I
.registers 2
monitor-enter p0
:try_start_1
iget-object v0, p0, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->mExclusiveEntries:Lcom/facebook/imagepipeline/cache/CountingLruMap;
invoke-virtual {v0}, Lcom/facebook/imagepipeline/cache/CountingLruMap;->getSizeInBytes()I
move-result v0
:try_end_7
.catchall {:try_start_1 .. :try_end_7} :catchall_9
monitor-exit p0
return v0
:catchall_9
move-exception v0
monitor-exit p0
throw v0
.end method
.method public declared-synchronized getInUseCount()I
.registers 3
monitor-enter p0
:try_start_1
iget-object v0, p0, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->mCachedEntries:Lcom/facebook/imagepipeline/cache/CountingLruMap;
invoke-virtual {v0}, Lcom/facebook/imagepipeline/cache/CountingLruMap;->getCount()I
move-result v0
iget-object v1, p0, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->mExclusiveEntries:Lcom/facebook/imagepipeline/cache/CountingLruMap;
invoke-virtual {v1}, Lcom/facebook/imagepipeline/cache/CountingLruMap;->getCount()I
move-result v1
:try_end_d
.catchall {:try_start_1 .. :try_end_d} :catchall_10
sub-int/2addr v0, v1
monitor-exit p0
return v0
:catchall_10
move-exception v0
monitor-exit p0
throw v0
.end method
.method public declared-synchronized getInUseSizeInBytes()I
.registers 3
monitor-enter p0
:try_start_1
iget-object v0, p0, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->mCachedEntries:Lcom/facebook/imagepipeline/cache/CountingLruMap;
invoke-virtual {v0}, Lcom/facebook/imagepipeline/cache/CountingLruMap;->getSizeInBytes()I
move-result v0
iget-object v1, p0, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->mExclusiveEntries:Lcom/facebook/imagepipeline/cache/CountingLruMap;
invoke-virtual {v1}, Lcom/facebook/imagepipeline/cache/CountingLruMap;->getSizeInBytes()I
move-result v1
:try_end_d
.catchall {:try_start_1 .. :try_end_d} :catchall_10
sub-int/2addr v0, v1
monitor-exit p0
return v0
:catchall_10
move-exception v0
monitor-exit p0
throw v0
.end method
.method public declared-synchronized getSizeInBytes()I
.registers 2
monitor-enter p0
:try_start_1
iget-object v0, p0, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->mCachedEntries:Lcom/facebook/imagepipeline/cache/CountingLruMap;
invoke-virtual {v0}, Lcom/facebook/imagepipeline/cache/CountingLruMap;->getSizeInBytes()I
move-result v0
:try_end_7
.catchall {:try_start_1 .. :try_end_7} :catchall_9
monitor-exit p0
return v0
:catchall_9
move-exception v0
monitor-exit p0
throw v0
.end method
.method public removeAll(Lcom/facebook/common/internal/Predicate;)I
.registers 4
.annotation system Ldalvik/annotation/Signature;
value = {
"(",
"Lcom/facebook/common/internal/Predicate<",
"TK;>;)I"
}
.end annotation
.line 1
monitor-enter p0
.line 2
:try_start_1
iget-object v0, p0, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->mExclusiveEntries:Lcom/facebook/imagepipeline/cache/CountingLruMap;
invoke-virtual {v0, p1}, Lcom/facebook/imagepipeline/cache/CountingLruMap;->removeAll(Lcom/facebook/common/internal/Predicate;)Ljava/util/ArrayList;
move-result-object v0
.line 3
iget-object v1, p0, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->mCachedEntries:Lcom/facebook/imagepipeline/cache/CountingLruMap;
invoke-virtual {v1, p1}, Lcom/facebook/imagepipeline/cache/CountingLruMap;->removeAll(Lcom/facebook/common/internal/Predicate;)Ljava/util/ArrayList;
move-result-object p1
.line 4
invoke-direct {p0, p1}, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->makeOrphans(Ljava/util/ArrayList;)V
.line 5
monitor-exit p0
:try_end_11
.catchall {:try_start_1 .. :try_end_11} :catchall_22
.line 6
invoke-direct {p0, p1}, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->maybeClose(Ljava/util/ArrayList;)V
.line 7
invoke-direct {p0, v0}, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->maybeNotifyExclusiveEntryRemoval(Ljava/util/ArrayList;)V
.line 8
invoke-direct {p0}, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->maybeUpdateCacheParams()V
.line 9
invoke-direct {p0}, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->maybeEvictEntries()V
.line 10
invoke-virtual {p1}, Ljava/util/ArrayList;->size()I
move-result p1
return p1
:catchall_22
move-exception p1
.line 11
:try_start_23
monitor-exit p0
:try_end_24
.catchall {:try_start_23 .. :try_end_24} :catchall_22
throw p1
.end method
.method public reuse(Ljava/lang/Object;)Lcom/facebook/common/references/CloseableReference;
.registers 6
.annotation system Ldalvik/annotation/Signature;
value = {
"(TK;)",
"Lcom/facebook/common/references/CloseableReference<",
"TV;>;"
}
.end annotation
.line 1
invoke-static {p1}, Lcom/facebook/common/internal/Preconditions;->checkNotNull(Ljava/lang/Object;)Ljava/lang/Object;
.line 2
monitor-enter p0
.line 3
:try_start_4
iget-object v0, p0, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->mExclusiveEntries:Lcom/facebook/imagepipeline/cache/CountingLruMap;
invoke-virtual {v0, p1}, Lcom/facebook/imagepipeline/cache/CountingLruMap;->remove(Ljava/lang/Object;)Ljava/lang/Object;
move-result-object v0
check-cast v0, Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;
const/4 v1, 0x1
const/4 v2, 0x0
if-eqz v0, :cond_26
.line 4
iget-object v3, p0, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->mCachedEntries:Lcom/facebook/imagepipeline/cache/CountingLruMap;
invoke-virtual {v3, p1}, Lcom/facebook/imagepipeline/cache/CountingLruMap;->remove(Ljava/lang/Object;)Ljava/lang/Object;
move-result-object p1
check-cast p1, Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;
.line 5
invoke-static {p1}, Lcom/facebook/common/internal/Preconditions;->checkNotNull(Ljava/lang/Object;)Ljava/lang/Object;
.line 6
iget v3, p1, Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;->clientCount:I
if-nez v3, :cond_20
const/4 v2, 0x1
:cond_20
invoke-static {v2}, Lcom/facebook/common/internal/Preconditions;->checkState(Z)V
.line 7
iget-object p1, p1, Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;->valueRef:Lcom/facebook/common/references/CloseableReference;
goto :goto_28
:cond_26
const/4 p1, 0x0
const/4 v1, 0x0
.line 8
:goto_28
monitor-exit p0
:try_end_29
.catchall {:try_start_4 .. :try_end_29} :catchall_2f
if-eqz v1, :cond_2e
.line 9
invoke-static {v0}, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->maybeNotifyExclusiveEntryRemoval(Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;)V
:cond_2e
return-object p1
:catchall_2f
move-exception p1
.line 10
:try_start_30
monitor-exit p0
:try_end_31
.catchall {:try_start_30 .. :try_end_31} :catchall_2f
throw p1
.end method
.method public trim(Lcom/facebook/common/memory/MemoryTrimType;)V
.registers 8
.line 1
iget-object v0, p0, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->mCacheTrimStrategy:Lcom/facebook/imagepipeline/cache/CountingMemoryCache$CacheTrimStrategy;
invoke-interface {v0, p1}, Lcom/facebook/imagepipeline/cache/CountingMemoryCache$CacheTrimStrategy;->getTrimRatio(Lcom/facebook/common/memory/MemoryTrimType;)D
move-result-wide v0
.line 2
monitor-enter p0
.line 3
:try_start_7
iget-object p1, p0, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->mCachedEntries:Lcom/facebook/imagepipeline/cache/CountingLruMap;
invoke-virtual {p1}, Lcom/facebook/imagepipeline/cache/CountingLruMap;->getSizeInBytes()I
move-result p1
int-to-double v2, p1
const-wide/high16 v4, 0x3ff0000000000000L # 1.0
sub-double/2addr v4, v0
mul-double v4, v4, v2
double-to-int p1, v4
const/4 v0, 0x0
.line 4
invoke-virtual {p0}, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->getInUseSizeInBytes()I
move-result v1
sub-int/2addr p1, v1
invoke-static {v0, p1}, Ljava/lang/Math;->max(II)I
move-result p1
const v0, 0x7fffffff
.line 5
invoke-direct {p0, v0, p1}, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->trimExclusivelyOwnedEntries(II)Ljava/util/ArrayList;
move-result-object p1
.line 6
invoke-direct {p0, p1}, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->makeOrphans(Ljava/util/ArrayList;)V
.line 7
monitor-exit p0
:try_end_29
.catchall {:try_start_7 .. :try_end_29} :catchall_36
.line 8
invoke-direct {p0, p1}, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->maybeClose(Ljava/util/ArrayList;)V
.line 9
invoke-direct {p0, p1}, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->maybeNotifyExclusiveEntryRemoval(Ljava/util/ArrayList;)V
.line 10
invoke-direct {p0}, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->maybeUpdateCacheParams()V
.line 11
invoke-direct {p0}, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->maybeEvictEntries()V
return-void
:catchall_36
move-exception p1
.line 12
:try_start_37
monitor-exit p0
:try_end_38
.catchall {:try_start_37 .. :try_end_38} :catchall_36
throw p1
.end method