AnimatedFrameCache.smali
.class public Lcom/facebook/imagepipeline/animated/impl/AnimatedFrameCache;
.super Ljava/lang/Object;
.source "SourceFile"
# annotations
.annotation system Ldalvik/annotation/MemberClasses;
value = {
Lcom/facebook/imagepipeline/animated/impl/AnimatedFrameCache$FrameKey;
}
.end annotation
# instance fields
.field private final mBackingCache:Lcom/facebook/imagepipeline/cache/CountingMemoryCache;
.annotation system Ldalvik/annotation/Signature;
value = {
"Lcom/facebook/imagepipeline/cache/CountingMemoryCache<",
"Lcom/facebook/cache/common/CacheKey;",
"Lcom/facebook/imagepipeline/image/CloseableImage;",
">;"
}
.end annotation
.end field
.field private final mEntryStateObserver:Lcom/facebook/imagepipeline/cache/CountingMemoryCache$EntryStateObserver;
.annotation system Ldalvik/annotation/Signature;
value = {
"Lcom/facebook/imagepipeline/cache/CountingMemoryCache$EntryStateObserver<",
"Lcom/facebook/cache/common/CacheKey;",
">;"
}
.end annotation
.end field
.field private final mFreeItemsPool:Ljava/util/LinkedHashSet;
.annotation system Ldalvik/annotation/Signature;
value = {
"Ljava/util/LinkedHashSet<",
"Lcom/facebook/cache/common/CacheKey;",
">;"
}
.end annotation
.end field
.field private final mImageCacheKey:Lcom/facebook/cache/common/CacheKey;
# direct methods
.method public constructor <init>(Lcom/facebook/cache/common/CacheKey;Lcom/facebook/imagepipeline/cache/CountingMemoryCache;)V
.registers 3
.annotation system Ldalvik/annotation/Signature;
value = {
"(",
"Lcom/facebook/cache/common/CacheKey;",
"Lcom/facebook/imagepipeline/cache/CountingMemoryCache<",
"Lcom/facebook/cache/common/CacheKey;",
"Lcom/facebook/imagepipeline/image/CloseableImage;",
">;)V"
}
.end annotation
.line 85
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
.line 86
iput-object p1, p0, Lcom/facebook/imagepipeline/animated/impl/AnimatedFrameCache;->mImageCacheKey:Lcom/facebook/cache/common/CacheKey;
.line 87
iput-object p2, p0, Lcom/facebook/imagepipeline/animated/impl/AnimatedFrameCache;->mBackingCache:Lcom/facebook/imagepipeline/cache/CountingMemoryCache;
.line 88
new-instance p1, Ljava/util/LinkedHashSet;
invoke-direct {p1}, Ljava/util/LinkedHashSet;-><init>()V
iput-object p1, p0, Lcom/facebook/imagepipeline/animated/impl/AnimatedFrameCache;->mFreeItemsPool:Ljava/util/LinkedHashSet;
.line 89
new-instance p1, Lcom/facebook/imagepipeline/animated/impl/AnimatedFrameCache$1;
invoke-direct {p1, p0}, Lcom/facebook/imagepipeline/animated/impl/AnimatedFrameCache$1;-><init>(Lcom/facebook/imagepipeline/animated/impl/AnimatedFrameCache;)V
iput-object p1, p0, Lcom/facebook/imagepipeline/animated/impl/AnimatedFrameCache;->mEntryStateObserver:Lcom/facebook/imagepipeline/cache/CountingMemoryCache$EntryStateObserver;
return-void
.end method
.method private keyFor(I)Lcom/facebook/imagepipeline/animated/impl/AnimatedFrameCache$FrameKey;
.registers 4
.line 172
new-instance v0, Lcom/facebook/imagepipeline/animated/impl/AnimatedFrameCache$FrameKey;
iget-object v1, p0, Lcom/facebook/imagepipeline/animated/impl/AnimatedFrameCache;->mImageCacheKey:Lcom/facebook/cache/common/CacheKey;
invoke-direct {v0, v1, p1}, Lcom/facebook/imagepipeline/animated/impl/AnimatedFrameCache$FrameKey;-><init>(Lcom/facebook/cache/common/CacheKey;I)V
return-object v0
.end method
.method private declared-synchronized popFirstFreeItemKey()Lcom/facebook/cache/common/CacheKey;
.registers 4
monitor-enter p0
const/4 v0, 0x0
.line 163
:try_start_2
iget-object v1, p0, Lcom/facebook/imagepipeline/animated/impl/AnimatedFrameCache;->mFreeItemsPool:Ljava/util/LinkedHashSet;
invoke-virtual {v1}, Ljava/util/LinkedHashSet;->iterator()Ljava/util/Iterator;
move-result-object v1
.line 164
invoke-interface {v1}, Ljava/util/Iterator;->hasNext()Z
move-result v2
if-eqz v2, :cond_17
.line 165
invoke-interface {v1}, Ljava/util/Iterator;->next()Ljava/lang/Object;
move-result-object v0
check-cast v0, Lcom/facebook/cache/common/CacheKey;
.line 166
invoke-interface {v1}, Ljava/util/Iterator;->remove()V
:try_end_17
.catchall {:try_start_2 .. :try_end_17} :catchall_19
.line 168
:cond_17
monitor-exit p0
return-object v0
:catchall_19
move-exception v0
monitor-exit p0
throw v0
.end method
# virtual methods
.method public cache(ILcom/facebook/common/references/CloseableReference;)Lcom/facebook/common/references/CloseableReference;
.registers 5
.annotation system Ldalvik/annotation/Signature;
value = {
"(I",
"Lcom/facebook/common/references/CloseableReference<",
"Lcom/facebook/imagepipeline/image/CloseableImage;",
">;)",
"Lcom/facebook/common/references/CloseableReference<",
"Lcom/facebook/imagepipeline/image/CloseableImage;",
">;"
}
.end annotation
.line 117
iget-object v0, p0, Lcom/facebook/imagepipeline/animated/impl/AnimatedFrameCache;->mBackingCache:Lcom/facebook/imagepipeline/cache/CountingMemoryCache;
invoke-direct {p0, p1}, Lcom/facebook/imagepipeline/animated/impl/AnimatedFrameCache;->keyFor(I)Lcom/facebook/imagepipeline/animated/impl/AnimatedFrameCache$FrameKey;
move-result-object p1
iget-object v1, p0, Lcom/facebook/imagepipeline/animated/impl/AnimatedFrameCache;->mEntryStateObserver:Lcom/facebook/imagepipeline/cache/CountingMemoryCache$EntryStateObserver;
invoke-virtual {v0, p1, p2, v1}, 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 contains(I)Z
.registers 3
.line 134
iget-object v0, p0, Lcom/facebook/imagepipeline/animated/impl/AnimatedFrameCache;->mBackingCache:Lcom/facebook/imagepipeline/cache/CountingMemoryCache;
invoke-direct {p0, p1}, Lcom/facebook/imagepipeline/animated/impl/AnimatedFrameCache;->keyFor(I)Lcom/facebook/imagepipeline/animated/impl/AnimatedFrameCache$FrameKey;
move-result-object p1
invoke-virtual {v0, p1}, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->contains(Ljava/lang/Object;)Z
move-result p1
return p1
.end method
.method public get(I)Lcom/facebook/common/references/CloseableReference;
.registers 3
.annotation system Ldalvik/annotation/Signature;
value = {
"(I)",
"Lcom/facebook/common/references/CloseableReference<",
"Lcom/facebook/imagepipeline/image/CloseableImage;",
">;"
}
.end annotation
.line 127
iget-object v0, p0, Lcom/facebook/imagepipeline/animated/impl/AnimatedFrameCache;->mBackingCache:Lcom/facebook/imagepipeline/cache/CountingMemoryCache;
invoke-direct {p0, p1}, Lcom/facebook/imagepipeline/animated/impl/AnimatedFrameCache;->keyFor(I)Lcom/facebook/imagepipeline/animated/impl/AnimatedFrameCache$FrameKey;
move-result-object p1
invoke-virtual {v0, p1}, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->get(Ljava/lang/Object;)Lcom/facebook/common/references/CloseableReference;
move-result-object p1
return-object p1
.end method
.method public getForReuse()Lcom/facebook/common/references/CloseableReference;
.registers 3
.annotation system Ldalvik/annotation/Signature;
value = {
"()",
"Lcom/facebook/common/references/CloseableReference<",
"Lcom/facebook/imagepipeline/image/CloseableImage;",
">;"
}
.end annotation
.line 149
:cond_0
invoke-direct {p0}, Lcom/facebook/imagepipeline/animated/impl/AnimatedFrameCache;->popFirstFreeItemKey()Lcom/facebook/cache/common/CacheKey;
move-result-object v0
if-nez v0, :cond_8
const/4 v0, 0x0
return-object v0
.line 153
:cond_8
iget-object v1, p0, Lcom/facebook/imagepipeline/animated/impl/AnimatedFrameCache;->mBackingCache:Lcom/facebook/imagepipeline/cache/CountingMemoryCache;
invoke-virtual {v1, v0}, Lcom/facebook/imagepipeline/cache/CountingMemoryCache;->reuse(Ljava/lang/Object;)Lcom/facebook/common/references/CloseableReference;
move-result-object v0
if-eqz v0, :cond_0
return-object v0
.end method
.method public declared-synchronized onReusabilityChange(Lcom/facebook/cache/common/CacheKey;Z)V
.registers 3
monitor-enter p0
if-eqz p2, :cond_a
.line 99
:try_start_3
iget-object p2, p0, Lcom/facebook/imagepipeline/animated/impl/AnimatedFrameCache;->mFreeItemsPool:Ljava/util/LinkedHashSet;
invoke-virtual {p2, p1}, Ljava/util/LinkedHashSet;->add(Ljava/lang/Object;)Z
:try_end_8
.catchall {:try_start_3 .. :try_end_8} :catchall_11
monitor-exit p0
return-void
.line 101
:cond_a
:try_start_a
iget-object p2, p0, Lcom/facebook/imagepipeline/animated/impl/AnimatedFrameCache;->mFreeItemsPool:Ljava/util/LinkedHashSet;
invoke-virtual {p2, p1}, Ljava/util/LinkedHashSet;->remove(Ljava/lang/Object;)Z
:try_end_f
.catchall {:try_start_a .. :try_end_f} :catchall_11
.line 103
monitor-exit p0
return-void
:catchall_11
move-exception p1
monitor-exit p0
throw p1
.end method