SegmentPool.smali
.class public final Lokio/SegmentPool;
.super Ljava/lang/Object;
.source "SegmentPool.kt"
# annotations
.annotation system Ldalvik/annotation/SourceDebugExtension;
value = "SMAP\nSegmentPool.kt\nKotlin\n*S Kotlin\n*F\n+ 1 SegmentPool.kt\nokio/SegmentPool\n+ 2 -Platform.kt\nokio/-Platform\n*L\n1#1,62:1\n28#2:63\n28#2:64\n*E\n*S KotlinDebug\n*F\n+ 1 SegmentPool.kt\nokio/SegmentPool\n*L\n37#1:63\n52#1:64\n*E\n"
.end annotation
.annotation runtime Lkotlin/Metadata;
bv = {
0x1,
0x0,
0x3
}
d1 = {
"\u0000$\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\u0008\u0002\n\u0002\u0010\t\n\u0002\u0008\u0006\n\u0002\u0018\u0002\n\u0002\u0008\u0005\n\u0002\u0010\u0002\n\u0002\u0008\u0003\u0008\u00c1\u0002\u0018\u00002\u00020\u0001B\u0007\u0008\u0002\u00a2\u0006\u0002\u0010\u0002J\u000e\u0010\u0010\u001a\u00020\u00112\u0006\u0010\u0012\u001a\u00020\u000bJ\u0006\u0010\u0013\u001a\u00020\u000bR\u000e\u0010\u0003\u001a\u00020\u0004X\u0086T\u00a2\u0006\u0002\n\u0000R\u001a\u0010\u0005\u001a\u00020\u0004X\u0086\u000e\u00a2\u0006\u000e\n\u0000\u001a\u0004\u0008\u0006\u0010\u0007\"\u0004\u0008\u0008\u0010\tR\u001c\u0010\n\u001a\u0004\u0018\u00010\u000bX\u0086\u000e\u00a2\u0006\u000e\n\u0000\u001a\u0004\u0008\u000c\u0010\r\"\u0004\u0008\u000e\u0010\u000f\u00a8\u0006\u0014"
}
d2 = {
"Lokio/SegmentPool;",
"",
"()V",
"MAX_SIZE",
"",
"byteCount",
"getByteCount",
"()J",
"setByteCount",
"(J)V",
"next",
"Lokio/Segment;",
"getNext",
"()Lokio/Segment;",
"setNext",
"(Lokio/Segment;)V",
"recycle",
"",
"segment",
"take",
"okio"
}
k = 0x1
mv = {
0x1,
0x1,
0xf
}
.end annotation
# static fields
.field public static final INSTANCE:Lokio/SegmentPool;
.field public static final MAX_SIZE:J = 0x10000L
.field private static byteCount:J
.field private static next:Lokio/Segment;
# direct methods
.method static constructor <clinit>()V
.registers 1
.line 25
new-instance v0, Lokio/SegmentPool;
invoke-direct {v0}, Lokio/SegmentPool;-><init>()V
sput-object v0, Lokio/SegmentPool;->INSTANCE:Lokio/SegmentPool;
return-void
.end method
.method private constructor <init>()V
.registers 1
.line 25
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
return-void
.end method
# virtual methods
.method public final getByteCount()J
.registers 3
.line 34
sget-wide v0, Lokio/SegmentPool;->byteCount:J
return-wide v0
.end method
.method public final getNext()Lokio/Segment;
.registers 2
.line 31
sget-object v0, Lokio/SegmentPool;->next:Lokio/Segment;
return-object v0
.end method
.method public final recycle(Lokio/Segment;)V
.registers 10
const-string v0, "segment"
invoke-static {p1, v0}, Lkotlin/jvm/internal/Intrinsics;->checkParameterIsNotNull(Ljava/lang/Object;Ljava/lang/String;)V
.line 49
iget-object v0, p1, Lokio/Segment;->next:Lokio/Segment;
const/4 v1, 0x0
if-nez v0, :cond_10
iget-object v0, p1, Lokio/Segment;->prev:Lokio/Segment;
if-nez v0, :cond_10
const/4 v0, 0x1
goto :goto_11
:cond_10
const/4 v0, 0x0
:goto_11
if-eqz v0, :cond_40
.line 50
iget-boolean v0, p1, Lokio/Segment;->shared:Z
if-eqz v0, :cond_18
return-void
.line 64
:cond_18
monitor-enter p0
.line 53
:try_start_19
sget-wide v2, Lokio/SegmentPool;->byteCount:J
:try_end_1b
.catchall {:try_start_19 .. :try_end_1b} :catchall_3d
const/16 v0, 0x2000
int-to-long v4, v0
add-long/2addr v2, v4
const-wide/32 v6, 0x10000
cmp-long v0, v2, v6
if-lez v0, :cond_28
monitor-exit p0
return-void
.line 54
:cond_28
:try_start_28
sget-wide v2, Lokio/SegmentPool;->byteCount:J
add-long/2addr v2, v4
sput-wide v2, Lokio/SegmentPool;->byteCount:J
.line 55
sget-object v0, Lokio/SegmentPool;->next:Lokio/Segment;
iput-object v0, p1, Lokio/Segment;->next:Lokio/Segment;
.line 56
iput v1, p1, Lokio/Segment;->limit:I
.line 57
iget v0, p1, Lokio/Segment;->limit:I
iput v0, p1, Lokio/Segment;->pos:I
.line 58
sput-object p1, Lokio/SegmentPool;->next:Lokio/Segment;
.line 59
sget-object p1, Lkotlin/Unit;->INSTANCE:Lkotlin/Unit;
:try_end_3b
.catchall {:try_start_28 .. :try_end_3b} :catchall_3d
monitor-exit p0
return-void
:catchall_3d
move-exception p1
monitor-exit p0
throw p1
:cond_40
const-string p1, "Failed requirement."
.line 49
new-instance v0, Ljava/lang/IllegalArgumentException;
invoke-virtual {p1}, Ljava/lang/Object;->toString()Ljava/lang/String;
move-result-object p1
invoke-direct {v0, p1}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
check-cast v0, Ljava/lang/Throwable;
throw v0
.end method
.method public final setByteCount(J)V
.registers 3
.line 34
sput-wide p1, Lokio/SegmentPool;->byteCount:J
return-void
.end method
.method public final setNext(Lokio/Segment;)V
.registers 2
.line 31
sput-object p1, Lokio/SegmentPool;->next:Lokio/Segment;
return-void
.end method
.method public final take()Lokio/Segment;
.registers 6
.line 63
monitor-enter p0
.line 38
:try_start_1
sget-object v0, Lokio/SegmentPool;->next:Lokio/Segment;
if-eqz v0, :cond_18
.line 39
iget-object v1, v0, Lokio/Segment;->next:Lokio/Segment;
sput-object v1, Lokio/SegmentPool;->next:Lokio/Segment;
const/4 v1, 0x0
.line 40
check-cast v1, Lokio/Segment;
iput-object v1, v0, Lokio/Segment;->next:Lokio/Segment;
.line 41
sget-wide v1, Lokio/SegmentPool;->byteCount:J
const/16 v3, 0x2000
int-to-long v3, v3
sub-long/2addr v1, v3
sput-wide v1, Lokio/SegmentPool;->byteCount:J
:try_end_16
.catchall {:try_start_1 .. :try_end_16} :catchall_1f
.line 42
monitor-exit p0
return-object v0
.line 43
:cond_18
monitor-exit p0
.line 45
new-instance v0, Lokio/Segment;
invoke-direct {v0}, Lokio/Segment;-><init>()V
return-object v0
:catchall_1f
move-exception v0
.line 43
monitor-exit p0
throw v0
.end method