granularity level: instruction
.class Lcom/google/firebase/components/EventBus;
.super Ljava/lang/Object;
.source "EventBus.java"
.implements Lcom/google/firebase/events/Subscriber;
.implements Lcom/google/firebase/events/Publisher;
.field private final defaultExecutor:Ljava/util/concurrent/Executor;
.field private final handlerMap:Ljava/util/Map;
.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 system Ldalvik/annotation/Signature;
value = {
"Ljava/util/Queue<",
"Lcom/google/firebase/events/Event<",
"*>;>;"
}
.end annotation
.end field
.method constructor <init>(Ljava/util/concurrent/Executor;)V
.locals 1
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
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;
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;
iput-object p1, p0, Lcom/google/firebase/components/EventBus;->defaultExecutor:Ljava/util/concurrent/Executor;
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
: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
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 static synthetic lambda$publish$0(Ljava/util/Map$Entry;Lcom/google/firebase/events/Event;)V
.locals 0
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
.method enablePublishingAndFlushPending()V
.locals 2
monitor-enter p0
: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
iput-object v1, p0, Lcom/google/firebase/components/EventBus;->pendingEvents:Ljava/util/Queue;
goto :goto_0
:cond_0
move-object v0, v1
:goto_0
monitor-exit p0
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
if-eqz v0, :cond_1
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;
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
: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
invoke-static {p1}, Lcom/google/firebase/components/Preconditions;->checkNotNull(Ljava/lang/Object;)Ljava/lang/Object;
monitor-enter p0
:try_start_0
iget-object v0, p0, Lcom/google/firebase/components/EventBus;->pendingEvents:Ljava/util/Queue;
if-eqz v0, :cond_0
invoke-interface {v0, p1}, Ljava/util/Queue;->add(Ljava/lang/Object;)Z
monitor-exit p0
return-void
:cond_0
monitor-exit p0
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
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;
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/EventBus$$ExternalSyntheticLambda0;
invoke-direct {v3, v1, p1}, Lcom/google/firebase/components/EventBus$$ExternalSyntheticLambda0;-><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
: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
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
:try_start_0
invoke-static {p1}, Lcom/google/firebase/components/Preconditions;->checkNotNull(Ljava/lang/Object;)Ljava/lang/Object;
invoke-static {p3}, Lcom/google/firebase/components/Preconditions;->checkNotNull(Ljava/lang/Object;)Ljava/lang/Object;
invoke-static {p2}, Lcom/google/firebase/components/Preconditions;->checkNotNull(Ljava/lang/Object;)Ljava/lang/Object;
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
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;
: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
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
:try_start_0
invoke-static {p1}, Lcom/google/firebase/components/Preconditions;->checkNotNull(Ljava/lang/Object;)Ljava/lang/Object;
invoke-static {p2}, Lcom/google/firebase/components/Preconditions;->checkNotNull(Ljava/lang/Object;)Ljava/lang/Object;
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
monitor-exit p0
return-void
:try_start_1
: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 v0
check-cast v0, Ljava/util/concurrent/ConcurrentHashMap;
invoke-virtual {v0, p2}, Ljava/util/concurrent/ConcurrentHashMap;->remove(Ljava/lang/Object;)Ljava/lang/Object;
invoke-virtual {v0}, Ljava/util/concurrent/ConcurrentHashMap;->isEmpty()Z
move-result p2
if-eqz p2, :cond_1
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
:cond_1
monitor-exit p0
return-void
:catchall_0
move-exception p1
monitor-exit p0
throw p1
.end method