Rabbit-R1/switch port/smali/smali_classes3/okio/Throttler.smali
2024-05-21 17:08:36 -04:00

582 lines
12 KiB
Smali

.class public final Lokio/Throttler;
.super Ljava/lang/Object;
.source "Throttler.kt"
# annotations
.annotation system Ldalvik/annotation/SourceDebugExtension;
value = "SMAP\nThrottler.kt\nKotlin\n*S Kotlin\n*F\n+ 1 Throttler.kt\nokio/Throttler\n+ 2 -Platform.kt\nokio/-Platform\n*L\n1#1,169:1\n28#2:170\n28#2:171\n*E\n*S KotlinDebug\n*F\n+ 1 Throttler.kt\nokio/Throttler\n*L\n58#1:170\n77#1:171\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\u0008\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\u0008\u0007\u0018\u00002\u00020\u0001B\u0007\u0008\u0016\u00a2\u0006\u0002\u0010\u0002B\u000f\u0008\u0000\u0012\u0006\u0010\u0003\u001a\u00020\u0004\u00a2\u0006\u0002\u0010\u0005J\u001d\u0010\t\u001a\u00020\u00042\u0006\u0010\n\u001a\u00020\u00042\u0006\u0010\u000b\u001a\u00020\u0004H\u0000\u00a2\u0006\u0002\u0008\u000cJ$\u0010\u0006\u001a\u00020\r2\u0006\u0010\u0006\u001a\u00020\u00042\u0008\u0008\u0002\u0010\u0008\u001a\u00020\u00042\u0008\u0008\u0002\u0010\u0007\u001a\u00020\u0004H\u0007J\u000e\u0010\u000e\u001a\u00020\u000f2\u0006\u0010\u000e\u001a\u00020\u000fJ\u000e\u0010\u0010\u001a\u00020\u00112\u0006\u0010\u0010\u001a\u00020\u0011J\u0015\u0010\u0012\u001a\u00020\u00042\u0006\u0010\u000b\u001a\u00020\u0004H\u0000\u00a2\u0006\u0002\u0008\u0013J\u0010\u0010\u0014\u001a\u00020\r2\u0006\u0010\u0015\u001a\u00020\u0004H\u0002J\u000c\u0010\u0016\u001a\u00020\u0004*\u00020\u0004H\u0002J\u000c\u0010\u0017\u001a\u00020\u0004*\u00020\u0004H\u0002R\u000e\u0010\u0003\u001a\u00020\u0004X\u0082\u000e\u00a2\u0006\u0002\n\u0000R\u000e\u0010\u0006\u001a\u00020\u0004X\u0082\u000e\u00a2\u0006\u0002\n\u0000R\u000e\u0010\u0007\u001a\u00020\u0004X\u0082\u000e\u00a2\u0006\u0002\n\u0000R\u000e\u0010\u0008\u001a\u00020\u0004X\u0082\u000e\u00a2\u0006\u0002\n\u0000\u00a8\u0006\u0018"
}
d2 = {
"Lokio/Throttler;",
"",
"()V",
"allocatedUntil",
"",
"(J)V",
"bytesPerSecond",
"maxByteCount",
"waitByteCount",
"byteCountOrWaitNanos",
"now",
"byteCount",
"byteCountOrWaitNanos$okio",
"",
"sink",
"Lokio/Sink;",
"source",
"Lokio/Source;",
"take",
"take$okio",
"waitNanos",
"nanosToWait",
"bytesToNanos",
"nanosToBytes",
"okio"
}
k = 0x1
mv = {
0x1,
0x4,
0x0
}
.end annotation
# instance fields
.field private allocatedUntil:J
.field private bytesPerSecond:J
.field private maxByteCount:J
.field private waitByteCount:J
# direct methods
.method public constructor <init>()V
.locals 2
.line 49
invoke-static {}, Ljava/lang/System;->nanoTime()J
move-result-wide v0
invoke-direct {p0, v0, v1}, Lokio/Throttler;-><init>(J)V
return-void
.end method
.method public constructor <init>(J)V
.locals 0
.line 38
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
iput-wide p1, p0, Lokio/Throttler;->allocatedUntil:J
const-wide/16 p1, 0x2000
iput-wide p1, p0, Lokio/Throttler;->waitByteCount:J
const-wide/32 p1, 0x40000
iput-wide p1, p0, Lokio/Throttler;->maxByteCount:J
return-void
.end method
.method public static synthetic bytesPerSecond$default(Lokio/Throttler;JJJILjava/lang/Object;)V
.locals 7
and-int/lit8 p8, p7, 0x2
if-eqz p8, :cond_0
.line 55
iget-wide p3, p0, Lokio/Throttler;->waitByteCount:J
:cond_0
move-wide v3, p3
and-int/lit8 p3, p7, 0x4
if-eqz p3, :cond_1
.line 56
iget-wide p5, p0, Lokio/Throttler;->maxByteCount:J
:cond_1
move-wide v5, p5
move-object v0, p0
move-wide v1, p1
invoke-virtual/range {v0 .. v6}, Lokio/Throttler;->bytesPerSecond(JJJ)V
return-void
.end method
.method private final bytesToNanos(J)J
.locals 2
const-wide/32 v0, 0x3b9aca00
mul-long/2addr p1, v0
iget-wide v0, p0, Lokio/Throttler;->bytesPerSecond:J
.line 126
div-long/2addr p1, v0
return-wide p1
.end method
.method private final nanosToBytes(J)J
.locals 2
iget-wide v0, p0, Lokio/Throttler;->bytesPerSecond:J
mul-long/2addr p1, v0
const-wide/32 v0, 0x3b9aca00
.line 124
div-long/2addr p1, v0
return-wide p1
.end method
.method private final waitNanos(J)V
.locals 4
const-wide/32 v0, 0xf4240
.line 129
div-long v2, p1, v0
mul-long/2addr v0, v2
sub-long/2addr p1, v0
.line 131
check-cast p0, Ljava/lang/Object;
long-to-int p1, p1
invoke-virtual {p0, v2, v3, p1}, Ljava/lang/Object;->wait(JI)V
return-void
.end method
# virtual methods
.method public final byteCountOrWaitNanos$okio(JJ)J
.locals 9
iget-wide v0, p0, Lokio/Throttler;->bytesPerSecond:J
const-wide/16 v2, 0x0
cmp-long v0, v0, v2
if-nez v0, :cond_0
return-wide p3
:cond_0
iget-wide v0, p0, Lokio/Throttler;->allocatedUntil:J
sub-long/2addr v0, p1
.line 96
invoke-static {v0, v1, v2, v3}, Ljava/lang/Math;->max(JJ)J
move-result-wide v0
iget-wide v4, p0, Lokio/Throttler;->maxByteCount:J
.line 97
invoke-direct {p0, v0, v1}, Lokio/Throttler;->nanosToBytes(J)J
move-result-wide v6
sub-long/2addr v4, v6
cmp-long v6, v4, p3
if-ltz v6, :cond_1
add-long/2addr p1, v0
.line 101
invoke-direct {p0, p3, p4}, Lokio/Throttler;->bytesToNanos(J)J
move-result-wide v0
add-long/2addr p1, v0
iput-wide p1, p0, Lokio/Throttler;->allocatedUntil:J
return-wide p3
:cond_1
iget-wide v6, p0, Lokio/Throttler;->waitByteCount:J
cmp-long v8, v4, v6
if-ltz v8, :cond_2
iget-wide p3, p0, Lokio/Throttler;->maxByteCount:J
.line 107
invoke-direct {p0, p3, p4}, Lokio/Throttler;->bytesToNanos(J)J
move-result-wide p3
add-long/2addr p1, p3
iput-wide p1, p0, Lokio/Throttler;->allocatedUntil:J
return-wide v4
.line 112
:cond_2
invoke-static {v6, v7, p3, p4}, Ljava/lang/Math;->min(JJ)J
move-result-wide p3
iget-wide v4, p0, Lokio/Throttler;->maxByteCount:J
sub-long v4, p3, v4
.line 113
invoke-direct {p0, v4, v5}, Lokio/Throttler;->bytesToNanos(J)J
move-result-wide v4
add-long/2addr v0, v4
cmp-long v2, v0, v2
if-nez v2, :cond_3
iget-wide v0, p0, Lokio/Throttler;->maxByteCount:J
.line 117
invoke-direct {p0, v0, v1}, Lokio/Throttler;->bytesToNanos(J)J
move-result-wide v0
add-long/2addr p1, v0
iput-wide p1, p0, Lokio/Throttler;->allocatedUntil:J
return-wide p3
:cond_3
neg-long p0, v0
return-wide p0
.end method
.method public final bytesPerSecond(J)V
.locals 9
const-wide/16 v3, 0x0
const-wide/16 v5, 0x0
const/4 v7, 0x6
const/4 v8, 0x0
move-object v0, p0
move-wide v1, p1
invoke-static/range {v0 .. v8}, Lokio/Throttler;->bytesPerSecond$default(Lokio/Throttler;JJJILjava/lang/Object;)V
return-void
.end method
.method public final bytesPerSecond(JJ)V
.locals 9
const-wide/16 v5, 0x0
const/4 v7, 0x4
const/4 v8, 0x0
move-object v0, p0
move-wide v1, p1
move-wide v3, p3
invoke-static/range {v0 .. v8}, Lokio/Throttler;->bytesPerSecond$default(Lokio/Throttler;JJJILjava/lang/Object;)V
return-void
.end method
.method public final bytesPerSecond(JJJ)V
.locals 5
.line 170
monitor-enter p0
const-wide/16 v0, 0x0
cmp-long v2, p1, v0
const/4 v3, 0x1
const/4 v4, 0x0
if-ltz v2, :cond_0
move v2, v3
goto :goto_0
:cond_0
move v2, v4
:goto_0
if-eqz v2, :cond_5
cmp-long v0, p3, v0
if-lez v0, :cond_1
move v0, v3
goto :goto_1
:cond_1
move v0, v4
:goto_1
if-eqz v0, :cond_4
cmp-long v0, p5, p3
if-ltz v0, :cond_2
goto :goto_2
:cond_2
move v3, v4
:goto_2
if-eqz v3, :cond_3
:try_start_0
iput-wide p1, p0, Lokio/Throttler;->bytesPerSecond:J
iput-wide p3, p0, Lokio/Throttler;->waitByteCount:J
iput-wide p5, p0, Lokio/Throttler;->maxByteCount:J
.line 66
move-object p1, p0
check-cast p1, Ljava/lang/Object;
invoke-virtual {p1}, Ljava/lang/Object;->notifyAll()V
.line 67
sget-object p1, Lkotlin/Unit;->INSTANCE:Lkotlin/Unit;
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
monitor-exit p0
return-void
:cond_3
:try_start_1
const-string p1, "Failed requirement."
.line 61
new-instance p2, Ljava/lang/IllegalArgumentException;
invoke-virtual {p1}, Ljava/lang/Object;->toString()Ljava/lang/String;
move-result-object p1
invoke-direct {p2, p1}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
check-cast p2, Ljava/lang/Throwable;
throw p2
:cond_4
const-string p1, "Failed requirement."
.line 60
new-instance p2, Ljava/lang/IllegalArgumentException;
invoke-virtual {p1}, Ljava/lang/Object;->toString()Ljava/lang/String;
move-result-object p1
invoke-direct {p2, p1}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
check-cast p2, Ljava/lang/Throwable;
throw p2
:cond_5
const-string p1, "Failed requirement."
.line 59
new-instance p2, Ljava/lang/IllegalArgumentException;
invoke-virtual {p1}, Ljava/lang/Object;->toString()Ljava/lang/String;
move-result-object p1
invoke-direct {p2, p1}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
check-cast p2, Ljava/lang/Throwable;
throw p2
:try_end_1
.catchall {:try_start_1 .. :try_end_1} :catchall_0
:catchall_0
move-exception p1
.line 67
monitor-exit p0
throw p1
.end method
.method public final sink(Lokio/Sink;)Lokio/Sink;
.locals 1
const-string v0, "sink"
invoke-static {p1, v0}, Lkotlin/jvm/internal/Intrinsics;->checkNotNullParameter(Ljava/lang/Object;Ljava/lang/String;)V
.line 151
new-instance v0, Lokio/Throttler$sink$1;
invoke-direct {v0, p0, p1, p1}, Lokio/Throttler$sink$1;-><init>(Lokio/Throttler;Lokio/Sink;Lokio/Sink;)V
check-cast v0, Lokio/Sink;
return-object v0
.end method
.method public final source(Lokio/Source;)Lokio/Source;
.locals 1
const-string v0, "source"
invoke-static {p1, v0}, Lkotlin/jvm/internal/Intrinsics;->checkNotNullParameter(Ljava/lang/Object;Ljava/lang/String;)V
.line 136
new-instance v0, Lokio/Throttler$source$1;
invoke-direct {v0, p0, p1, p1}, Lokio/Throttler$source$1;-><init>(Lokio/Throttler;Lokio/Source;Lokio/Source;)V
check-cast v0, Lokio/Source;
return-object v0
.end method
.method public final take$okio(J)J
.locals 5
const-wide/16 v0, 0x0
cmp-long v2, p1, v0
if-lez v2, :cond_0
const/4 v2, 0x1
goto :goto_0
:cond_0
const/4 v2, 0x0
:goto_0
if-eqz v2, :cond_2
.line 171
monitor-enter p0
.line 79
:goto_1
:try_start_0
invoke-static {}, Ljava/lang/System;->nanoTime()J
move-result-wide v2
.line 80
invoke-virtual {p0, v2, v3, p1, p2}, Lokio/Throttler;->byteCountOrWaitNanos$okio(JJ)J
move-result-wide v2
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
cmp-long v4, v2, v0
if-ltz v4, :cond_1
.line 81
monitor-exit p0
return-wide v2
:cond_1
neg-long v2, v2
.line 82
:try_start_1
invoke-direct {p0, v2, v3}, Lokio/Throttler;->waitNanos(J)V
:try_end_1
.catchall {:try_start_1 .. :try_end_1} :catchall_0
goto :goto_1
:catchall_0
move-exception p1
.line 78
monitor-exit p0
throw p1
:cond_2
const-string p0, "Failed requirement."
.line 75
new-instance p1, Ljava/lang/IllegalArgumentException;
invoke-virtual {p0}, Ljava/lang/Object;->toString()Ljava/lang/String;
move-result-object p0
invoke-direct {p1, p0}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
check-cast p1, Ljava/lang/Throwable;
throw p1
.end method