apkfuckery/com.discord/smali/com/facebook/imagepipeline/cache/CountingMemoryCache.smali
2019-02-04 21:05:16 +01:00

1915 lines
68 KiB
Smali

.class public Lcom/facebook/imagepipeline/cache/CountingMemoryCache;
.super Ljava/lang/Object;
.source "CountingMemoryCache.java"
# 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
.annotation build Ljavax/annotation/concurrent/ThreadSafe;
.end annotation
# static fields
.field static final PARAMS_INTERCHECK_INTERVAL_MS:J
.annotation build Lcom/facebook/common/internal/VisibleForTesting;
.end annotation
.end field
# instance fields
.field private final mCacheTrimStrategy:Lcom/facebook/imagepipeline/cache/CountingMemoryCache$CacheTrimStrategy;
.field 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
.annotation build Ljavax/annotation/concurrent/GuardedBy;
value = "this"
.end annotation
.end field
.field 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
.annotation build Ljavax/annotation/concurrent/GuardedBy;
value = "this"
.end annotation
.end field
.field private mLastCacheParamsCheck:J
.annotation build Ljavax/annotation/concurrent/GuardedBy;
value = "this"
.end annotation
.end field
.field protected mMemoryCacheParams:Lcom/facebook/imagepipeline/cache/MemoryCacheParams;
.annotation build Ljavax/annotation/concurrent/GuardedBy;
value = "this"
.end annotation
.end field
.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 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 static constructor <clinit>()V
.locals 4
.prologue
sget-object v0, Ljava/util/concurrent/TimeUnit;->MINUTES:Ljava/util/concurrent/TimeUnit;
const-wide/16 v2, 0x5
invoke-virtual {v0, v2, v3}, Ljava/util/concurrent/TimeUnit;->toMillis(J)J
move-result-wide v0
sput-wide v0, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->PARAMS_INTERCHECK_INTERVAL_MS:J
return-void
.end method
.method public constructor <init>(Lcom/facebook/imagepipeline/cache/ValueDescriptor;Lcom/facebook/imagepipeline/cache/CountingMemoryCache$CacheTrimStrategy;Lcom/facebook/common/internal/Supplier;)V
.locals 2
.param p2, "cacheTrimStrategy" # Lcom/facebook/imagepipeline/cache/CountingMemoryCache$CacheTrimStrategy;
.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
.prologue
.local p0, "this":Lcom/facebook/imagepipeline/cache/CountingMemoryCache;, "Lcom/facebook/imagepipeline/cache/CountingMemoryCache<TK;TV;>;"
.local p1, "valueDescriptor":Lcom/facebook/imagepipeline/cache/ValueDescriptor;, "Lcom/facebook/imagepipeline/cache/ValueDescriptor<TV;>;"
.local p3, "memoryCacheParamsSupplier":Lcom/facebook/common/internal/Supplier;, "Lcom/facebook/common/internal/Supplier<Lcom/facebook/imagepipeline/cache/MemoryCacheParams;>;"
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
iput-object p1, p0, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->mValueDescriptor:Lcom/facebook/imagepipeline/cache/ValueDescriptor;
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;
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;->mCachedEntries:Lcom/facebook/imagepipeline/cache/CountingLruMap;
iput-object p2, p0, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->mCacheTrimStrategy:Lcom/facebook/imagepipeline/cache/CountingMemoryCache$CacheTrimStrategy;
iput-object p3, p0, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->mMemoryCacheParamsSupplier:Lcom/facebook/common/internal/Supplier;
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;
invoke-static {}, Landroid/os/SystemClock;->uptimeMillis()J
move-result-wide v0
iput-wide v0, p0, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->mLastCacheParamsCheck:J
return-void
.end method
.method static synthetic access$000(Lcom/facebook/imagepipeline/cache/CountingMemoryCache;Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;)V
.locals 0
.param p0, "x0" # Lcom/facebook/imagepipeline/cache/CountingMemoryCache;
.param p1, "x1" # Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;
.prologue
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
.locals 3
.annotation system Ldalvik/annotation/Signature;
value = {
"(TV;)Z"
}
.end annotation
.prologue
.local p0, "this":Lcom/facebook/imagepipeline/cache/CountingMemoryCache;, "Lcom/facebook/imagepipeline/cache/CountingMemoryCache<TK;TV;>;"
.local p1, "value":Ljava/lang/Object;, "TV;"
monitor-enter p0
:try_start_0
iget-object v1, p0, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->mValueDescriptor:Lcom/facebook/imagepipeline/cache/ValueDescriptor;
invoke-interface {v1, p1}, Lcom/facebook/imagepipeline/cache/ValueDescriptor;->getSizeInBytes(Ljava/lang/Object;)I
move-result v0
.local v0, "newValueSize":I
iget-object v1, p0, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->mMemoryCacheParams:Lcom/facebook/imagepipeline/cache/MemoryCacheParams;
iget v1, v1, Lcom/facebook/imagepipeline/cache/MemoryCacheParams;->maxCacheEntrySize:I
if-gt v0, v1, :cond_0
invoke-virtual {p0}, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->getInUseCount()I
move-result v1
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
add-int/lit8 v2, v2, -0x1
if-gt v1, v2, :cond_0
invoke-virtual {p0}, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->getInUseSizeInBytes()I
move-result v1
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_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
sub-int/2addr v2, v0
if-gt v1, v2, :cond_0
const/4 v1, 0x1
:goto_0
monitor-exit p0
return v1
:cond_0
const/4 v1, 0x0
goto :goto_0
.end local v0 # "newValueSize":I
:catchall_0
move-exception v1
monitor-exit p0
throw v1
.end method
.method private declared-synchronized decreaseClientCount(Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;)V
.locals 1
.annotation system Ldalvik/annotation/Signature;
value = {
"(",
"Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry",
"<TK;TV;>;)V"
}
.end annotation
.prologue
.local p0, "this":Lcom/facebook/imagepipeline/cache/CountingMemoryCache;, "Lcom/facebook/imagepipeline/cache/CountingMemoryCache<TK;TV;>;"
.local p1, "entry":Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;, "Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry<TK;TV;>;"
monitor-enter p0
:try_start_0
invoke-static {p1}, Lcom/facebook/common/internal/Preconditions;->checkNotNull(Ljava/lang/Object;)Ljava/lang/Object;
iget v0, p1, Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;->clientCount:I
if-lez v0, :cond_0
const/4 v0, 0x1
:goto_0
invoke-static {v0}, Lcom/facebook/common/internal/Preconditions;->checkState(Z)V
iget v0, p1, Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;->clientCount:I
add-int/lit8 v0, v0, -0x1
iput v0, p1, Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;->clientCount:I
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
monitor-exit p0
return-void
:cond_0
const/4 v0, 0x0
goto :goto_0
:catchall_0
move-exception v0
monitor-exit p0
throw v0
.end method
.method private declared-synchronized increaseClientCount(Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;)V
.locals 1
.annotation system Ldalvik/annotation/Signature;
value = {
"(",
"Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry",
"<TK;TV;>;)V"
}
.end annotation
.prologue
.local p0, "this":Lcom/facebook/imagepipeline/cache/CountingMemoryCache;, "Lcom/facebook/imagepipeline/cache/CountingMemoryCache<TK;TV;>;"
.local p1, "entry":Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;, "Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry<TK;TV;>;"
monitor-enter p0
:try_start_0
invoke-static {p1}, Lcom/facebook/common/internal/Preconditions;->checkNotNull(Ljava/lang/Object;)Ljava/lang/Object;
iget-boolean v0, p1, Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;->isOrphan:Z
if-nez v0, :cond_0
const/4 v0, 0x1
:goto_0
invoke-static {v0}, Lcom/facebook/common/internal/Preconditions;->checkState(Z)V
iget v0, p1, Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;->clientCount:I
add-int/lit8 v0, v0, 0x1
iput v0, p1, Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;->clientCount:I
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
monitor-exit p0
return-void
:cond_0
const/4 v0, 0x0
goto :goto_0
:catchall_0
move-exception v0
monitor-exit p0
throw v0
.end method
.method private declared-synchronized makeOrphan(Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;)V
.locals 2
.annotation system Ldalvik/annotation/Signature;
value = {
"(",
"Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry",
"<TK;TV;>;)V"
}
.end annotation
.prologue
.local p0, "this":Lcom/facebook/imagepipeline/cache/CountingMemoryCache;, "Lcom/facebook/imagepipeline/cache/CountingMemoryCache<TK;TV;>;"
.local p1, "entry":Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;, "Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry<TK;TV;>;"
const/4 v0, 0x1
monitor-enter p0
:try_start_0
invoke-static {p1}, Lcom/facebook/common/internal/Preconditions;->checkNotNull(Ljava/lang/Object;)Ljava/lang/Object;
iget-boolean v1, p1, Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;->isOrphan:Z
if-nez v1, :cond_0
:goto_0
invoke-static {v0}, Lcom/facebook/common/internal/Preconditions;->checkState(Z)V
const/4 v0, 0x1
iput-boolean v0, p1, Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;->isOrphan:Z
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
monitor-exit p0
return-void
:cond_0
const/4 v0, 0x0
goto :goto_0
:catchall_0
move-exception v0
monitor-exit p0
throw v0
.end method
.method private declared-synchronized makeOrphans(Ljava/util/ArrayList;)V
.locals 3
.param p1 # Ljava/util/ArrayList;
.annotation runtime Ljavax/annotation/Nullable;
.end annotation
.end param
.annotation system Ldalvik/annotation/Signature;
value = {
"(",
"Ljava/util/ArrayList",
"<",
"Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry",
"<TK;TV;>;>;)V"
}
.end annotation
.prologue
.local p0, "this":Lcom/facebook/imagepipeline/cache/CountingMemoryCache;, "Lcom/facebook/imagepipeline/cache/CountingMemoryCache<TK;TV;>;"
.local p1, "oldEntries":Ljava/util/ArrayList;, "Ljava/util/ArrayList<Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry<TK;TV;>;>;"
monitor-enter p0
if-eqz p1, :cond_0
:try_start_0
invoke-virtual {p1}, Ljava/util/ArrayList;->iterator()Ljava/util/Iterator;
move-result-object v1
:goto_0
invoke-interface {v1}, Ljava/util/Iterator;->hasNext()Z
move-result v2
if-eqz v2, :cond_0
invoke-interface {v1}, Ljava/util/Iterator;->next()Ljava/lang/Object;
move-result-object v0
check-cast v0, Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;
.local v0, "oldEntry":Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;, "Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry<TK;TV;>;"
invoke-direct {p0, v0}, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->makeOrphan(Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;)V
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
goto :goto_0
.end local v0 # "oldEntry":Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;, "Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry<TK;TV;>;"
:catchall_0
move-exception v1
monitor-exit p0
throw v1
:cond_0
monitor-exit p0
return-void
.end method
.method private declared-synchronized maybeAddToExclusives(Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;)Z
.locals 2
.annotation system Ldalvik/annotation/Signature;
value = {
"(",
"Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry",
"<TK;TV;>;)Z"
}
.end annotation
.prologue
.local p0, "this":Lcom/facebook/imagepipeline/cache/CountingMemoryCache;, "Lcom/facebook/imagepipeline/cache/CountingMemoryCache<TK;TV;>;"
.local p1, "entry":Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;, "Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry<TK;TV;>;"
monitor-enter p0
:try_start_0
iget-boolean v0, p1, Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;->isOrphan:Z
if-nez v0, :cond_0
iget v0, p1, Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;->clientCount:I
if-nez v0, :cond_0
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_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
const/4 v0, 0x1
:goto_0
monitor-exit p0
return v0
:cond_0
const/4 v0, 0x0
goto :goto_0
:catchall_0
move-exception v0
monitor-exit p0
throw v0
.end method
.method private maybeClose(Ljava/util/ArrayList;)V
.locals 3
.param p1 # Ljava/util/ArrayList;
.annotation runtime Ljavax/annotation/Nullable;
.end annotation
.end param
.annotation system Ldalvik/annotation/Signature;
value = {
"(",
"Ljava/util/ArrayList",
"<",
"Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry",
"<TK;TV;>;>;)V"
}
.end annotation
.prologue
.local p0, "this":Lcom/facebook/imagepipeline/cache/CountingMemoryCache;, "Lcom/facebook/imagepipeline/cache/CountingMemoryCache<TK;TV;>;"
.local p1, "oldEntries":Ljava/util/ArrayList;, "Ljava/util/ArrayList<Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry<TK;TV;>;>;"
if-eqz p1, :cond_0
invoke-virtual {p1}, Ljava/util/ArrayList;->iterator()Ljava/util/Iterator;
move-result-object v1
:goto_0
invoke-interface {v1}, Ljava/util/Iterator;->hasNext()Z
move-result v2
if-eqz v2, :cond_0
invoke-interface {v1}, Ljava/util/Iterator;->next()Ljava/lang/Object;
move-result-object v0
check-cast v0, Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;
.local v0, "oldEntry":Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;, "Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry<TK;TV;>;"
invoke-direct {p0, v0}, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->referenceToClose(Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;)Lcom/facebook/common/references/CloseableReference;
move-result-object v2
invoke-static {v2}, Lcom/facebook/common/references/CloseableReference;->closeSafely(Lcom/facebook/common/references/CloseableReference;)V
goto :goto_0
.end local v0 # "oldEntry":Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;, "Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry<TK;TV;>;"
:cond_0
return-void
.end method
.method private maybeEvictEntries()V
.locals 6
.prologue
.local p0, "this":Lcom/facebook/imagepipeline/cache/CountingMemoryCache;, "Lcom/facebook/imagepipeline/cache/CountingMemoryCache<TK;TV;>;"
monitor-enter p0
:try_start_0
iget-object v3, p0, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->mMemoryCacheParams:Lcom/facebook/imagepipeline/cache/MemoryCacheParams;
iget v3, v3, Lcom/facebook/imagepipeline/cache/MemoryCacheParams;->maxEvictionQueueEntries:I
iget-object v4, p0, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->mMemoryCacheParams:Lcom/facebook/imagepipeline/cache/MemoryCacheParams;
iget v4, v4, Lcom/facebook/imagepipeline/cache/MemoryCacheParams;->maxCacheEntries:I
invoke-virtual {p0}, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->getInUseCount()I
move-result v5
sub-int/2addr v4, v5
invoke-static {v3, v4}, Ljava/lang/Math;->min(II)I
move-result v0
.local v0, "maxCount":I
iget-object v3, p0, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->mMemoryCacheParams:Lcom/facebook/imagepipeline/cache/MemoryCacheParams;
iget v3, v3, Lcom/facebook/imagepipeline/cache/MemoryCacheParams;->maxEvictionQueueSize:I
iget-object v4, p0, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->mMemoryCacheParams:Lcom/facebook/imagepipeline/cache/MemoryCacheParams;
iget v4, v4, Lcom/facebook/imagepipeline/cache/MemoryCacheParams;->maxCacheSize:I
invoke-virtual {p0}, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->getInUseSizeInBytes()I
move-result v5
sub-int/2addr v4, v5
invoke-static {v3, v4}, Ljava/lang/Math;->min(II)I
move-result v1
.local v1, "maxSize":I
invoke-direct {p0, v0, v1}, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->trimExclusivelyOwnedEntries(II)Ljava/util/ArrayList;
move-result-object v2
.local v2, "oldEntries":Ljava/util/ArrayList;, "Ljava/util/ArrayList<Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry<TK;TV;>;>;"
invoke-direct {p0, v2}, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->makeOrphans(Ljava/util/ArrayList;)V
monitor-exit p0
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
invoke-direct {p0, v2}, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->maybeClose(Ljava/util/ArrayList;)V
invoke-direct {p0, v2}, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->maybeNotifyExclusiveEntryRemoval(Ljava/util/ArrayList;)V
return-void
.end local v0 # "maxCount":I
.end local v1 # "maxSize":I
.end local v2 # "oldEntries":Ljava/util/ArrayList;, "Ljava/util/ArrayList<Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry<TK;TV;>;>;"
:catchall_0
move-exception v3
:try_start_1
monitor-exit p0
:try_end_1
.catchall {:try_start_1 .. :try_end_1} :catchall_0
throw v3
.end method
.method private static maybeNotifyExclusiveEntryInsertion(Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;)V
.locals 3
.param p0 # Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;
.annotation runtime Ljavax/annotation/Nullable;
.end annotation
.end param
.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
.prologue
.local p0, "entry":Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;, "Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry<TK;TV;>;"
if-eqz p0, :cond_0
iget-object v0, p0, Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;->observer:Lcom/facebook/imagepipeline/cache/CountingMemoryCache$EntryStateObserver;
if-eqz v0, :cond_0
iget-object v0, p0, Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;->observer:Lcom/facebook/imagepipeline/cache/CountingMemoryCache$EntryStateObserver;
iget-object v1, p0, Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;->key:Ljava/lang/Object;
const/4 v2, 0x1
invoke-interface {v0, v1, v2}, Lcom/facebook/imagepipeline/cache/CountingMemoryCache$EntryStateObserver;->onExclusivityChanged(Ljava/lang/Object;Z)V
:cond_0
return-void
.end method
.method private static maybeNotifyExclusiveEntryRemoval(Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;)V
.locals 3
.param p0 # Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;
.annotation runtime Ljavax/annotation/Nullable;
.end annotation
.end param
.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
.prologue
.local p0, "entry":Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;, "Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry<TK;TV;>;"
if-eqz p0, :cond_0
iget-object v0, p0, Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;->observer:Lcom/facebook/imagepipeline/cache/CountingMemoryCache$EntryStateObserver;
if-eqz v0, :cond_0
iget-object v0, p0, Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;->observer:Lcom/facebook/imagepipeline/cache/CountingMemoryCache$EntryStateObserver;
iget-object v1, p0, Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;->key:Ljava/lang/Object;
const/4 v2, 0x0
invoke-interface {v0, v1, v2}, Lcom/facebook/imagepipeline/cache/CountingMemoryCache$EntryStateObserver;->onExclusivityChanged(Ljava/lang/Object;Z)V
:cond_0
return-void
.end method
.method private maybeNotifyExclusiveEntryRemoval(Ljava/util/ArrayList;)V
.locals 3
.param p1 # Ljava/util/ArrayList;
.annotation runtime Ljavax/annotation/Nullable;
.end annotation
.end param
.annotation system Ldalvik/annotation/Signature;
value = {
"(",
"Ljava/util/ArrayList",
"<",
"Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry",
"<TK;TV;>;>;)V"
}
.end annotation
.prologue
.local p0, "this":Lcom/facebook/imagepipeline/cache/CountingMemoryCache;, "Lcom/facebook/imagepipeline/cache/CountingMemoryCache<TK;TV;>;"
.local p1, "entries":Ljava/util/ArrayList;, "Ljava/util/ArrayList<Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry<TK;TV;>;>;"
if-eqz p1, :cond_0
invoke-virtual {p1}, Ljava/util/ArrayList;->iterator()Ljava/util/Iterator;
move-result-object v1
:goto_0
invoke-interface {v1}, Ljava/util/Iterator;->hasNext()Z
move-result v2
if-eqz v2, :cond_0
invoke-interface {v1}, Ljava/util/Iterator;->next()Ljava/lang/Object;
move-result-object v0
check-cast v0, Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;
.local v0, "entry":Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;, "Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry<TK;TV;>;"
invoke-static {v0}, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->maybeNotifyExclusiveEntryRemoval(Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;)V
goto :goto_0
.end local v0 # "entry":Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;, "Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry<TK;TV;>;"
:cond_0
return-void
.end method
.method private declared-synchronized maybeUpdateCacheParams()V
.locals 4
.prologue
.local p0, "this":Lcom/facebook/imagepipeline/cache/CountingMemoryCache;, "Lcom/facebook/imagepipeline/cache/CountingMemoryCache<TK;TV;>;"
monitor-enter p0
:try_start_0
iget-wide v0, p0, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->mLastCacheParamsCheck:J
sget-wide v2, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->PARAMS_INTERCHECK_INTERVAL_MS:J
add-long/2addr v0, v2
invoke-static {}, Landroid/os/SystemClock;->uptimeMillis()J
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
move-result-wide v2
cmp-long v0, v0, v2
if-lez v0, :cond_0
:goto_0
monitor-exit p0
return-void
:cond_0
:try_start_1
invoke-static {}, Landroid/os/SystemClock;->uptimeMillis()J
move-result-wide v0
iput-wide v0, p0, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->mLastCacheParamsCheck:J
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_1
.catchall {:try_start_1 .. :try_end_1} :catchall_0
goto :goto_0
:catchall_0
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;
.locals 2
.annotation system Ldalvik/annotation/Signature;
value = {
"(",
"Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry",
"<TK;TV;>;)",
"Lcom/facebook/common/references/CloseableReference",
"<TV;>;"
}
.end annotation
.prologue
.local p0, "this":Lcom/facebook/imagepipeline/cache/CountingMemoryCache;, "Lcom/facebook/imagepipeline/cache/CountingMemoryCache<TK;TV;>;"
.local p1, "entry":Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;, "Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry<TK;TV;>;"
monitor-enter p0
:try_start_0
invoke-direct {p0, p1}, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->increaseClientCount(Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;)V
iget-object v0, p1, Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;->valueRef:Lcom/facebook/common/references/CloseableReference;
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
invoke-static {v0, v1}, Lcom/facebook/common/references/CloseableReference;->of(Ljava/lang/Object;Lcom/facebook/common/references/ResourceReleaser;)Lcom/facebook/common/references/CloseableReference;
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
move-result-object v0
monitor-exit p0
return-object v0
:catchall_0
move-exception v0
monitor-exit p0
throw v0
.end method
.method private declared-synchronized referenceToClose(Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;)Lcom/facebook/common/references/CloseableReference;
.locals 1
.annotation system Ldalvik/annotation/Signature;
value = {
"(",
"Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry",
"<TK;TV;>;)",
"Lcom/facebook/common/references/CloseableReference",
"<TV;>;"
}
.end annotation
.annotation runtime Ljavax/annotation/Nullable;
.end annotation
.prologue
.local p0, "this":Lcom/facebook/imagepipeline/cache/CountingMemoryCache;, "Lcom/facebook/imagepipeline/cache/CountingMemoryCache<TK;TV;>;"
.local p1, "entry":Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;, "Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry<TK;TV;>;"
monitor-enter p0
:try_start_0
invoke-static {p1}, Lcom/facebook/common/internal/Preconditions;->checkNotNull(Ljava/lang/Object;)Ljava/lang/Object;
iget-boolean v0, p1, Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;->isOrphan:Z
if-eqz v0, :cond_0
iget v0, p1, Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;->clientCount:I
if-nez v0, :cond_0
iget-object v0, p1, Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;->valueRef:Lcom/facebook/common/references/CloseableReference;
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
:goto_0
monitor-exit p0
return-object v0
:cond_0
const/4 v0, 0x0
goto :goto_0
:catchall_0
move-exception v0
monitor-exit p0
throw v0
.end method
.method private releaseClientReference(Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;)V
.locals 3
.annotation system Ldalvik/annotation/Signature;
value = {
"(",
"Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry",
"<TK;TV;>;)V"
}
.end annotation
.prologue
.local p0, "this":Lcom/facebook/imagepipeline/cache/CountingMemoryCache;, "Lcom/facebook/imagepipeline/cache/CountingMemoryCache<TK;TV;>;"
.local p1, "entry":Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;, "Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry<TK;TV;>;"
invoke-static {p1}, Lcom/facebook/common/internal/Preconditions;->checkNotNull(Ljava/lang/Object;)Ljava/lang/Object;
monitor-enter p0
:try_start_0
invoke-direct {p0, p1}, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->decreaseClientCount(Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;)V
invoke-direct {p0, p1}, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->maybeAddToExclusives(Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;)Z
move-result v0
.local v0, "isExclusiveAdded":Z
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
.local v1, "oldRefToClose":Lcom/facebook/common/references/CloseableReference;, "Lcom/facebook/common/references/CloseableReference<TV;>;"
monitor-exit p0
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
invoke-static {v1}, Lcom/facebook/common/references/CloseableReference;->closeSafely(Lcom/facebook/common/references/CloseableReference;)V
if-eqz v0, :cond_0
.end local p1 # "entry":Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;, "Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry<TK;TV;>;"
:goto_0
invoke-static {p1}, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->maybeNotifyExclusiveEntryInsertion(Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;)V
invoke-direct {p0}, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->maybeUpdateCacheParams()V
invoke-direct {p0}, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->maybeEvictEntries()V
return-void
.end local v0 # "isExclusiveAdded":Z
.end local v1 # "oldRefToClose":Lcom/facebook/common/references/CloseableReference;, "Lcom/facebook/common/references/CloseableReference<TV;>;"
.restart local p1 # "entry":Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;, "Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry<TK;TV;>;"
:catchall_0
move-exception v2
:try_start_1
monitor-exit p0
:try_end_1
.catchall {:try_start_1 .. :try_end_1} :catchall_0
throw v2
.restart local v0 # "isExclusiveAdded":Z
.restart local v1 # "oldRefToClose":Lcom/facebook/common/references/CloseableReference;, "Lcom/facebook/common/references/CloseableReference<TV;>;"
:cond_0
const/4 p1, 0x0
goto :goto_0
.end method
.method private declared-synchronized trimExclusivelyOwnedEntries(II)Ljava/util/ArrayList;
.locals 3
.param p1, "count" # I
.param p2, "size" # I
.annotation system Ldalvik/annotation/Signature;
value = {
"(II)",
"Ljava/util/ArrayList",
"<",
"Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry",
"<TK;TV;>;>;"
}
.end annotation
.annotation runtime Ljavax/annotation/Nullable;
.end annotation
.prologue
.local p0, "this":Lcom/facebook/imagepipeline/cache/CountingMemoryCache;, "Lcom/facebook/imagepipeline/cache/CountingMemoryCache<TK;TV;>;"
monitor-enter p0
const/4 v2, 0x0
:try_start_0
invoke-static {p1, v2}, Ljava/lang/Math;->max(II)I
move-result p1
const/4 v2, 0x0
invoke-static {p2, v2}, Ljava/lang/Math;->max(II)I
move-result p2
iget-object v2, p0, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->mExclusiveEntries:Lcom/facebook/imagepipeline/cache/CountingLruMap;
invoke-virtual {v2}, Lcom/facebook/imagepipeline/cache/CountingLruMap;->getCount()I
move-result v2
if-gt v2, p1, :cond_1
iget-object v2, p0, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->mExclusiveEntries:Lcom/facebook/imagepipeline/cache/CountingLruMap;
invoke-virtual {v2}, Lcom/facebook/imagepipeline/cache/CountingLruMap;->getSizeInBytes()I
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
move-result v2
if-gt v2, p2, :cond_1
const/4 v1, 0x0
:cond_0
monitor-exit p0
return-object v1
:cond_1
:try_start_1
new-instance v1, Ljava/util/ArrayList;
invoke-direct {v1}, Ljava/util/ArrayList;-><init>()V
.local v1, "oldEntries":Ljava/util/ArrayList;, "Ljava/util/ArrayList<Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry<TK;TV;>;>;"
:goto_0
iget-object v2, p0, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->mExclusiveEntries:Lcom/facebook/imagepipeline/cache/CountingLruMap;
invoke-virtual {v2}, Lcom/facebook/imagepipeline/cache/CountingLruMap;->getCount()I
move-result v2
if-gt v2, p1, :cond_2
iget-object v2, p0, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->mExclusiveEntries:Lcom/facebook/imagepipeline/cache/CountingLruMap;
invoke-virtual {v2}, Lcom/facebook/imagepipeline/cache/CountingLruMap;->getSizeInBytes()I
move-result v2
if-le v2, p2, :cond_0
:cond_2
iget-object v2, p0, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->mExclusiveEntries:Lcom/facebook/imagepipeline/cache/CountingLruMap;
invoke-virtual {v2}, Lcom/facebook/imagepipeline/cache/CountingLruMap;->getFirstKey()Ljava/lang/Object;
move-result-object v0
.local v0, "key":Ljava/lang/Object;, "TK;"
iget-object v2, p0, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->mExclusiveEntries:Lcom/facebook/imagepipeline/cache/CountingLruMap;
invoke-virtual {v2, v0}, Lcom/facebook/imagepipeline/cache/CountingLruMap;->remove(Ljava/lang/Object;)Ljava/lang/Object;
iget-object v2, p0, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->mCachedEntries:Lcom/facebook/imagepipeline/cache/CountingLruMap;
invoke-virtual {v2, v0}, Lcom/facebook/imagepipeline/cache/CountingLruMap;->remove(Ljava/lang/Object;)Ljava/lang/Object;
move-result-object v2
invoke-virtual {v1, v2}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z
:try_end_1
.catchall {:try_start_1 .. :try_end_1} :catchall_0
goto :goto_0
.end local v0 # "key":Ljava/lang/Object;, "TK;"
.end local v1 # "oldEntries":Ljava/util/ArrayList;, "Ljava/util/ArrayList<Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry<TK;TV;>;>;"
:catchall_0
move-exception v2
monitor-exit p0
throw v2
.end method
.method private wrapValueDescriptor(Lcom/facebook/imagepipeline/cache/ValueDescriptor;)Lcom/facebook/imagepipeline/cache/ValueDescriptor;
.locals 1
.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
.prologue
.local p0, "this":Lcom/facebook/imagepipeline/cache/CountingMemoryCache;, "Lcom/facebook/imagepipeline/cache/CountingMemoryCache<TK;TV;>;"
.local p1, "evictableValueDescriptor":Lcom/facebook/imagepipeline/cache/ValueDescriptor;, "Lcom/facebook/imagepipeline/cache/ValueDescriptor<TV;>;"
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;
.locals 1
.annotation system Ldalvik/annotation/Signature;
value = {
"(TK;",
"Lcom/facebook/common/references/CloseableReference",
"<TV;>;)",
"Lcom/facebook/common/references/CloseableReference",
"<TV;>;"
}
.end annotation
.prologue
.local p0, "this":Lcom/facebook/imagepipeline/cache/CountingMemoryCache;, "Lcom/facebook/imagepipeline/cache/CountingMemoryCache<TK;TV;>;"
.local p1, "key":Ljava/lang/Object;, "TK;"
.local p2, "valueRef":Lcom/facebook/common/references/CloseableReference;, "Lcom/facebook/common/references/CloseableReference<TV;>;"
const/4 v0, 0x0
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 v0
return-object v0
.end method
.method public cache(Ljava/lang/Object;Lcom/facebook/common/references/CloseableReference;Lcom/facebook/imagepipeline/cache/CountingMemoryCache$EntryStateObserver;)Lcom/facebook/common/references/CloseableReference;
.locals 6
.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
.prologue
.local p0, "this":Lcom/facebook/imagepipeline/cache/CountingMemoryCache;, "Lcom/facebook/imagepipeline/cache/CountingMemoryCache<TK;TV;>;"
.local p1, "key":Ljava/lang/Object;, "TK;"
.local p2, "valueRef":Lcom/facebook/common/references/CloseableReference;, "Lcom/facebook/common/references/CloseableReference<TV;>;"
.local p3, "observer":Lcom/facebook/imagepipeline/cache/CountingMemoryCache$EntryStateObserver;, "Lcom/facebook/imagepipeline/cache/CountingMemoryCache$EntryStateObserver<TK;>;"
invoke-static {p1}, Lcom/facebook/common/internal/Preconditions;->checkNotNull(Ljava/lang/Object;)Ljava/lang/Object;
invoke-static {p2}, Lcom/facebook/common/internal/Preconditions;->checkNotNull(Ljava/lang/Object;)Ljava/lang/Object;
invoke-direct {p0}, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->maybeUpdateCacheParams()V
const/4 v4, 0x0
.local v4, "oldRefToClose":Lcom/facebook/common/references/CloseableReference;, "Lcom/facebook/common/references/CloseableReference<TV;>;"
const/4 v0, 0x0
.local v0, "clientRef":Lcom/facebook/common/references/CloseableReference;, "Lcom/facebook/common/references/CloseableReference<TV;>;"
monitor-enter p0
:try_start_0
iget-object v5, p0, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->mExclusiveEntries:Lcom/facebook/imagepipeline/cache/CountingLruMap;
invoke-virtual {v5, p1}, Lcom/facebook/imagepipeline/cache/CountingLruMap;->remove(Ljava/lang/Object;)Ljava/lang/Object;
move-result-object v3
check-cast v3, Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;
.local v3, "oldExclusive":Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;, "Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry<TK;TV;>;"
iget-object v5, p0, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->mCachedEntries:Lcom/facebook/imagepipeline/cache/CountingLruMap;
invoke-virtual {v5, p1}, Lcom/facebook/imagepipeline/cache/CountingLruMap;->remove(Ljava/lang/Object;)Ljava/lang/Object;
move-result-object v2
check-cast v2, Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;
.local v2, "oldEntry":Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;, "Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry<TK;TV;>;"
if-eqz v2, :cond_0
invoke-direct {p0, v2}, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->makeOrphan(Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;)V
invoke-direct {p0, v2}, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->referenceToClose(Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;)Lcom/facebook/common/references/CloseableReference;
move-result-object v4
:cond_0
invoke-virtual {p2}, Lcom/facebook/common/references/CloseableReference;->get()Ljava/lang/Object;
move-result-object v5
invoke-direct {p0, v5}, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->canCacheNewValue(Ljava/lang/Object;)Z
move-result v5
if-eqz v5, :cond_1
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 v1
.local v1, "newEntry":Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;, "Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry<TK;TV;>;"
iget-object v5, p0, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->mCachedEntries:Lcom/facebook/imagepipeline/cache/CountingLruMap;
invoke-virtual {v5, p1, v1}, Lcom/facebook/imagepipeline/cache/CountingLruMap;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
invoke-direct {p0, v1}, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->newClientReference(Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;)Lcom/facebook/common/references/CloseableReference;
move-result-object v0
.end local v1 # "newEntry":Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;, "Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry<TK;TV;>;"
:cond_1
monitor-exit p0
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
invoke-static {v4}, Lcom/facebook/common/references/CloseableReference;->closeSafely(Lcom/facebook/common/references/CloseableReference;)V
invoke-static {v3}, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->maybeNotifyExclusiveEntryRemoval(Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;)V
invoke-direct {p0}, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->maybeEvictEntries()V
return-object v0
.end local v2 # "oldEntry":Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;, "Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry<TK;TV;>;"
.end local v3 # "oldExclusive":Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;, "Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry<TK;TV;>;"
:catchall_0
move-exception v5
:try_start_1
monitor-exit p0
:try_end_1
.catchall {:try_start_1 .. :try_end_1} :catchall_0
throw v5
.end method
.method public clear()V
.locals 3
.prologue
.local p0, "this":Lcom/facebook/imagepipeline/cache/CountingMemoryCache;, "Lcom/facebook/imagepipeline/cache/CountingMemoryCache<TK;TV;>;"
monitor-enter p0
:try_start_0
iget-object v2, p0, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->mExclusiveEntries:Lcom/facebook/imagepipeline/cache/CountingLruMap;
invoke-virtual {v2}, Lcom/facebook/imagepipeline/cache/CountingLruMap;->clear()Ljava/util/ArrayList;
move-result-object v1
.local v1, "oldExclusives":Ljava/util/ArrayList;, "Ljava/util/ArrayList<Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry<TK;TV;>;>;"
iget-object v2, p0, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->mCachedEntries:Lcom/facebook/imagepipeline/cache/CountingLruMap;
invoke-virtual {v2}, Lcom/facebook/imagepipeline/cache/CountingLruMap;->clear()Ljava/util/ArrayList;
move-result-object v0
.local v0, "oldEntries":Ljava/util/ArrayList;, "Ljava/util/ArrayList<Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry<TK;TV;>;>;"
invoke-direct {p0, v0}, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->makeOrphans(Ljava/util/ArrayList;)V
monitor-exit p0
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
invoke-direct {p0, v0}, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->maybeClose(Ljava/util/ArrayList;)V
invoke-direct {p0, v1}, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->maybeNotifyExclusiveEntryRemoval(Ljava/util/ArrayList;)V
invoke-direct {p0}, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->maybeUpdateCacheParams()V
return-void
.end local v0 # "oldEntries":Ljava/util/ArrayList;, "Ljava/util/ArrayList<Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry<TK;TV;>;>;"
.end local v1 # "oldExclusives":Ljava/util/ArrayList;, "Ljava/util/ArrayList<Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry<TK;TV;>;>;"
:catchall_0
move-exception v2
:try_start_1
monitor-exit p0
:try_end_1
.catchall {:try_start_1 .. :try_end_1} :catchall_0
throw v2
.end method
.method public declared-synchronized contains(Lcom/android/internal/util/Predicate;)Z
.locals 1
.annotation system Ldalvik/annotation/Signature;
value = {
"(",
"Lcom/android/internal/util/Predicate",
"<TK;>;)Z"
}
.end annotation
.prologue
.local p0, "this":Lcom/facebook/imagepipeline/cache/CountingMemoryCache;, "Lcom/facebook/imagepipeline/cache/CountingMemoryCache<TK;TV;>;"
.local p1, "predicate":Lcom/android/internal/util/Predicate;, "Lcom/android/internal/util/Predicate<TK;>;"
monitor-enter p0
:try_start_0
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/android/internal/util/Predicate;)Ljava/util/ArrayList;
move-result-object v0
invoke-virtual {v0}, Ljava/util/ArrayList;->isEmpty()Z
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
move-result v0
if-nez v0, :cond_0
const/4 v0, 0x1
:goto_0
monitor-exit p0
return v0
:cond_0
const/4 v0, 0x0
goto :goto_0
:catchall_0
move-exception v0
monitor-exit p0
throw v0
.end method
.method public get(Ljava/lang/Object;)Lcom/facebook/common/references/CloseableReference;
.locals 4
.annotation system Ldalvik/annotation/Signature;
value = {
"(TK;)",
"Lcom/facebook/common/references/CloseableReference",
"<TV;>;"
}
.end annotation
.annotation runtime Ljavax/annotation/Nullable;
.end annotation
.prologue
.local p0, "this":Lcom/facebook/imagepipeline/cache/CountingMemoryCache;, "Lcom/facebook/imagepipeline/cache/CountingMemoryCache<TK;TV;>;"
.local p1, "key":Ljava/lang/Object;, "TK;"
invoke-static {p1}, Lcom/facebook/common/internal/Preconditions;->checkNotNull(Ljava/lang/Object;)Ljava/lang/Object;
const/4 v0, 0x0
.local v0, "clientRef":Lcom/facebook/common/references/CloseableReference;, "Lcom/facebook/common/references/CloseableReference<TV;>;"
monitor-enter p0
:try_start_0
iget-object v3, p0, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->mExclusiveEntries:Lcom/facebook/imagepipeline/cache/CountingLruMap;
invoke-virtual {v3, p1}, Lcom/facebook/imagepipeline/cache/CountingLruMap;->remove(Ljava/lang/Object;)Ljava/lang/Object;
move-result-object v2
check-cast v2, Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;
.local v2, "oldExclusive":Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;, "Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry<TK;TV;>;"
iget-object v3, p0, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->mCachedEntries:Lcom/facebook/imagepipeline/cache/CountingLruMap;
invoke-virtual {v3, p1}, Lcom/facebook/imagepipeline/cache/CountingLruMap;->get(Ljava/lang/Object;)Ljava/lang/Object;
move-result-object v1
check-cast v1, Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;
.local v1, "entry":Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;, "Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry<TK;TV;>;"
if-eqz v1, :cond_0
invoke-direct {p0, v1}, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->newClientReference(Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;)Lcom/facebook/common/references/CloseableReference;
move-result-object v0
:cond_0
monitor-exit p0
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
invoke-static {v2}, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->maybeNotifyExclusiveEntryRemoval(Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;)V
invoke-direct {p0}, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->maybeUpdateCacheParams()V
invoke-direct {p0}, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->maybeEvictEntries()V
return-object v0
.end local v1 # "entry":Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;, "Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry<TK;TV;>;"
.end local v2 # "oldExclusive":Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;, "Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry<TK;TV;>;"
:catchall_0
move-exception v3
:try_start_1
monitor-exit p0
:try_end_1
.catchall {:try_start_1 .. :try_end_1} :catchall_0
throw v3
.end method
.method public declared-synchronized getCount()I
.locals 1
.prologue
.local p0, "this":Lcom/facebook/imagepipeline/cache/CountingMemoryCache;, "Lcom/facebook/imagepipeline/cache/CountingMemoryCache<TK;TV;>;"
monitor-enter p0
:try_start_0
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
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
move-result v0
monitor-exit p0
return v0
:catchall_0
move-exception v0
monitor-exit p0
throw v0
.end method
.method public declared-synchronized getEvictionQueueCount()I
.locals 1
.prologue
.local p0, "this":Lcom/facebook/imagepipeline/cache/CountingMemoryCache;, "Lcom/facebook/imagepipeline/cache/CountingMemoryCache<TK;TV;>;"
monitor-enter p0
:try_start_0
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
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
move-result v0
monitor-exit p0
return v0
:catchall_0
move-exception v0
monitor-exit p0
throw v0
.end method
.method public declared-synchronized getEvictionQueueSizeInBytes()I
.locals 1
.prologue
.local p0, "this":Lcom/facebook/imagepipeline/cache/CountingMemoryCache;, "Lcom/facebook/imagepipeline/cache/CountingMemoryCache<TK;TV;>;"
monitor-enter p0
:try_start_0
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
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
move-result v0
monitor-exit p0
return v0
:catchall_0
move-exception v0
monitor-exit p0
throw v0
.end method
.method public declared-synchronized getInUseCount()I
.locals 2
.prologue
.local p0, "this":Lcom/facebook/imagepipeline/cache/CountingMemoryCache;, "Lcom/facebook/imagepipeline/cache/CountingMemoryCache<TK;TV;>;"
monitor-enter p0
:try_start_0
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
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
move-result v1
sub-int/2addr v0, v1
monitor-exit p0
return v0
:catchall_0
move-exception v0
monitor-exit p0
throw v0
.end method
.method public declared-synchronized getInUseSizeInBytes()I
.locals 2
.prologue
.local p0, "this":Lcom/facebook/imagepipeline/cache/CountingMemoryCache;, "Lcom/facebook/imagepipeline/cache/CountingMemoryCache<TK;TV;>;"
monitor-enter p0
:try_start_0
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
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
move-result v1
sub-int/2addr v0, v1
monitor-exit p0
return v0
:catchall_0
move-exception v0
monitor-exit p0
throw v0
.end method
.method public declared-synchronized getSizeInBytes()I
.locals 1
.prologue
.local p0, "this":Lcom/facebook/imagepipeline/cache/CountingMemoryCache;, "Lcom/facebook/imagepipeline/cache/CountingMemoryCache<TK;TV;>;"
monitor-enter p0
:try_start_0
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
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
move-result v0
monitor-exit p0
return v0
:catchall_0
move-exception v0
monitor-exit p0
throw v0
.end method
.method public removeAll(Lcom/android/internal/util/Predicate;)I
.locals 3
.annotation system Ldalvik/annotation/Signature;
value = {
"(",
"Lcom/android/internal/util/Predicate",
"<TK;>;)I"
}
.end annotation
.prologue
.local p0, "this":Lcom/facebook/imagepipeline/cache/CountingMemoryCache;, "Lcom/facebook/imagepipeline/cache/CountingMemoryCache<TK;TV;>;"
.local p1, "predicate":Lcom/android/internal/util/Predicate;, "Lcom/android/internal/util/Predicate<TK;>;"
monitor-enter p0
:try_start_0
iget-object v2, p0, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->mExclusiveEntries:Lcom/facebook/imagepipeline/cache/CountingLruMap;
invoke-virtual {v2, p1}, Lcom/facebook/imagepipeline/cache/CountingLruMap;->removeAll(Lcom/android/internal/util/Predicate;)Ljava/util/ArrayList;
move-result-object v1
.local v1, "oldExclusives":Ljava/util/ArrayList;, "Ljava/util/ArrayList<Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry<TK;TV;>;>;"
iget-object v2, p0, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->mCachedEntries:Lcom/facebook/imagepipeline/cache/CountingLruMap;
invoke-virtual {v2, p1}, Lcom/facebook/imagepipeline/cache/CountingLruMap;->removeAll(Lcom/android/internal/util/Predicate;)Ljava/util/ArrayList;
move-result-object v0
.local v0, "oldEntries":Ljava/util/ArrayList;, "Ljava/util/ArrayList<Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry<TK;TV;>;>;"
invoke-direct {p0, v0}, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->makeOrphans(Ljava/util/ArrayList;)V
monitor-exit p0
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
invoke-direct {p0, v0}, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->maybeClose(Ljava/util/ArrayList;)V
invoke-direct {p0, v1}, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->maybeNotifyExclusiveEntryRemoval(Ljava/util/ArrayList;)V
invoke-direct {p0}, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->maybeUpdateCacheParams()V
invoke-direct {p0}, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->maybeEvictEntries()V
invoke-virtual {v0}, Ljava/util/ArrayList;->size()I
move-result v2
return v2
.end local v0 # "oldEntries":Ljava/util/ArrayList;, "Ljava/util/ArrayList<Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry<TK;TV;>;>;"
.end local v1 # "oldExclusives":Ljava/util/ArrayList;, "Ljava/util/ArrayList<Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry<TK;TV;>;>;"
:catchall_0
move-exception v2
:try_start_1
monitor-exit p0
:try_end_1
.catchall {:try_start_1 .. :try_end_1} :catchall_0
throw v2
.end method
.method public reuse(Ljava/lang/Object;)Lcom/facebook/common/references/CloseableReference;
.locals 6
.annotation system Ldalvik/annotation/Signature;
value = {
"(TK;)",
"Lcom/facebook/common/references/CloseableReference",
"<TV;>;"
}
.end annotation
.annotation runtime Ljavax/annotation/Nullable;
.end annotation
.prologue
.local p0, "this":Lcom/facebook/imagepipeline/cache/CountingMemoryCache;, "Lcom/facebook/imagepipeline/cache/CountingMemoryCache<TK;TV;>;"
.local p1, "key":Ljava/lang/Object;, "TK;"
invoke-static {p1}, Lcom/facebook/common/internal/Preconditions;->checkNotNull(Ljava/lang/Object;)Ljava/lang/Object;
const/4 v1, 0x0
.local v1, "clientRef":Lcom/facebook/common/references/CloseableReference;, "Lcom/facebook/common/references/CloseableReference<TV;>;"
const/4 v4, 0x0
.local v4, "removed":Z
const/4 v3, 0x0
.local v3, "oldExclusive":Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;, "Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry<TK;TV;>;"
monitor-enter p0
:try_start_0
iget-object v5, p0, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->mExclusiveEntries:Lcom/facebook/imagepipeline/cache/CountingLruMap;
invoke-virtual {v5, p1}, Lcom/facebook/imagepipeline/cache/CountingLruMap;->remove(Ljava/lang/Object;)Ljava/lang/Object;
move-result-object v5
move-object v0, v5
check-cast v0, Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;
move-object v3, v0
if-eqz v3, :cond_0
iget-object v5, p0, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->mCachedEntries:Lcom/facebook/imagepipeline/cache/CountingLruMap;
invoke-virtual {v5, p1}, Lcom/facebook/imagepipeline/cache/CountingLruMap;->remove(Ljava/lang/Object;)Ljava/lang/Object;
move-result-object v2
check-cast v2, Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;
.local v2, "entry":Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;, "Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry<TK;TV;>;"
invoke-static {v2}, Lcom/facebook/common/internal/Preconditions;->checkNotNull(Ljava/lang/Object;)Ljava/lang/Object;
iget v5, v2, Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;->clientCount:I
if-nez v5, :cond_2
const/4 v5, 0x1
:goto_0
invoke-static {v5}, Lcom/facebook/common/internal/Preconditions;->checkState(Z)V
iget-object v1, v2, Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;->valueRef:Lcom/facebook/common/references/CloseableReference;
const/4 v4, 0x1
.end local v2 # "entry":Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;, "Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry<TK;TV;>;"
:cond_0
monitor-exit p0
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
if-eqz v4, :cond_1
invoke-static {v3}, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->maybeNotifyExclusiveEntryRemoval(Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;)V
:cond_1
return-object v1
.restart local v2 # "entry":Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;, "Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry<TK;TV;>;"
:cond_2
const/4 v5, 0x0
goto :goto_0
.end local v2 # "entry":Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry;, "Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry<TK;TV;>;"
:catchall_0
move-exception v5
:try_start_1
monitor-exit p0
:try_end_1
.catchall {:try_start_1 .. :try_end_1} :catchall_0
throw v5
.end method
.method public trim(Lcom/facebook/common/memory/MemoryTrimType;)V
.locals 10
.param p1, "trimType" # Lcom/facebook/common/memory/MemoryTrimType;
.prologue
.local p0, "this":Lcom/facebook/imagepipeline/cache/CountingMemoryCache;, "Lcom/facebook/imagepipeline/cache/CountingMemoryCache<TK;TV;>;"
iget-object v3, p0, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->mCacheTrimStrategy:Lcom/facebook/imagepipeline/cache/CountingMemoryCache$CacheTrimStrategy;
invoke-interface {v3, p1}, Lcom/facebook/imagepipeline/cache/CountingMemoryCache$CacheTrimStrategy;->getTrimRatio(Lcom/facebook/common/memory/MemoryTrimType;)D
move-result-wide v4
.local v4, "trimRatio":D
monitor-enter p0
:try_start_0
iget-object v3, p0, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->mCachedEntries:Lcom/facebook/imagepipeline/cache/CountingLruMap;
invoke-virtual {v3}, Lcom/facebook/imagepipeline/cache/CountingLruMap;->getSizeInBytes()I
move-result v3
int-to-double v6, v3
const-wide/high16 v8, 0x3ff0000000000000L # 1.0
sub-double/2addr v8, v4
mul-double/2addr v6, v8
double-to-int v1, v6
.local v1, "targetCacheSize":I
const/4 v3, 0x0
invoke-virtual {p0}, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->getInUseSizeInBytes()I
move-result v6
sub-int v6, v1, v6
invoke-static {v3, v6}, Ljava/lang/Math;->max(II)I
move-result v2
.local v2, "targetEvictionQueueSize":I
const v3, 0x7fffffff
invoke-direct {p0, v3, v2}, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->trimExclusivelyOwnedEntries(II)Ljava/util/ArrayList;
move-result-object v0
.local v0, "oldEntries":Ljava/util/ArrayList;, "Ljava/util/ArrayList<Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry<TK;TV;>;>;"
invoke-direct {p0, v0}, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->makeOrphans(Ljava/util/ArrayList;)V
monitor-exit p0
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
invoke-direct {p0, v0}, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->maybeClose(Ljava/util/ArrayList;)V
invoke-direct {p0, v0}, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->maybeNotifyExclusiveEntryRemoval(Ljava/util/ArrayList;)V
invoke-direct {p0}, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->maybeUpdateCacheParams()V
invoke-direct {p0}, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->maybeEvictEntries()V
return-void
.end local v0 # "oldEntries":Ljava/util/ArrayList;, "Ljava/util/ArrayList<Lcom/facebook/imagepipeline/cache/CountingMemoryCache$Entry<TK;TV;>;>;"
.end local v1 # "targetCacheSize":I
.end local v2 # "targetEvictionQueueSize":I
:catchall_0
move-exception v3
:try_start_1
monitor-exit p0
:try_end_1
.catchall {:try_start_1 .. :try_end_1} :catchall_0
throw v3
.end method