Bucket.smali
.class Lcom/facebook/imagepipeline/memory/Bucket;
.super Ljava/lang/Object;
.source "Bucket.java"
# annotations
.annotation system Ldalvik/annotation/Signature;
value = {
"<V:",
"Ljava/lang/Object;",
">",
"Ljava/lang/Object;"
}
.end annotation
# static fields
.field private static final TAG:Ljava/lang/String; = "BUCKET"
# instance fields
.field private final mFixBucketsReinitialization:Z
.field final mFreeList:Ljava/util/Queue;
.field private mInUseLength:I
.field public final mItemSize:I
.field public final mMaxLength:I
# direct methods
.method public constructor <init>(IIIZ)V
.registers 8
.annotation system Ldalvik/annotation/MethodParameters;
accessFlags = {
0x0,
0x0,
0x0,
0x0
}
names = {
"itemSize",
"maxLength",
"inUseLength",
"fixBucketsReinitialization"
}
.end annotation
.line 62
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
const/4 v0, 0x1
const/4 v1, 0x0
if-lez p1, :cond_9
move v2, v0
goto :goto_a
:cond_9
move v2, v1
.line 63
:goto_a
invoke-static {v2}, Lcom/facebook/common/internal/Preconditions;->checkState(Z)V
if-ltz p2, :cond_11
move v2, v0
goto :goto_12
:cond_11
move v2, v1
.line 64
:goto_12
invoke-static {v2}, Lcom/facebook/common/internal/Preconditions;->checkState(Z)V
if-ltz p3, :cond_18
goto :goto_19
:cond_18
move v0, v1
.line 65
:goto_19
invoke-static {v0}, Lcom/facebook/common/internal/Preconditions;->checkState(Z)V
.line 67
iput p1, p0, Lcom/facebook/imagepipeline/memory/Bucket;->mItemSize:I
.line 68
iput p2, p0, Lcom/facebook/imagepipeline/memory/Bucket;->mMaxLength:I
.line 69
new-instance p1, Ljava/util/LinkedList;
invoke-direct {p1}, Ljava/util/LinkedList;-><init>()V
iput-object p1, p0, Lcom/facebook/imagepipeline/memory/Bucket;->mFreeList:Ljava/util/Queue;
.line 70
iput p3, p0, Lcom/facebook/imagepipeline/memory/Bucket;->mInUseLength:I
.line 72
iput-boolean p4, p0, Lcom/facebook/imagepipeline/memory/Bucket;->mFixBucketsReinitialization:Z
return-void
.end method
# virtual methods
.method addToFreeList(Ljava/lang/Object;)V
.registers 3
.annotation system Ldalvik/annotation/MethodParameters;
accessFlags = {
0x0
}
names = {
"value"
}
.end annotation
.annotation system Ldalvik/annotation/Signature;
value = {
"(TV;)V"
}
.end annotation
.line 146
iget-object v0, p0, Lcom/facebook/imagepipeline/memory/Bucket;->mFreeList:Ljava/util/Queue;
invoke-interface {v0, p1}, Ljava/util/Queue;->add(Ljava/lang/Object;)Z
return-void
.end method
.method public decrementInUseCount()V
.registers 3
.line 154
iget v0, p0, Lcom/facebook/imagepipeline/memory/Bucket;->mInUseLength:I
const/4 v1, 0x1
if-lez v0, :cond_7
move v0, v1
goto :goto_8
:cond_7
const/4 v0, 0x0
:goto_8
invoke-static {v0}, Lcom/facebook/common/internal/Preconditions;->checkState(Z)V
.line 155
iget v0, p0, Lcom/facebook/imagepipeline/memory/Bucket;->mInUseLength:I
sub-int/2addr v0, v1
iput v0, p0, Lcom/facebook/imagepipeline/memory/Bucket;->mInUseLength:I
return-void
.end method
.method public get()Ljava/lang/Object;
.registers 3
.annotation system Ldalvik/annotation/Signature;
value = {
"()TV;"
}
.end annotation
.annotation runtime Ljava/lang/Deprecated;
.end annotation
.annotation runtime Ljavax/annotation/Nullable;
.end annotation
.line 96
invoke-virtual {p0}, Lcom/facebook/imagepipeline/memory/Bucket;->pop()Ljava/lang/Object;
move-result-object v0
if-eqz v0, :cond_c
.line 98
iget v1, p0, Lcom/facebook/imagepipeline/memory/Bucket;->mInUseLength:I
add-int/lit8 v1, v1, 0x1
iput v1, p0, Lcom/facebook/imagepipeline/memory/Bucket;->mInUseLength:I
:cond_c
return-object v0
.end method
.method getFreeListSize()I
.registers 2
.line 83
iget-object v0, p0, Lcom/facebook/imagepipeline/memory/Bucket;->mFreeList:Ljava/util/Queue;
invoke-interface {v0}, Ljava/util/Queue;->size()I
move-result v0
return v0
.end method
.method public getInUseCount()I
.registers 2
.line 159
iget v0, p0, Lcom/facebook/imagepipeline/memory/Bucket;->mInUseLength:I
return v0
.end method
.method public incrementInUseCount()V
.registers 2
.line 119
iget v0, p0, Lcom/facebook/imagepipeline/memory/Bucket;->mInUseLength:I
add-int/lit8 v0, v0, 0x1
iput v0, p0, Lcom/facebook/imagepipeline/memory/Bucket;->mInUseLength:I
return-void
.end method
.method public isMaxLengthExceeded()Z
.registers 3
.line 79
iget v0, p0, Lcom/facebook/imagepipeline/memory/Bucket;->mInUseLength:I
invoke-virtual {p0}, Lcom/facebook/imagepipeline/memory/Bucket;->getFreeListSize()I
move-result v1
add-int/2addr v0, v1
iget v1, p0, Lcom/facebook/imagepipeline/memory/Bucket;->mMaxLength:I
if-le v0, v1, :cond_d
const/4 v0, 0x1
goto :goto_e
:cond_d
const/4 v0, 0x0
:goto_e
return v0
.end method
.method public pop()Ljava/lang/Object;
.registers 2
.annotation system Ldalvik/annotation/Signature;
value = {
"()TV;"
}
.end annotation
.annotation runtime Ljavax/annotation/Nullable;
.end annotation
.line 111
iget-object v0, p0, Lcom/facebook/imagepipeline/memory/Bucket;->mFreeList:Ljava/util/Queue;
invoke-interface {v0}, Ljava/util/Queue;->poll()Ljava/lang/Object;
move-result-object v0
return-object v0
.end method
.method public release(Ljava/lang/Object;)V
.registers 5
.annotation system Ldalvik/annotation/MethodParameters;
accessFlags = {
0x0
}
names = {
"value"
}
.end annotation
.annotation system Ldalvik/annotation/Signature;
value = {
"(TV;)V"
}
.end annotation
.line 128
invoke-static {p1}, Lcom/facebook/common/internal/Preconditions;->checkNotNull(Ljava/lang/Object;)Ljava/lang/Object;
.line 129
iget-boolean v0, p0, Lcom/facebook/imagepipeline/memory/Bucket;->mFixBucketsReinitialization:Z
const/4 v1, 0x0
const/4 v2, 0x1
if-eqz v0, :cond_1a
.line 131
iget v0, p0, Lcom/facebook/imagepipeline/memory/Bucket;->mInUseLength:I
if-lez v0, :cond_e
move v1, v2
:cond_e
invoke-static {v1}, Lcom/facebook/common/internal/Preconditions;->checkState(Z)V
.line 132
iget v0, p0, Lcom/facebook/imagepipeline/memory/Bucket;->mInUseLength:I
sub-int/2addr v0, v2
iput v0, p0, Lcom/facebook/imagepipeline/memory/Bucket;->mInUseLength:I
.line 133
invoke-virtual {p0, p1}, Lcom/facebook/imagepipeline/memory/Bucket;->addToFreeList(Ljava/lang/Object;)V
goto :goto_30
.line 136
:cond_1a
iget v0, p0, Lcom/facebook/imagepipeline/memory/Bucket;->mInUseLength:I
if-lez v0, :cond_25
sub-int/2addr v0, v2
.line 137
iput v0, p0, Lcom/facebook/imagepipeline/memory/Bucket;->mInUseLength:I
.line 138
invoke-virtual {p0, p1}, Lcom/facebook/imagepipeline/memory/Bucket;->addToFreeList(Ljava/lang/Object;)V
goto :goto_30
:cond_25
new-array v0, v2, [Ljava/lang/Object;
aput-object p1, v0, v1
const-string p1, "BUCKET"
const-string v1, "Tried to release value %s from an empty bucket!"
.line 140
invoke-static {p1, v1, v0}, Lcom/facebook/common/logging/FLog;->e(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)V
:goto_30
return-void
.end method