393 lines
12 KiB
Smali
393 lines
12 KiB
Smali
.class public final Lcom/google/firebase/concurrent/SequentialExecutor;
|
|
.super Ljava/lang/Object;
|
|
.source "SourceFile"
|
|
|
|
# interfaces
|
|
.implements Ljava/util/concurrent/Executor;
|
|
|
|
|
|
# annotations
|
|
.annotation system Ldalvik/annotation/MemberClasses;
|
|
value = {
|
|
Lcom/google/firebase/concurrent/SequentialExecutor$WorkerRunningState;,
|
|
Lcom/google/firebase/concurrent/SequentialExecutor$QueueWorker;
|
|
}
|
|
.end annotation
|
|
|
|
|
|
# static fields
|
|
.field public static final log:Ljava/util/logging/Logger;
|
|
|
|
|
|
# instance fields
|
|
.field public final executor:Ljava/util/concurrent/Executor;
|
|
|
|
.field public final queue:Ljava/util/Deque;
|
|
|
|
.field public final worker:Lcom/google/firebase/concurrent/SequentialExecutor$QueueWorker;
|
|
|
|
.field public workerRunCount:J
|
|
|
|
.field public workerRunningState:Lcom/google/firebase/concurrent/SequentialExecutor$WorkerRunningState;
|
|
|
|
|
|
# direct methods
|
|
.method static constructor <clinit>()V
|
|
.locals 1
|
|
|
|
const-class v0, Lcom/google/firebase/concurrent/SequentialExecutor;
|
|
|
|
.line 48
|
|
invoke-virtual {v0}, Ljava/lang/Class;->getName()Ljava/lang/String;
|
|
|
|
move-result-object v0
|
|
|
|
invoke-static {v0}, Ljava/util/logging/Logger;->getLogger(Ljava/lang/String;)Ljava/util/logging/Logger;
|
|
|
|
move-result-object v0
|
|
|
|
sput-object v0, Lcom/google/firebase/concurrent/SequentialExecutor;->log:Ljava/util/logging/Logger;
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public constructor <init>(Ljava/util/concurrent/Executor;)V
|
|
.locals 2
|
|
|
|
.line 82
|
|
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
|
|
|
|
.line 63
|
|
new-instance v0, Ljava/util/ArrayDeque;
|
|
|
|
invoke-direct {v0}, Ljava/util/ArrayDeque;-><init>()V
|
|
|
|
iput-object v0, p0, Lcom/google/firebase/concurrent/SequentialExecutor;->queue:Ljava/util/Deque;
|
|
|
|
.line 67
|
|
sget-object v0, Lcom/google/firebase/concurrent/SequentialExecutor$WorkerRunningState;->IDLE:Lcom/google/firebase/concurrent/SequentialExecutor$WorkerRunningState;
|
|
|
|
iput-object v0, p0, Lcom/google/firebase/concurrent/SequentialExecutor;->workerRunningState:Lcom/google/firebase/concurrent/SequentialExecutor$WorkerRunningState;
|
|
|
|
const-wide/16 v0, 0x0
|
|
|
|
iput-wide v0, p0, Lcom/google/firebase/concurrent/SequentialExecutor;->workerRunCount:J
|
|
|
|
.line 80
|
|
new-instance v0, Lcom/google/firebase/concurrent/SequentialExecutor$QueueWorker;
|
|
|
|
const/4 v1, 0x0
|
|
|
|
invoke-direct {v0, p0, v1}, Lcom/google/firebase/concurrent/SequentialExecutor$QueueWorker;-><init>(Lcom/google/firebase/concurrent/SequentialExecutor;Lcom/google/firebase/concurrent/SequentialExecutor$1;)V
|
|
|
|
iput-object v0, p0, Lcom/google/firebase/concurrent/SequentialExecutor;->worker:Lcom/google/firebase/concurrent/SequentialExecutor$QueueWorker;
|
|
|
|
.line 83
|
|
invoke-static {p1}, Lcom/google/android/gms/common/internal/Preconditions;->checkNotNull(Ljava/lang/Object;)Ljava/lang/Object;
|
|
|
|
move-result-object p1
|
|
|
|
check-cast p1, Ljava/util/concurrent/Executor;
|
|
|
|
iput-object p1, p0, Lcom/google/firebase/concurrent/SequentialExecutor;->executor:Ljava/util/concurrent/Executor;
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public static synthetic access$100(Lcom/google/firebase/concurrent/SequentialExecutor;)Ljava/util/Deque;
|
|
.locals 0
|
|
|
|
.line 47
|
|
iget-object p0, p0, Lcom/google/firebase/concurrent/SequentialExecutor;->queue:Ljava/util/Deque;
|
|
|
|
return-object p0
|
|
.end method
|
|
|
|
.method public static synthetic access$200(Lcom/google/firebase/concurrent/SequentialExecutor;)Lcom/google/firebase/concurrent/SequentialExecutor$WorkerRunningState;
|
|
.locals 0
|
|
|
|
.line 47
|
|
iget-object p0, p0, Lcom/google/firebase/concurrent/SequentialExecutor;->workerRunningState:Lcom/google/firebase/concurrent/SequentialExecutor$WorkerRunningState;
|
|
|
|
return-object p0
|
|
.end method
|
|
|
|
.method public static synthetic access$202(Lcom/google/firebase/concurrent/SequentialExecutor;Lcom/google/firebase/concurrent/SequentialExecutor$WorkerRunningState;)Lcom/google/firebase/concurrent/SequentialExecutor$WorkerRunningState;
|
|
.locals 0
|
|
|
|
.line 47
|
|
iput-object p1, p0, Lcom/google/firebase/concurrent/SequentialExecutor;->workerRunningState:Lcom/google/firebase/concurrent/SequentialExecutor$WorkerRunningState;
|
|
|
|
return-object p1
|
|
.end method
|
|
|
|
.method public static synthetic access$308(Lcom/google/firebase/concurrent/SequentialExecutor;)J
|
|
.locals 4
|
|
|
|
.line 47
|
|
iget-wide v0, p0, Lcom/google/firebase/concurrent/SequentialExecutor;->workerRunCount:J
|
|
|
|
const-wide/16 v2, 0x1
|
|
|
|
add-long/2addr v2, v0
|
|
|
|
iput-wide v2, p0, Lcom/google/firebase/concurrent/SequentialExecutor;->workerRunCount:J
|
|
|
|
return-wide v0
|
|
.end method
|
|
|
|
.method public static synthetic access$400()Ljava/util/logging/Logger;
|
|
.locals 1
|
|
|
|
sget-object v0, Lcom/google/firebase/concurrent/SequentialExecutor;->log:Ljava/util/logging/Logger;
|
|
|
|
return-object v0
|
|
.end method
|
|
|
|
|
|
# virtual methods
|
|
.method public execute(Ljava/lang/Runnable;)V
|
|
.locals 7
|
|
|
|
.line 94
|
|
invoke-static {p1}, Lcom/google/android/gms/common/internal/Preconditions;->checkNotNull(Ljava/lang/Object;)Ljava/lang/Object;
|
|
|
|
iget-object v0, p0, Lcom/google/firebase/concurrent/SequentialExecutor;->queue:Ljava/util/Deque;
|
|
|
|
.line 97
|
|
monitor-enter v0
|
|
|
|
:try_start_0
|
|
iget-object v1, p0, Lcom/google/firebase/concurrent/SequentialExecutor;->workerRunningState:Lcom/google/firebase/concurrent/SequentialExecutor$WorkerRunningState;
|
|
|
|
.line 100
|
|
sget-object v2, Lcom/google/firebase/concurrent/SequentialExecutor$WorkerRunningState;->RUNNING:Lcom/google/firebase/concurrent/SequentialExecutor$WorkerRunningState;
|
|
|
|
if-eq v1, v2, :cond_6
|
|
|
|
sget-object v2, Lcom/google/firebase/concurrent/SequentialExecutor$WorkerRunningState;->QUEUED:Lcom/google/firebase/concurrent/SequentialExecutor$WorkerRunningState;
|
|
|
|
if-ne v1, v2, :cond_0
|
|
|
|
goto :goto_6
|
|
|
|
:cond_0
|
|
iget-wide v3, p0, Lcom/google/firebase/concurrent/SequentialExecutor;->workerRunCount:J
|
|
|
|
.line 113
|
|
new-instance v1, Lcom/google/firebase/concurrent/SequentialExecutor$1;
|
|
|
|
invoke-direct {v1, p0, p1}, Lcom/google/firebase/concurrent/SequentialExecutor$1;-><init>(Lcom/google/firebase/concurrent/SequentialExecutor;Ljava/lang/Runnable;)V
|
|
|
|
iget-object p1, p0, Lcom/google/firebase/concurrent/SequentialExecutor;->queue:Ljava/util/Deque;
|
|
|
|
.line 125
|
|
invoke-interface {p1, v1}, Ljava/util/Deque;->add(Ljava/lang/Object;)Z
|
|
|
|
.line 126
|
|
sget-object p1, Lcom/google/firebase/concurrent/SequentialExecutor$WorkerRunningState;->QUEUING:Lcom/google/firebase/concurrent/SequentialExecutor$WorkerRunningState;
|
|
|
|
iput-object p1, p0, Lcom/google/firebase/concurrent/SequentialExecutor;->workerRunningState:Lcom/google/firebase/concurrent/SequentialExecutor$WorkerRunningState;
|
|
|
|
.line 127
|
|
monitor-exit v0
|
|
:try_end_0
|
|
.catchall {:try_start_0 .. :try_end_0} :catchall_2
|
|
|
|
:try_start_1
|
|
iget-object v0, p0, Lcom/google/firebase/concurrent/SequentialExecutor;->executor:Ljava/util/concurrent/Executor;
|
|
|
|
iget-object v5, p0, Lcom/google/firebase/concurrent/SequentialExecutor;->worker:Lcom/google/firebase/concurrent/SequentialExecutor$QueueWorker;
|
|
|
|
.line 130
|
|
invoke-interface {v0, v5}, Ljava/util/concurrent/Executor;->execute(Ljava/lang/Runnable;)V
|
|
:try_end_1
|
|
.catch Ljava/lang/RuntimeException; {:try_start_1 .. :try_end_1} :catch_1
|
|
.catch Ljava/lang/Error; {:try_start_1 .. :try_end_1} :catch_0
|
|
|
|
iget-object v0, p0, Lcom/google/firebase/concurrent/SequentialExecutor;->workerRunningState:Lcom/google/firebase/concurrent/SequentialExecutor$WorkerRunningState;
|
|
|
|
if-eq v0, p1, :cond_1
|
|
|
|
return-void
|
|
|
|
:cond_1
|
|
iget-object v0, p0, Lcom/google/firebase/concurrent/SequentialExecutor;->queue:Ljava/util/Deque;
|
|
|
|
.line 160
|
|
monitor-enter v0
|
|
|
|
:try_start_2
|
|
iget-wide v5, p0, Lcom/google/firebase/concurrent/SequentialExecutor;->workerRunCount:J
|
|
|
|
cmp-long v1, v5, v3
|
|
|
|
if-nez v1, :cond_2
|
|
|
|
iget-object v1, p0, Lcom/google/firebase/concurrent/SequentialExecutor;->workerRunningState:Lcom/google/firebase/concurrent/SequentialExecutor$WorkerRunningState;
|
|
|
|
if-ne v1, p1, :cond_2
|
|
|
|
iput-object v2, p0, Lcom/google/firebase/concurrent/SequentialExecutor;->workerRunningState:Lcom/google/firebase/concurrent/SequentialExecutor$WorkerRunningState;
|
|
|
|
goto :goto_0
|
|
|
|
:catchall_0
|
|
move-exception p1
|
|
|
|
goto :goto_1
|
|
|
|
.line 164
|
|
:cond_2
|
|
:goto_0
|
|
monitor-exit v0
|
|
|
|
return-void
|
|
|
|
:goto_1
|
|
monitor-exit v0
|
|
:try_end_2
|
|
.catchall {:try_start_2 .. :try_end_2} :catchall_0
|
|
|
|
throw p1
|
|
|
|
:catch_0
|
|
move-exception p1
|
|
|
|
goto :goto_2
|
|
|
|
:catch_1
|
|
move-exception p1
|
|
|
|
:goto_2
|
|
iget-object v2, p0, Lcom/google/firebase/concurrent/SequentialExecutor;->queue:Ljava/util/Deque;
|
|
|
|
.line 132
|
|
monitor-enter v2
|
|
|
|
:try_start_3
|
|
iget-object v0, p0, Lcom/google/firebase/concurrent/SequentialExecutor;->workerRunningState:Lcom/google/firebase/concurrent/SequentialExecutor$WorkerRunningState;
|
|
|
|
.line 133
|
|
sget-object v3, Lcom/google/firebase/concurrent/SequentialExecutor$WorkerRunningState;->IDLE:Lcom/google/firebase/concurrent/SequentialExecutor$WorkerRunningState;
|
|
|
|
if-eq v0, v3, :cond_3
|
|
|
|
sget-object v3, Lcom/google/firebase/concurrent/SequentialExecutor$WorkerRunningState;->QUEUING:Lcom/google/firebase/concurrent/SequentialExecutor$WorkerRunningState;
|
|
|
|
if-ne v0, v3, :cond_4
|
|
|
|
goto :goto_3
|
|
|
|
:catchall_1
|
|
move-exception p1
|
|
|
|
goto :goto_5
|
|
|
|
:cond_3
|
|
:goto_3
|
|
iget-object v0, p0, Lcom/google/firebase/concurrent/SequentialExecutor;->queue:Ljava/util/Deque;
|
|
|
|
.line 135
|
|
invoke-interface {v0, v1}, Ljava/util/Deque;->removeLastOccurrence(Ljava/lang/Object;)Z
|
|
|
|
move-result v0
|
|
|
|
if-eqz v0, :cond_4
|
|
|
|
const/4 v0, 0x1
|
|
|
|
goto :goto_4
|
|
|
|
:cond_4
|
|
const/4 v0, 0x0
|
|
|
|
.line 138
|
|
:goto_4
|
|
instance-of v1, p1, Ljava/util/concurrent/RejectedExecutionException;
|
|
|
|
if-eqz v1, :cond_5
|
|
|
|
if-nez v0, :cond_5
|
|
|
|
.line 141
|
|
monitor-exit v2
|
|
|
|
return-void
|
|
|
|
.line 139
|
|
:cond_5
|
|
throw p1
|
|
|
|
.line 141
|
|
:goto_5
|
|
monitor-exit v2
|
|
:try_end_3
|
|
.catchall {:try_start_3 .. :try_end_3} :catchall_1
|
|
|
|
throw p1
|
|
|
|
:catchall_2
|
|
move-exception p1
|
|
|
|
goto :goto_7
|
|
|
|
:cond_6
|
|
:goto_6
|
|
:try_start_4
|
|
iget-object v1, p0, Lcom/google/firebase/concurrent/SequentialExecutor;->queue:Ljava/util/Deque;
|
|
|
|
.line 101
|
|
invoke-interface {v1, p1}, Ljava/util/Deque;->add(Ljava/lang/Object;)Z
|
|
|
|
.line 102
|
|
monitor-exit v0
|
|
|
|
return-void
|
|
|
|
.line 127
|
|
:goto_7
|
|
monitor-exit v0
|
|
:try_end_4
|
|
.catchall {:try_start_4 .. :try_end_4} :catchall_2
|
|
|
|
throw p1
|
|
.end method
|
|
|
|
.method public toString()Ljava/lang/String;
|
|
.locals 2
|
|
|
|
.line 259
|
|
new-instance v0, Ljava/lang/StringBuilder;
|
|
|
|
invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V
|
|
|
|
const-string v1, "SequentialExecutor@"
|
|
|
|
invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
invoke-static {p0}, Ljava/lang/System;->identityHashCode(Ljava/lang/Object;)I
|
|
|
|
move-result v1
|
|
|
|
invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
|
|
|
|
const-string v1, "{"
|
|
|
|
invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
iget-object v1, p0, Lcom/google/firebase/concurrent/SequentialExecutor;->executor:Ljava/util/concurrent/Executor;
|
|
|
|
invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
|
|
|
|
const-string v1, "}"
|
|
|
|
invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
|
|
|
|
move-result-object v0
|
|
|
|
return-object v0
|
|
.end method
|