2020-05-17 12:40:10 +00:00
|
|
|
.class public final Lcom/discord/stores/Dispatcher;
|
|
|
|
.super Ljava/lang/Object;
|
|
|
|
.source "Dispatcher.kt"
|
|
|
|
|
|
|
|
|
|
|
|
# instance fields
|
|
|
|
.field public final assertCleanDispatches:Z
|
|
|
|
|
|
|
|
.field public final dispatchHandlers:Ljava/util/ArrayList;
|
|
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
|
|
value = {
|
|
|
|
"Ljava/util/ArrayList<",
|
|
|
|
"Lcom/discord/stores/DispatchHandler;",
|
|
|
|
">;"
|
|
|
|
}
|
|
|
|
.end annotation
|
|
|
|
.end field
|
|
|
|
|
|
|
|
.field public dispatcherThread:Ljava/lang/Thread;
|
|
|
|
|
|
|
|
.field public final scheduler:Lrx/Scheduler;
|
|
|
|
|
|
|
|
|
|
|
|
# direct methods
|
|
|
|
.method public constructor <init>(Lrx/Scheduler;Z)V
|
2020-09-16 23:45:23 +00:00
|
|
|
.locals 1
|
2020-09-09 19:21:20 +00:00
|
|
|
|
2020-09-16 23:45:23 +00:00
|
|
|
const-string v0, "scheduler"
|
|
|
|
|
2020-10-05 23:18:16 +00:00
|
|
|
invoke-static {p1, v0}, Lc0/n/c/j;->checkNotNullParameter(Ljava/lang/Object;Ljava/lang/String;)V
|
2020-05-17 12:40:10 +00:00
|
|
|
|
|
|
|
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
|
|
|
|
|
|
|
|
iput-object p1, p0, Lcom/discord/stores/Dispatcher;->scheduler:Lrx/Scheduler;
|
|
|
|
|
|
|
|
iput-boolean p2, p0, Lcom/discord/stores/Dispatcher;->assertCleanDispatches:Z
|
|
|
|
|
|
|
|
new-instance p1, Ljava/util/ArrayList;
|
|
|
|
|
|
|
|
invoke-direct {p1}, Ljava/util/ArrayList;-><init>()V
|
|
|
|
|
|
|
|
iput-object p1, p0, Lcom/discord/stores/Dispatcher;->dispatchHandlers:Ljava/util/ArrayList;
|
|
|
|
|
|
|
|
return-void
|
|
|
|
.end method
|
|
|
|
|
|
|
|
.method public synthetic constructor <init>(Lrx/Scheduler;ZILkotlin/jvm/internal/DefaultConstructorMarker;)V
|
|
|
|
.locals 0
|
|
|
|
|
|
|
|
and-int/lit8 p3, p3, 0x2
|
|
|
|
|
|
|
|
if-eqz p3, :cond_0
|
|
|
|
|
|
|
|
const/4 p2, 0x0
|
|
|
|
|
|
|
|
:cond_0
|
|
|
|
invoke-direct {p0, p1, p2}, Lcom/discord/stores/Dispatcher;-><init>(Lrx/Scheduler;Z)V
|
|
|
|
|
|
|
|
return-void
|
|
|
|
.end method
|
|
|
|
|
|
|
|
.method public static final synthetic access$getDispatcherThread$p(Lcom/discord/stores/Dispatcher;)Ljava/lang/Thread;
|
|
|
|
.locals 0
|
|
|
|
|
|
|
|
iget-object p0, p0, Lcom/discord/stores/Dispatcher;->dispatcherThread:Ljava/lang/Thread;
|
|
|
|
|
|
|
|
return-object p0
|
|
|
|
.end method
|
|
|
|
|
|
|
|
.method public static final synthetic access$setDispatcherThread$p(Lcom/discord/stores/Dispatcher;Ljava/lang/Thread;)V
|
|
|
|
.locals 0
|
|
|
|
|
|
|
|
iput-object p1, p0, Lcom/discord/stores/Dispatcher;->dispatcherThread:Ljava/lang/Thread;
|
|
|
|
|
|
|
|
return-void
|
|
|
|
.end method
|
|
|
|
|
|
|
|
.method private final assertCleanDispatch()V
|
2020-09-16 23:45:23 +00:00
|
|
|
.locals 3
|
2020-05-17 12:40:10 +00:00
|
|
|
|
|
|
|
invoke-static {}, Ljava/lang/Thread;->currentThread()Ljava/lang/Thread;
|
|
|
|
|
|
|
|
move-result-object v0
|
|
|
|
|
|
|
|
iget-object v1, p0, Lcom/discord/stores/Dispatcher;->dispatcherThread:Ljava/lang/Thread;
|
|
|
|
|
|
|
|
if-ne v0, v1, :cond_0
|
|
|
|
|
2020-09-28 19:40:16 +00:00
|
|
|
sget-object v0, Lcom/discord/app/AppLog;->e:Lcom/discord/app/AppLog;
|
2020-05-17 12:40:10 +00:00
|
|
|
|
|
|
|
new-instance v1, Ljava/lang/RuntimeException;
|
|
|
|
|
|
|
|
invoke-direct {v1}, Ljava/lang/RuntimeException;-><init>()V
|
|
|
|
|
2020-09-16 23:45:23 +00:00
|
|
|
const-string v2, "dirty dispatch"
|
2020-07-08 16:44:49 +00:00
|
|
|
|
2020-09-16 23:45:23 +00:00
|
|
|
invoke-virtual {v0, v2, v1}, Lcom/discord/app/AppLog;->w(Ljava/lang/String;Ljava/lang/Throwable;)V
|
2020-05-17 12:40:10 +00:00
|
|
|
|
|
|
|
:cond_0
|
|
|
|
return-void
|
|
|
|
.end method
|
|
|
|
|
|
|
|
|
|
|
|
# virtual methods
|
|
|
|
.method public final getScheduler()Lrx/Scheduler;
|
|
|
|
.locals 1
|
|
|
|
|
|
|
|
iget-object v0, p0, Lcom/discord/stores/Dispatcher;->scheduler:Lrx/Scheduler;
|
|
|
|
|
|
|
|
return-object v0
|
|
|
|
.end method
|
|
|
|
|
|
|
|
.method public final onDispatchEnded()V
|
|
|
|
.locals 2
|
|
|
|
.annotation runtime Lcom/discord/stores/StoreThread;
|
|
|
|
.end annotation
|
|
|
|
|
|
|
|
iget-object v0, p0, Lcom/discord/stores/Dispatcher;->dispatchHandlers:Ljava/util/ArrayList;
|
|
|
|
|
|
|
|
invoke-virtual {v0}, Ljava/util/ArrayList;->iterator()Ljava/util/Iterator;
|
|
|
|
|
|
|
|
move-result-object v0
|
|
|
|
|
|
|
|
:goto_0
|
|
|
|
invoke-interface {v0}, Ljava/util/Iterator;->hasNext()Z
|
|
|
|
|
|
|
|
move-result v1
|
|
|
|
|
|
|
|
if-eqz v1, :cond_0
|
|
|
|
|
|
|
|
invoke-interface {v0}, Ljava/util/Iterator;->next()Ljava/lang/Object;
|
|
|
|
|
|
|
|
move-result-object v1
|
|
|
|
|
|
|
|
check-cast v1, Lcom/discord/stores/DispatchHandler;
|
|
|
|
|
|
|
|
invoke-interface {v1}, Lcom/discord/stores/DispatchHandler;->onDispatchEnded()V
|
|
|
|
|
|
|
|
goto :goto_0
|
|
|
|
|
|
|
|
:cond_0
|
|
|
|
return-void
|
|
|
|
.end method
|
|
|
|
|
|
|
|
.method public final varargs registerDispatchHandlers([Lcom/discord/stores/DispatchHandler;)V
|
|
|
|
.locals 4
|
|
|
|
.annotation runtime Lcom/discord/stores/StoreThread;
|
|
|
|
.end annotation
|
|
|
|
|
2020-09-16 23:45:23 +00:00
|
|
|
const-string v0, "dispatchHandlerArgs"
|
|
|
|
|
2020-10-05 23:18:16 +00:00
|
|
|
invoke-static {p1, v0}, Lc0/n/c/j;->checkNotNullParameter(Ljava/lang/Object;Ljava/lang/String;)V
|
2020-05-17 12:40:10 +00:00
|
|
|
|
|
|
|
array-length v0, p1
|
|
|
|
|
|
|
|
const/4 v1, 0x0
|
|
|
|
|
|
|
|
:goto_0
|
|
|
|
if-ge v1, v0, :cond_0
|
|
|
|
|
|
|
|
aget-object v2, p1, v1
|
|
|
|
|
|
|
|
iget-object v3, p0, Lcom/discord/stores/Dispatcher;->dispatchHandlers:Ljava/util/ArrayList;
|
|
|
|
|
|
|
|
invoke-virtual {v3, v2}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z
|
|
|
|
|
|
|
|
add-int/lit8 v1, v1, 0x1
|
|
|
|
|
|
|
|
goto :goto_0
|
|
|
|
|
|
|
|
:cond_0
|
|
|
|
return-void
|
|
|
|
.end method
|
|
|
|
|
|
|
|
.method public final schedule(Lkotlin/jvm/functions/Function0;)V
|
|
|
|
.locals 8
|
|
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
|
|
value = {
|
|
|
|
"(",
|
|
|
|
"Lkotlin/jvm/functions/Function0<",
|
|
|
|
"Lkotlin/Unit;",
|
|
|
|
">;)V"
|
|
|
|
}
|
|
|
|
.end annotation
|
|
|
|
|
2020-09-16 23:45:23 +00:00
|
|
|
const-string v0, "action"
|
|
|
|
|
2020-10-05 23:18:16 +00:00
|
|
|
invoke-static {p1, v0}, Lc0/n/c/j;->checkNotNullParameter(Ljava/lang/Object;Ljava/lang/String;)V
|
2020-05-17 12:40:10 +00:00
|
|
|
|
|
|
|
iget-object v0, p0, Lcom/discord/stores/Dispatcher;->dispatchHandlers:Ljava/util/ArrayList;
|
|
|
|
|
|
|
|
invoke-virtual {v0}, Ljava/util/ArrayList;->isEmpty()Z
|
|
|
|
|
|
|
|
move-result v0
|
|
|
|
|
|
|
|
if-eqz v0, :cond_0
|
|
|
|
|
2020-09-28 19:40:16 +00:00
|
|
|
sget-object v1, Lcom/discord/app/AppLog;->e:Lcom/discord/app/AppLog;
|
2020-05-17 12:40:10 +00:00
|
|
|
|
|
|
|
const-class v0, Lcom/discord/stores/Dispatcher;
|
|
|
|
|
|
|
|
invoke-virtual {v0}, Ljava/lang/Class;->getName()Ljava/lang/String;
|
|
|
|
|
|
|
|
move-result-object v2
|
|
|
|
|
|
|
|
const-string v0, "javaClass.name"
|
|
|
|
|
2020-10-05 23:18:16 +00:00
|
|
|
invoke-static {v2, v0}, Lc0/n/c/j;->checkNotNullExpressionValue(Ljava/lang/Object;Ljava/lang/String;)V
|
2020-05-17 12:40:10 +00:00
|
|
|
|
|
|
|
const/4 v4, 0x0
|
|
|
|
|
|
|
|
const/4 v5, 0x0
|
|
|
|
|
|
|
|
const/16 v6, 0xc
|
|
|
|
|
|
|
|
const/4 v7, 0x0
|
|
|
|
|
|
|
|
const-string v3, "scheduled an action without registering DispatchHandlers"
|
|
|
|
|
|
|
|
invoke-static/range {v1 .. v7}, Lcom/discord/utilities/logging/Logger;->e$default(Lcom/discord/utilities/logging/Logger;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;Ljava/util/Map;ILjava/lang/Object;)V
|
|
|
|
|
|
|
|
:cond_0
|
|
|
|
iget-boolean v0, p0, Lcom/discord/stores/Dispatcher;->assertCleanDispatches:Z
|
|
|
|
|
|
|
|
if-eqz v0, :cond_1
|
|
|
|
|
|
|
|
invoke-direct {p0}, Lcom/discord/stores/Dispatcher;->assertCleanDispatch()V
|
|
|
|
|
|
|
|
:cond_1
|
|
|
|
iget-object v0, p0, Lcom/discord/stores/Dispatcher;->scheduler:Lrx/Scheduler;
|
|
|
|
|
|
|
|
invoke-virtual {v0}, Lrx/Scheduler;->a()Lrx/Scheduler$Worker;
|
|
|
|
|
|
|
|
move-result-object v0
|
|
|
|
|
|
|
|
new-instance v1, Lcom/discord/stores/Dispatcher$schedule$1;
|
|
|
|
|
|
|
|
invoke-direct {v1, p0, p1}, Lcom/discord/stores/Dispatcher$schedule$1;-><init>(Lcom/discord/stores/Dispatcher;Lkotlin/jvm/functions/Function0;)V
|
|
|
|
|
|
|
|
invoke-virtual {v0, v1}, Lrx/Scheduler$Worker;->a(Lrx/functions/Action0;)Lrx/Subscription;
|
|
|
|
|
|
|
|
return-void
|
|
|
|
.end method
|
|
|
|
|
|
|
|
.method public final varargs unregisterDispatchHandlers([Lcom/discord/stores/DispatchHandler;)V
|
|
|
|
.locals 4
|
|
|
|
.annotation runtime Lcom/discord/stores/StoreThread;
|
|
|
|
.end annotation
|
|
|
|
|
2020-09-16 23:45:23 +00:00
|
|
|
const-string v0, "dispatchHandlerArgs"
|
|
|
|
|
2020-10-05 23:18:16 +00:00
|
|
|
invoke-static {p1, v0}, Lc0/n/c/j;->checkNotNullParameter(Ljava/lang/Object;Ljava/lang/String;)V
|
2020-05-17 12:40:10 +00:00
|
|
|
|
|
|
|
array-length v0, p1
|
|
|
|
|
|
|
|
const/4 v1, 0x0
|
|
|
|
|
|
|
|
:goto_0
|
|
|
|
if-ge v1, v0, :cond_0
|
|
|
|
|
|
|
|
aget-object v2, p1, v1
|
|
|
|
|
|
|
|
iget-object v3, p0, Lcom/discord/stores/Dispatcher;->dispatchHandlers:Ljava/util/ArrayList;
|
|
|
|
|
|
|
|
invoke-virtual {v3, v2}, Ljava/util/ArrayList;->remove(Ljava/lang/Object;)Z
|
|
|
|
|
|
|
|
add-int/lit8 v1, v1, 0x1
|
|
|
|
|
|
|
|
goto :goto_0
|
|
|
|
|
|
|
|
:cond_0
|
|
|
|
return-void
|
|
|
|
.end method
|