You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
468 lines
11 KiB
468 lines
11 KiB
.class public final Lcom/viatech/util/LruCache; |
|
.super Ljava/lang/Object; |
|
.source "LruCache.java" |
|
|
|
|
|
# annotations |
|
.annotation system Ldalvik/annotation/MemberClasses; |
|
value = { |
|
Lcom/viatech/util/LruCache$Entry;, |
|
Lcom/viatech/util/LruCache$OnWeakRemoveListener; |
|
} |
|
.end annotation |
|
|
|
.annotation system Ldalvik/annotation/Signature; |
|
value = { |
|
"<K:", |
|
"Ljava/lang/Object;", |
|
"V:", |
|
"Ljava/lang/Object;", |
|
">", |
|
"Ljava/lang/Object;" |
|
} |
|
.end annotation |
|
|
|
|
|
# instance fields |
|
.field private final mLruMap:Ljava/util/HashMap; |
|
.annotation system Ldalvik/annotation/Signature; |
|
value = { |
|
"Ljava/util/HashMap", |
|
"<TK;TV;>;" |
|
} |
|
.end annotation |
|
.end field |
|
|
|
.field private mOnWeakRemoveListener:Lcom/viatech/util/LruCache$OnWeakRemoveListener; |
|
|
|
.field private mQueue:Ljava/lang/ref/ReferenceQueue; |
|
.annotation system Ldalvik/annotation/Signature; |
|
value = { |
|
"Ljava/lang/ref/ReferenceQueue", |
|
"<TV;>;" |
|
} |
|
.end annotation |
|
.end field |
|
|
|
.field private final mWeakMap:Ljava/util/HashMap; |
|
.annotation system Ldalvik/annotation/Signature; |
|
value = { |
|
"Ljava/util/HashMap", |
|
"<TK;", |
|
"Lcom/viatech/util/LruCache$Entry", |
|
"<TK;TV;>;>;" |
|
} |
|
.end annotation |
|
.end field |
|
|
|
|
|
# direct methods |
|
.method public constructor <init>(I)V |
|
.locals 6 |
|
|
|
.prologue |
|
.line 26 |
|
invoke-direct {p0}, Ljava/lang/Object;-><init>()V |
|
|
|
.line 17 |
|
new-instance v0, Ljava/util/HashMap; |
|
|
|
invoke-direct {v0}, Ljava/util/HashMap;-><init>()V |
|
|
|
iput-object v0, p0, Lcom/viatech/util/LruCache;->mWeakMap:Ljava/util/HashMap; |
|
|
|
.line 19 |
|
new-instance v0, Ljava/lang/ref/ReferenceQueue; |
|
|
|
invoke-direct {v0}, Ljava/lang/ref/ReferenceQueue;-><init>()V |
|
|
|
iput-object v0, p0, Lcom/viatech/util/LruCache;->mQueue:Ljava/lang/ref/ReferenceQueue; |
|
|
|
.line 27 |
|
new-instance v0, Lcom/viatech/util/LruCache$1; |
|
|
|
const/high16 v3, 0x3f400000 # 0.75f |
|
|
|
const/4 v4, 0x1 |
|
|
|
move-object v1, p0 |
|
|
|
move v2, p1 |
|
|
|
move v5, p1 |
|
|
|
invoke-direct/range {v0 .. v5}, Lcom/viatech/util/LruCache$1;-><init>(Lcom/viatech/util/LruCache;IFZI)V |
|
|
|
iput-object v0, p0, Lcom/viatech/util/LruCache;->mLruMap:Ljava/util/HashMap; |
|
|
|
.line 33 |
|
return-void |
|
.end method |
|
|
|
.method private cleanUpWeakMap()V |
|
.locals 3 |
|
|
|
.prologue |
|
.line 45 |
|
iget-object v0, p0, Lcom/viatech/util/LruCache;->mQueue:Ljava/lang/ref/ReferenceQueue; |
|
|
|
invoke-virtual {v0}, Ljava/lang/ref/ReferenceQueue;->poll()Ljava/lang/ref/Reference; |
|
|
|
move-result-object v0 |
|
|
|
check-cast v0, Lcom/viatech/util/LruCache$Entry; |
|
|
|
.line 46 |
|
:goto_0 |
|
if-eqz v0, :cond_1 |
|
|
|
.line 47 |
|
iget-object v1, p0, Lcom/viatech/util/LruCache;->mOnWeakRemoveListener:Lcom/viatech/util/LruCache$OnWeakRemoveListener; |
|
|
|
if-eqz v1, :cond_0 |
|
|
|
.line 48 |
|
iget-object v1, p0, Lcom/viatech/util/LruCache;->mOnWeakRemoveListener:Lcom/viatech/util/LruCache$OnWeakRemoveListener; |
|
|
|
invoke-virtual {v0}, Lcom/viatech/util/LruCache$Entry;->get()Ljava/lang/Object; |
|
|
|
move-result-object v2 |
|
|
|
invoke-interface {v1, v2}, Lcom/viatech/util/LruCache$OnWeakRemoveListener;->onWeakRemove(Ljava/lang/Object;)V |
|
|
|
.line 50 |
|
:cond_0 |
|
iget-object v1, p0, Lcom/viatech/util/LruCache;->mWeakMap:Ljava/util/HashMap; |
|
|
|
iget-object v0, v0, Lcom/viatech/util/LruCache$Entry;->mKey:Ljava/lang/Object; |
|
|
|
invoke-virtual {v1, v0}, Ljava/util/HashMap;->remove(Ljava/lang/Object;)Ljava/lang/Object; |
|
|
|
.line 51 |
|
iget-object v0, p0, Lcom/viatech/util/LruCache;->mQueue:Ljava/lang/ref/ReferenceQueue; |
|
|
|
invoke-virtual {v0}, Ljava/lang/ref/ReferenceQueue;->poll()Ljava/lang/ref/Reference; |
|
|
|
move-result-object v0 |
|
|
|
check-cast v0, Lcom/viatech/util/LruCache$Entry; |
|
|
|
goto :goto_0 |
|
|
|
.line 53 |
|
:cond_1 |
|
return-void |
|
.end method |
|
|
|
|
|
# virtual methods |
|
.method public declared-synchronized clear()V |
|
.locals 1 |
|
|
|
.prologue |
|
.line 76 |
|
monitor-enter p0 |
|
|
|
:try_start_0 |
|
iget-object v0, p0, Lcom/viatech/util/LruCache;->mLruMap:Ljava/util/HashMap; |
|
|
|
invoke-virtual {v0}, Ljava/util/HashMap;->clear()V |
|
|
|
.line 77 |
|
iget-object v0, p0, Lcom/viatech/util/LruCache;->mWeakMap:Ljava/util/HashMap; |
|
|
|
invoke-virtual {v0}, Ljava/util/HashMap;->clear()V |
|
|
|
.line 78 |
|
new-instance v0, Ljava/lang/ref/ReferenceQueue; |
|
|
|
invoke-direct {v0}, Ljava/lang/ref/ReferenceQueue;-><init>()V |
|
|
|
iput-object v0, p0, Lcom/viatech/util/LruCache;->mQueue:Ljava/lang/ref/ReferenceQueue; |
|
:try_end_0 |
|
.catchall {:try_start_0 .. :try_end_0} :catchall_0 |
|
|
|
.line 79 |
|
monitor-exit p0 |
|
|
|
return-void |
|
|
|
.line 76 |
|
:catchall_0 |
|
move-exception v0 |
|
|
|
monitor-exit p0 |
|
|
|
throw v0 |
|
.end method |
|
|
|
.method public declared-synchronized get(Ljava/lang/Object;)Ljava/lang/Object; |
|
.locals 1 |
|
.annotation system Ldalvik/annotation/Signature; |
|
value = { |
|
"(TK;)TV;" |
|
} |
|
.end annotation |
|
|
|
.prologue |
|
.line 68 |
|
monitor-enter p0 |
|
|
|
:try_start_0 |
|
invoke-direct {p0}, Lcom/viatech/util/LruCache;->cleanUpWeakMap()V |
|
|
|
.line 69 |
|
iget-object v0, p0, Lcom/viatech/util/LruCache;->mLruMap:Ljava/util/HashMap; |
|
|
|
invoke-virtual {v0, p1}, Ljava/util/HashMap;->get(Ljava/lang/Object;)Ljava/lang/Object; |
|
:try_end_0 |
|
.catchall {:try_start_0 .. :try_end_0} :catchall_0 |
|
|
|
move-result-object v0 |
|
|
|
.line 70 |
|
if-eqz v0, :cond_0 |
|
|
|
.line 72 |
|
:goto_0 |
|
monitor-exit p0 |
|
|
|
return-object v0 |
|
|
|
.line 71 |
|
:cond_0 |
|
:try_start_1 |
|
iget-object v0, p0, Lcom/viatech/util/LruCache;->mWeakMap:Ljava/util/HashMap; |
|
|
|
invoke-virtual {v0, p1}, Ljava/util/HashMap;->get(Ljava/lang/Object;)Ljava/lang/Object; |
|
|
|
move-result-object v0 |
|
|
|
check-cast v0, Lcom/viatech/util/LruCache$Entry; |
|
|
|
.line 72 |
|
if-nez v0, :cond_1 |
|
|
|
const/4 v0, 0x0 |
|
|
|
goto :goto_0 |
|
|
|
:cond_1 |
|
invoke-virtual {v0}, Lcom/viatech/util/LruCache$Entry;->get()Ljava/lang/Object; |
|
:try_end_1 |
|
.catchall {:try_start_1 .. :try_end_1} :catchall_0 |
|
|
|
move-result-object v0 |
|
|
|
goto :goto_0 |
|
|
|
.line 68 |
|
:catchall_0 |
|
move-exception v0 |
|
|
|
monitor-exit p0 |
|
|
|
throw v0 |
|
.end method |
|
|
|
.method public getSize()I |
|
.locals 1 |
|
|
|
.prologue |
|
.line 96 |
|
iget-object v0, p0, Lcom/viatech/util/LruCache;->mLruMap:Ljava/util/HashMap; |
|
|
|
invoke-virtual {v0}, Ljava/util/HashMap;->size()I |
|
|
|
move-result v0 |
|
|
|
return v0 |
|
.end method |
|
|
|
.method public declared-synchronized keySet()Ljava/util/Set; |
|
.locals 1 |
|
.annotation system Ldalvik/annotation/Signature; |
|
value = { |
|
"()", |
|
"Ljava/util/Set", |
|
"<TK;>;" |
|
} |
|
.end annotation |
|
|
|
.prologue |
|
.line 86 |
|
monitor-enter p0 |
|
|
|
:try_start_0 |
|
iget-object v0, p0, Lcom/viatech/util/LruCache;->mLruMap:Ljava/util/HashMap; |
|
|
|
invoke-virtual {v0}, Ljava/util/HashMap;->keySet()Ljava/util/Set; |
|
: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 public declared-synchronized put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; |
|
.locals 3 |
|
.annotation system Ldalvik/annotation/Signature; |
|
value = { |
|
"(TK;TV;)TV;" |
|
} |
|
.end annotation |
|
|
|
.prologue |
|
.line 60 |
|
monitor-enter p0 |
|
|
|
:try_start_0 |
|
invoke-direct {p0}, Lcom/viatech/util/LruCache;->cleanUpWeakMap()V |
|
|
|
.line 61 |
|
iget-object v0, p0, Lcom/viatech/util/LruCache;->mLruMap:Ljava/util/HashMap; |
|
|
|
invoke-virtual {v0, p1, p2}, Ljava/util/HashMap;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; |
|
|
|
.line 62 |
|
iget-object v0, p0, Lcom/viatech/util/LruCache;->mWeakMap:Ljava/util/HashMap; |
|
|
|
new-instance v1, Lcom/viatech/util/LruCache$Entry; |
|
|
|
iget-object v2, p0, Lcom/viatech/util/LruCache;->mQueue:Ljava/lang/ref/ReferenceQueue; |
|
|
|
invoke-direct {v1, p1, p2, v2}, Lcom/viatech/util/LruCache$Entry;-><init>(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/ref/ReferenceQueue;)V |
|
|
|
invoke-virtual {v0, p1, v1}, Ljava/util/HashMap;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; |
|
|
|
move-result-object v0 |
|
|
|
check-cast v0, Lcom/viatech/util/LruCache$Entry; |
|
:try_end_0 |
|
.catchall {:try_start_0 .. :try_end_0} :catchall_0 |
|
|
|
.line 64 |
|
if-nez v0, :cond_0 |
|
|
|
const/4 v0, 0x0 |
|
|
|
:goto_0 |
|
monitor-exit p0 |
|
|
|
return-object v0 |
|
|
|
:cond_0 |
|
:try_start_1 |
|
invoke-virtual {v0}, Lcom/viatech/util/LruCache$Entry;->get()Ljava/lang/Object; |
|
:try_end_1 |
|
.catchall {:try_start_1 .. :try_end_1} :catchall_0 |
|
|
|
move-result-object v0 |
|
|
|
goto :goto_0 |
|
|
|
.line 60 |
|
:catchall_0 |
|
move-exception v0 |
|
|
|
monitor-exit p0 |
|
|
|
throw v0 |
|
.end method |
|
|
|
.method public declared-synchronized remove(Ljava/lang/Object;)V |
|
.locals 1 |
|
.annotation system Ldalvik/annotation/Signature; |
|
value = { |
|
"(TK;)V" |
|
} |
|
.end annotation |
|
|
|
.prologue |
|
.line 90 |
|
monitor-enter p0 |
|
|
|
:try_start_0 |
|
invoke-direct {p0}, Lcom/viatech/util/LruCache;->cleanUpWeakMap()V |
|
|
|
.line 91 |
|
iget-object v0, p0, Lcom/viatech/util/LruCache;->mLruMap:Ljava/util/HashMap; |
|
|
|
invoke-virtual {v0, p1}, Ljava/util/HashMap;->remove(Ljava/lang/Object;)Ljava/lang/Object; |
|
|
|
.line 92 |
|
iget-object v0, p0, Lcom/viatech/util/LruCache;->mWeakMap:Ljava/util/HashMap; |
|
|
|
invoke-virtual {v0, p1}, Ljava/util/HashMap;->remove(Ljava/lang/Object;)Ljava/lang/Object; |
|
:try_end_0 |
|
.catchall {:try_start_0 .. :try_end_0} :catchall_0 |
|
|
|
.line 93 |
|
monitor-exit p0 |
|
|
|
return-void |
|
|
|
.line 90 |
|
:catchall_0 |
|
move-exception v0 |
|
|
|
monitor-exit p0 |
|
|
|
throw v0 |
|
.end method |
|
|
|
.method public setWeakRemoveListener(Lcom/viatech/util/LruCache$OnWeakRemoveListener;)V |
|
.locals 0 |
|
|
|
.prologue |
|
.line 56 |
|
iput-object p1, p0, Lcom/viatech/util/LruCache;->mOnWeakRemoveListener:Lcom/viatech/util/LruCache$OnWeakRemoveListener; |
|
|
|
.line 57 |
|
return-void |
|
.end method |
|
|
|
.method public declared-synchronized values()Ljava/util/Collection; |
|
.locals 1 |
|
.annotation system Ldalvik/annotation/Signature; |
|
value = { |
|
"()", |
|
"Ljava/util/Collection", |
|
"<TV;>;" |
|
} |
|
.end annotation |
|
|
|
.prologue |
|
.line 82 |
|
monitor-enter p0 |
|
|
|
:try_start_0 |
|
iget-object v0, p0, Lcom/viatech/util/LruCache;->mLruMap:Ljava/util/HashMap; |
|
|
|
invoke-virtual {v0}, Ljava/util/HashMap;->values()Ljava/util/Collection; |
|
: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
|
|
|