492 lines
12 KiB
Smali
492 lines
12 KiB
Smali
.class Lcom/google/firebase/components/EventBus;
|
|
.super Ljava/lang/Object;
|
|
.source "EventBus.java"
|
|
|
|
# interfaces
|
|
.implements Lcom/google/firebase/events/Subscriber;
|
|
.implements Lcom/google/firebase/events/Publisher;
|
|
|
|
|
|
# instance fields
|
|
.field private final defaultExecutor:Ljava/util/concurrent/Executor;
|
|
|
|
.field private final handlerMap:Ljava/util/Map;
|
|
.annotation build Landroidx/annotation/GuardedBy;
|
|
value = "this"
|
|
.end annotation
|
|
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"Ljava/util/Map<",
|
|
"Ljava/lang/Class<",
|
|
"*>;",
|
|
"Ljava/util/concurrent/ConcurrentHashMap<",
|
|
"Lcom/google/firebase/events/EventHandler<",
|
|
"Ljava/lang/Object;",
|
|
">;",
|
|
"Ljava/util/concurrent/Executor;",
|
|
">;>;"
|
|
}
|
|
.end annotation
|
|
.end field
|
|
|
|
.field private pendingEvents:Ljava/util/Queue;
|
|
.annotation build Landroidx/annotation/GuardedBy;
|
|
value = "this"
|
|
.end annotation
|
|
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"Ljava/util/Queue<",
|
|
"Lcom/google/firebase/events/Event<",
|
|
"*>;>;"
|
|
}
|
|
.end annotation
|
|
.end field
|
|
|
|
|
|
# direct methods
|
|
.method public constructor <init>(Ljava/util/concurrent/Executor;)V
|
|
.locals 1
|
|
|
|
.line 1
|
|
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
|
|
|
|
.line 2
|
|
new-instance v0, Ljava/util/HashMap;
|
|
|
|
invoke-direct {v0}, Ljava/util/HashMap;-><init>()V
|
|
|
|
iput-object v0, p0, Lcom/google/firebase/components/EventBus;->handlerMap:Ljava/util/Map;
|
|
|
|
.line 3
|
|
new-instance v0, Ljava/util/ArrayDeque;
|
|
|
|
invoke-direct {v0}, Ljava/util/ArrayDeque;-><init>()V
|
|
|
|
iput-object v0, p0, Lcom/google/firebase/components/EventBus;->pendingEvents:Ljava/util/Queue;
|
|
|
|
.line 4
|
|
iput-object p1, p0, Lcom/google/firebase/components/EventBus;->defaultExecutor:Ljava/util/concurrent/Executor;
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public static synthetic a(Ljava/util/Map$Entry;Lcom/google/firebase/events/Event;)V
|
|
.locals 0
|
|
|
|
invoke-static {p0, p1}, Lcom/google/firebase/components/EventBus;->lambda$publish$0(Ljava/util/Map$Entry;Lcom/google/firebase/events/Event;)V
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method private declared-synchronized getHandlers(Lcom/google/firebase/events/Event;)Ljava/util/Set;
|
|
.locals 1
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"(",
|
|
"Lcom/google/firebase/events/Event<",
|
|
"*>;)",
|
|
"Ljava/util/Set<",
|
|
"Ljava/util/Map$Entry<",
|
|
"Lcom/google/firebase/events/EventHandler<",
|
|
"Ljava/lang/Object;",
|
|
">;",
|
|
"Ljava/util/concurrent/Executor;",
|
|
">;>;"
|
|
}
|
|
.end annotation
|
|
|
|
monitor-enter p0
|
|
|
|
.line 1
|
|
:try_start_0
|
|
iget-object v0, p0, Lcom/google/firebase/components/EventBus;->handlerMap:Ljava/util/Map;
|
|
|
|
invoke-virtual {p1}, Lcom/google/firebase/events/Event;->getType()Ljava/lang/Class;
|
|
|
|
move-result-object p1
|
|
|
|
invoke-interface {v0, p1}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object;
|
|
|
|
move-result-object p1
|
|
|
|
check-cast p1, Ljava/util/Map;
|
|
|
|
if-nez p1, :cond_0
|
|
|
|
.line 2
|
|
invoke-static {}, Ljava/util/Collections;->emptySet()Ljava/util/Set;
|
|
|
|
move-result-object p1
|
|
|
|
goto :goto_0
|
|
|
|
:cond_0
|
|
invoke-interface {p1}, Ljava/util/Map;->entrySet()Ljava/util/Set;
|
|
|
|
move-result-object p1
|
|
:try_end_0
|
|
.catchall {:try_start_0 .. :try_end_0} :catchall_0
|
|
|
|
:goto_0
|
|
monitor-exit p0
|
|
|
|
return-object p1
|
|
|
|
:catchall_0
|
|
move-exception p1
|
|
|
|
monitor-exit p0
|
|
|
|
throw p1
|
|
.end method
|
|
|
|
.method private static synthetic lambda$publish$0(Ljava/util/Map$Entry;Lcom/google/firebase/events/Event;)V
|
|
.locals 0
|
|
|
|
.line 1
|
|
invoke-interface {p0}, Ljava/util/Map$Entry;->getKey()Ljava/lang/Object;
|
|
|
|
move-result-object p0
|
|
|
|
check-cast p0, Lcom/google/firebase/events/EventHandler;
|
|
|
|
invoke-interface {p0, p1}, Lcom/google/firebase/events/EventHandler;->handle(Lcom/google/firebase/events/Event;)V
|
|
|
|
return-void
|
|
.end method
|
|
|
|
|
|
# virtual methods
|
|
.method public enablePublishingAndFlushPending()V
|
|
.locals 2
|
|
|
|
.line 1
|
|
monitor-enter p0
|
|
|
|
.line 2
|
|
:try_start_0
|
|
iget-object v0, p0, Lcom/google/firebase/components/EventBus;->pendingEvents:Ljava/util/Queue;
|
|
|
|
const/4 v1, 0x0
|
|
|
|
if-eqz v0, :cond_0
|
|
|
|
.line 3
|
|
iput-object v1, p0, Lcom/google/firebase/components/EventBus;->pendingEvents:Ljava/util/Queue;
|
|
|
|
goto :goto_0
|
|
|
|
:cond_0
|
|
move-object v0, v1
|
|
|
|
.line 4
|
|
:goto_0
|
|
monitor-exit p0
|
|
:try_end_0
|
|
.catchall {:try_start_0 .. :try_end_0} :catchall_0
|
|
|
|
if-eqz v0, :cond_1
|
|
|
|
.line 5
|
|
invoke-interface {v0}, Ljava/util/Queue;->iterator()Ljava/util/Iterator;
|
|
|
|
move-result-object v0
|
|
|
|
:goto_1
|
|
invoke-interface {v0}, Ljava/util/Iterator;->hasNext()Z
|
|
|
|
move-result v1
|
|
|
|
if-eqz v1, :cond_1
|
|
|
|
invoke-interface {v0}, Ljava/util/Iterator;->next()Ljava/lang/Object;
|
|
|
|
move-result-object v1
|
|
|
|
check-cast v1, Lcom/google/firebase/events/Event;
|
|
|
|
.line 6
|
|
invoke-virtual {p0, v1}, Lcom/google/firebase/components/EventBus;->publish(Lcom/google/firebase/events/Event;)V
|
|
|
|
goto :goto_1
|
|
|
|
:cond_1
|
|
return-void
|
|
|
|
:catchall_0
|
|
move-exception v0
|
|
|
|
.line 7
|
|
:try_start_1
|
|
monitor-exit p0
|
|
:try_end_1
|
|
.catchall {:try_start_1 .. :try_end_1} :catchall_0
|
|
|
|
throw v0
|
|
.end method
|
|
|
|
.method public publish(Lcom/google/firebase/events/Event;)V
|
|
.locals 4
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"(",
|
|
"Lcom/google/firebase/events/Event<",
|
|
"*>;)V"
|
|
}
|
|
.end annotation
|
|
|
|
.line 1
|
|
invoke-static {p1}, Lcom/google/firebase/components/Preconditions;->checkNotNull(Ljava/lang/Object;)Ljava/lang/Object;
|
|
|
|
.line 2
|
|
monitor-enter p0
|
|
|
|
.line 3
|
|
:try_start_0
|
|
iget-object v0, p0, Lcom/google/firebase/components/EventBus;->pendingEvents:Ljava/util/Queue;
|
|
|
|
if-eqz v0, :cond_0
|
|
|
|
.line 4
|
|
invoke-interface {v0, p1}, Ljava/util/Queue;->add(Ljava/lang/Object;)Z
|
|
|
|
.line 5
|
|
monitor-exit p0
|
|
|
|
return-void
|
|
|
|
.line 6
|
|
:cond_0
|
|
monitor-exit p0
|
|
:try_end_0
|
|
.catchall {:try_start_0 .. :try_end_0} :catchall_0
|
|
|
|
.line 7
|
|
invoke-direct {p0, p1}, Lcom/google/firebase/components/EventBus;->getHandlers(Lcom/google/firebase/events/Event;)Ljava/util/Set;
|
|
|
|
move-result-object v0
|
|
|
|
invoke-interface {v0}, Ljava/util/Set;->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_1
|
|
|
|
invoke-interface {v0}, Ljava/util/Iterator;->next()Ljava/lang/Object;
|
|
|
|
move-result-object v1
|
|
|
|
check-cast v1, Ljava/util/Map$Entry;
|
|
|
|
.line 8
|
|
invoke-interface {v1}, Ljava/util/Map$Entry;->getValue()Ljava/lang/Object;
|
|
|
|
move-result-object v2
|
|
|
|
check-cast v2, Ljava/util/concurrent/Executor;
|
|
|
|
new-instance v3, Lcom/google/firebase/components/k;
|
|
|
|
invoke-direct {v3, v1, p1}, Lcom/google/firebase/components/k;-><init>(Ljava/util/Map$Entry;Lcom/google/firebase/events/Event;)V
|
|
|
|
invoke-interface {v2, v3}, Ljava/util/concurrent/Executor;->execute(Ljava/lang/Runnable;)V
|
|
|
|
goto :goto_0
|
|
|
|
:cond_1
|
|
return-void
|
|
|
|
:catchall_0
|
|
move-exception p1
|
|
|
|
.line 9
|
|
:try_start_1
|
|
monitor-exit p0
|
|
:try_end_1
|
|
.catchall {:try_start_1 .. :try_end_1} :catchall_0
|
|
|
|
throw p1
|
|
.end method
|
|
|
|
.method public subscribe(Ljava/lang/Class;Lcom/google/firebase/events/EventHandler;)V
|
|
.locals 1
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"<T:",
|
|
"Ljava/lang/Object;",
|
|
">(",
|
|
"Ljava/lang/Class<",
|
|
"TT;>;",
|
|
"Lcom/google/firebase/events/EventHandler<",
|
|
"-TT;>;)V"
|
|
}
|
|
.end annotation
|
|
|
|
.line 8
|
|
iget-object v0, p0, Lcom/google/firebase/components/EventBus;->defaultExecutor:Ljava/util/concurrent/Executor;
|
|
|
|
invoke-virtual {p0, p1, v0, p2}, Lcom/google/firebase/components/EventBus;->subscribe(Ljava/lang/Class;Ljava/util/concurrent/Executor;Lcom/google/firebase/events/EventHandler;)V
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public declared-synchronized subscribe(Ljava/lang/Class;Ljava/util/concurrent/Executor;Lcom/google/firebase/events/EventHandler;)V
|
|
.locals 2
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"<T:",
|
|
"Ljava/lang/Object;",
|
|
">(",
|
|
"Ljava/lang/Class<",
|
|
"TT;>;",
|
|
"Ljava/util/concurrent/Executor;",
|
|
"Lcom/google/firebase/events/EventHandler<",
|
|
"-TT;>;)V"
|
|
}
|
|
.end annotation
|
|
|
|
monitor-enter p0
|
|
|
|
.line 1
|
|
:try_start_0
|
|
invoke-static {p1}, Lcom/google/firebase/components/Preconditions;->checkNotNull(Ljava/lang/Object;)Ljava/lang/Object;
|
|
|
|
.line 2
|
|
invoke-static {p3}, Lcom/google/firebase/components/Preconditions;->checkNotNull(Ljava/lang/Object;)Ljava/lang/Object;
|
|
|
|
.line 3
|
|
invoke-static {p2}, Lcom/google/firebase/components/Preconditions;->checkNotNull(Ljava/lang/Object;)Ljava/lang/Object;
|
|
|
|
.line 4
|
|
iget-object v0, p0, Lcom/google/firebase/components/EventBus;->handlerMap:Ljava/util/Map;
|
|
|
|
invoke-interface {v0, p1}, Ljava/util/Map;->containsKey(Ljava/lang/Object;)Z
|
|
|
|
move-result v0
|
|
|
|
if-nez v0, :cond_0
|
|
|
|
.line 5
|
|
iget-object v0, p0, Lcom/google/firebase/components/EventBus;->handlerMap:Ljava/util/Map;
|
|
|
|
new-instance v1, Ljava/util/concurrent/ConcurrentHashMap;
|
|
|
|
invoke-direct {v1}, Ljava/util/concurrent/ConcurrentHashMap;-><init>()V
|
|
|
|
invoke-interface {v0, p1, v1}, Ljava/util/Map;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
|
|
|
|
.line 6
|
|
:cond_0
|
|
iget-object v0, p0, Lcom/google/firebase/components/EventBus;->handlerMap:Ljava/util/Map;
|
|
|
|
invoke-interface {v0, p1}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object;
|
|
|
|
move-result-object p1
|
|
|
|
check-cast p1, Ljava/util/concurrent/ConcurrentHashMap;
|
|
|
|
invoke-virtual {p1, p3, p2}, Ljava/util/concurrent/ConcurrentHashMap;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
|
|
:try_end_0
|
|
.catchall {:try_start_0 .. :try_end_0} :catchall_0
|
|
|
|
.line 7
|
|
monitor-exit p0
|
|
|
|
return-void
|
|
|
|
:catchall_0
|
|
move-exception p1
|
|
|
|
monitor-exit p0
|
|
|
|
throw p1
|
|
.end method
|
|
|
|
.method public declared-synchronized unsubscribe(Ljava/lang/Class;Lcom/google/firebase/events/EventHandler;)V
|
|
.locals 1
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"<T:",
|
|
"Ljava/lang/Object;",
|
|
">(",
|
|
"Ljava/lang/Class<",
|
|
"TT;>;",
|
|
"Lcom/google/firebase/events/EventHandler<",
|
|
"-TT;>;)V"
|
|
}
|
|
.end annotation
|
|
|
|
monitor-enter p0
|
|
|
|
.line 1
|
|
:try_start_0
|
|
invoke-static {p1}, Lcom/google/firebase/components/Preconditions;->checkNotNull(Ljava/lang/Object;)Ljava/lang/Object;
|
|
|
|
.line 2
|
|
invoke-static {p2}, Lcom/google/firebase/components/Preconditions;->checkNotNull(Ljava/lang/Object;)Ljava/lang/Object;
|
|
|
|
.line 3
|
|
iget-object v0, p0, Lcom/google/firebase/components/EventBus;->handlerMap:Ljava/util/Map;
|
|
|
|
invoke-interface {v0, p1}, Ljava/util/Map;->containsKey(Ljava/lang/Object;)Z
|
|
|
|
move-result v0
|
|
:try_end_0
|
|
.catchall {:try_start_0 .. :try_end_0} :catchall_0
|
|
|
|
if-nez v0, :cond_0
|
|
|
|
.line 4
|
|
monitor-exit p0
|
|
|
|
return-void
|
|
|
|
.line 5
|
|
:cond_0
|
|
:try_start_1
|
|
iget-object v0, p0, Lcom/google/firebase/components/EventBus;->handlerMap:Ljava/util/Map;
|
|
|
|
invoke-interface {v0, p1}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object;
|
|
|
|
move-result-object v0
|
|
|
|
check-cast v0, Ljava/util/concurrent/ConcurrentHashMap;
|
|
|
|
.line 6
|
|
invoke-virtual {v0, p2}, Ljava/util/concurrent/ConcurrentHashMap;->remove(Ljava/lang/Object;)Ljava/lang/Object;
|
|
|
|
.line 7
|
|
invoke-virtual {v0}, Ljava/util/concurrent/ConcurrentHashMap;->isEmpty()Z
|
|
|
|
move-result p2
|
|
|
|
if-eqz p2, :cond_1
|
|
|
|
.line 8
|
|
iget-object p2, p0, Lcom/google/firebase/components/EventBus;->handlerMap:Ljava/util/Map;
|
|
|
|
invoke-interface {p2, p1}, Ljava/util/Map;->remove(Ljava/lang/Object;)Ljava/lang/Object;
|
|
:try_end_1
|
|
.catchall {:try_start_1 .. :try_end_1} :catchall_0
|
|
|
|
.line 9
|
|
:cond_1
|
|
monitor-exit p0
|
|
|
|
return-void
|
|
|
|
:catchall_0
|
|
move-exception p1
|
|
|
|
monitor-exit p0
|
|
|
|
throw p1
|
|
.end method
|