apkfuckery/com.discord/smali/androidx/lifecycle/DispatchQueue.smali
2020-09-09 19:21:20 +00:00

294 lines
6.5 KiB
Smali

.class public final Landroidx/lifecycle/DispatchQueue;
.super Ljava/lang/Object;
.source "DispatchQueue.kt"
# instance fields
.field public finished:Z
.field public isDraining:Z
.field public paused:Z
.field public final queue:Ljava/util/Queue;
.annotation system Ldalvik/annotation/Signature;
value = {
"Ljava/util/Queue<",
"Ljava/lang/Runnable;",
">;"
}
.end annotation
.end field
# direct methods
.method public constructor <init>()V
.locals 1
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
const/4 v0, 0x1
iput-boolean v0, p0, Landroidx/lifecycle/DispatchQueue;->paused:Z
new-instance v0, Ljava/util/ArrayDeque;
invoke-direct {v0}, Ljava/util/ArrayDeque;-><init>()V
iput-object v0, p0, Landroidx/lifecycle/DispatchQueue;->queue:Ljava/util/Queue;
return-void
.end method
.method public static final synthetic access$enqueue(Landroidx/lifecycle/DispatchQueue;Ljava/lang/Runnable;)V
.locals 0
invoke-direct {p0, p1}, Landroidx/lifecycle/DispatchQueue;->enqueue(Ljava/lang/Runnable;)V
return-void
.end method
.method private final canRun()Z
.locals 1
.annotation build Landroidx/annotation/MainThread;
.end annotation
iget-boolean v0, p0, Landroidx/lifecycle/DispatchQueue;->finished:Z
if-nez v0, :cond_1
iget-boolean v0, p0, Landroidx/lifecycle/DispatchQueue;->paused:Z
if-nez v0, :cond_0
goto :goto_0
:cond_0
const/4 v0, 0x0
goto :goto_1
:cond_1
:goto_0
const/4 v0, 0x1
:goto_1
return v0
.end method
.method private final enqueue(Ljava/lang/Runnable;)V
.locals 1
.annotation build Landroidx/annotation/MainThread;
.end annotation
iget-object v0, p0, Landroidx/lifecycle/DispatchQueue;->queue:Ljava/util/Queue;
invoke-interface {v0, p1}, Ljava/util/Queue;->offer(Ljava/lang/Object;)Z
move-result p1
if-eqz p1, :cond_0
invoke-virtual {p0}, Landroidx/lifecycle/DispatchQueue;->drainQueue()V
return-void
:cond_0
new-instance p1, Ljava/lang/IllegalStateException;
const-string v0, "cannot enqueue any more runnables"
invoke-virtual {v0}, Ljava/lang/Object;->toString()Ljava/lang/String;
move-result-object v0
invoke-direct {p1, v0}, Ljava/lang/IllegalStateException;-><init>(Ljava/lang/String;)V
throw p1
.end method
# virtual methods
.method public final drainQueue()V
.locals 3
.annotation build Landroidx/annotation/MainThread;
.end annotation
iget-boolean v0, p0, Landroidx/lifecycle/DispatchQueue;->isDraining:Z
if-eqz v0, :cond_0
return-void
:cond_0
const/4 v0, 0x0
const/4 v1, 0x1
:try_start_0
iput-boolean v1, p0, Landroidx/lifecycle/DispatchQueue;->isDraining:Z
:cond_1
:goto_0
iget-object v2, p0, Landroidx/lifecycle/DispatchQueue;->queue:Ljava/util/Queue;
invoke-interface {v2}, Ljava/util/Collection;->isEmpty()Z
move-result v2
xor-int/2addr v2, v1
if-eqz v2, :cond_3
invoke-direct {p0}, Landroidx/lifecycle/DispatchQueue;->canRun()Z
move-result v2
if-nez v2, :cond_2
goto :goto_1
:cond_2
iget-object v2, p0, Landroidx/lifecycle/DispatchQueue;->queue:Ljava/util/Queue;
invoke-interface {v2}, Ljava/util/Queue;->poll()Ljava/lang/Object;
move-result-object v2
check-cast v2, Ljava/lang/Runnable;
if-eqz v2, :cond_1
invoke-interface {v2}, Ljava/lang/Runnable;->run()V
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
goto :goto_0
:cond_3
:goto_1
iput-boolean v0, p0, Landroidx/lifecycle/DispatchQueue;->isDraining:Z
return-void
:catchall_0
move-exception v1
iput-boolean v0, p0, Landroidx/lifecycle/DispatchQueue;->isDraining:Z
throw v1
.end method
.method public final finish()V
.locals 1
.annotation build Landroidx/annotation/MainThread;
.end annotation
const/4 v0, 0x1
iput-boolean v0, p0, Landroidx/lifecycle/DispatchQueue;->finished:Z
invoke-virtual {p0}, Landroidx/lifecycle/DispatchQueue;->drainQueue()V
return-void
.end method
.method public final pause()V
.locals 1
.annotation build Landroidx/annotation/MainThread;
.end annotation
const/4 v0, 0x1
iput-boolean v0, p0, Landroidx/lifecycle/DispatchQueue;->paused:Z
return-void
.end method
.method public final resume()V
.locals 2
.annotation build Landroidx/annotation/MainThread;
.end annotation
iget-boolean v0, p0, Landroidx/lifecycle/DispatchQueue;->paused:Z
if-nez v0, :cond_0
return-void
:cond_0
iget-boolean v0, p0, Landroidx/lifecycle/DispatchQueue;->finished:Z
xor-int/lit8 v0, v0, 0x1
if-eqz v0, :cond_1
const/4 v0, 0x0
iput-boolean v0, p0, Landroidx/lifecycle/DispatchQueue;->paused:Z
invoke-virtual {p0}, Landroidx/lifecycle/DispatchQueue;->drainQueue()V
return-void
:cond_1
new-instance v0, Ljava/lang/IllegalStateException;
const-string v1, "Cannot resume a finished dispatcher"
invoke-virtual {v1}, Ljava/lang/Object;->toString()Ljava/lang/String;
move-result-object v1
invoke-direct {v0, v1}, Ljava/lang/IllegalStateException;-><init>(Ljava/lang/String;)V
throw v0
.end method
.method public final runOrEnqueue(Ljava/lang/Runnable;)V
.locals 3
.annotation build Landroid/annotation/SuppressLint;
value = {
"WrongThread"
}
.end annotation
.annotation build Landroidx/annotation/AnyThread;
.end annotation
const-string v0, "runnable"
invoke-static {p1, v0}, Lk0/n/c/i;->checkParameterIsNotNull(Ljava/lang/Object;Ljava/lang/String;)V
invoke-static {}, Ll0/a/g0;->a()Ll0/a/d1;
move-result-object v0
invoke-virtual {v0}, Ll0/a/d1;->t()Ll0/a/d1;
move-result-object v0
sget-object v1, Lk0/k/f;->d:Lk0/k/f;
invoke-virtual {v0, v1}, Ll0/a/v;->isDispatchNeeded(Lkotlin/coroutines/CoroutineContext;)Z
move-result v1
if-eqz v1, :cond_0
sget-object v1, Lk0/k/f;->d:Lk0/k/f;
new-instance v2, Landroidx/lifecycle/DispatchQueue$runOrEnqueue$$inlined$with$lambda$1;
invoke-direct {v2, p0, p1}, Landroidx/lifecycle/DispatchQueue$runOrEnqueue$$inlined$with$lambda$1;-><init>(Landroidx/lifecycle/DispatchQueue;Ljava/lang/Runnable;)V
invoke-virtual {v0, v1, v2}, Ll0/a/v;->dispatch(Lkotlin/coroutines/CoroutineContext;Ljava/lang/Runnable;)V
goto :goto_0
:cond_0
invoke-direct {p0, p1}, Landroidx/lifecycle/DispatchQueue;->enqueue(Ljava/lang/Runnable;)V
:goto_0
return-void
.end method