404 lines
8.6 KiB
Smali
404 lines
8.6 KiB
Smali
.class public Lorg/chromium/base/ThreadUtils;
|
|
.super Ljava/lang/Object;
|
|
.source "ThreadUtils.java"
|
|
|
|
|
|
# static fields
|
|
.field private static final a:Ljava/lang/Object;
|
|
|
|
.field private static b:Z
|
|
|
|
.field private static c:Landroid/os/Handler;
|
|
|
|
.field private static d:Z
|
|
|
|
|
|
# direct methods
|
|
.method static constructor <clinit>()V
|
|
.locals 1
|
|
|
|
.line 1
|
|
new-instance v0, Ljava/lang/Object;
|
|
|
|
invoke-direct {v0}, Ljava/lang/Object;-><init>()V
|
|
|
|
sput-object v0, Lorg/chromium/base/ThreadUtils;->a:Ljava/lang/Object;
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public constructor <init>()V
|
|
.locals 0
|
|
|
|
.line 1
|
|
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public static a(Ljava/util/concurrent/Callable;)Ljava/lang/Object;
|
|
.locals 2
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"<T:",
|
|
"Ljava/lang/Object;",
|
|
">(",
|
|
"Ljava/util/concurrent/Callable<",
|
|
"TT;>;)TT;"
|
|
}
|
|
.end annotation
|
|
|
|
.annotation system Ldalvik/annotation/Throws;
|
|
value = {
|
|
Ljava/util/concurrent/ExecutionException;
|
|
}
|
|
.end annotation
|
|
|
|
.annotation runtime Ljava/lang/Deprecated;
|
|
.end annotation
|
|
|
|
.line 1
|
|
new-instance v0, Ljava/util/concurrent/FutureTask;
|
|
|
|
invoke-direct {v0, p0}, Ljava/util/concurrent/FutureTask;-><init>(Ljava/util/concurrent/Callable;)V
|
|
|
|
.line 2
|
|
invoke-static {v0}, Lorg/chromium/base/ThreadUtils;->b(Ljava/util/concurrent/FutureTask;)Ljava/util/concurrent/FutureTask;
|
|
|
|
.line 3
|
|
:try_start_0
|
|
invoke-virtual {v0}, Ljava/util/concurrent/FutureTask;->get()Ljava/lang/Object;
|
|
|
|
move-result-object p0
|
|
:try_end_0
|
|
.catch Ljava/lang/InterruptedException; {:try_start_0 .. :try_end_0} :catch_0
|
|
|
|
return-object p0
|
|
|
|
:catch_0
|
|
move-exception p0
|
|
|
|
.line 4
|
|
new-instance v0, Ljava/lang/RuntimeException;
|
|
|
|
const-string v1, "Interrupted waiting for callable"
|
|
|
|
invoke-direct {v0, v1, p0}, Ljava/lang/RuntimeException;-><init>(Ljava/lang/String;Ljava/lang/Throwable;)V
|
|
|
|
throw v0
|
|
.end method
|
|
|
|
.method public static a(Ljava/util/concurrent/FutureTask;)Ljava/util/concurrent/FutureTask;
|
|
.locals 1
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"<T:",
|
|
"Ljava/lang/Object;",
|
|
">(",
|
|
"Ljava/util/concurrent/FutureTask<",
|
|
"TT;>;)",
|
|
"Ljava/util/concurrent/FutureTask<",
|
|
"TT;>;"
|
|
}
|
|
.end annotation
|
|
|
|
.annotation runtime Ljava/lang/Deprecated;
|
|
.end annotation
|
|
|
|
.line 5
|
|
invoke-static {}, Lorg/chromium/base/ThreadUtils;->c()Landroid/os/Handler;
|
|
|
|
move-result-object v0
|
|
|
|
invoke-virtual {v0, p0}, Landroid/os/Handler;->post(Ljava/lang/Runnable;)Z
|
|
|
|
return-object p0
|
|
.end method
|
|
|
|
.method public static a()V
|
|
.locals 1
|
|
|
|
.line 7
|
|
sget-boolean v0, Lorg/chromium/base/ThreadUtils;->d:Z
|
|
|
|
if-eqz v0, :cond_0
|
|
|
|
:cond_0
|
|
return-void
|
|
.end method
|
|
|
|
.method public static a(Ljava/lang/Runnable;)V
|
|
.locals 1
|
|
.annotation runtime Ljava/lang/Deprecated;
|
|
.end annotation
|
|
|
|
.line 6
|
|
invoke-static {}, Lorg/chromium/base/ThreadUtils;->c()Landroid/os/Handler;
|
|
|
|
move-result-object v0
|
|
|
|
invoke-virtual {v0, p0}, Landroid/os/Handler;->post(Ljava/lang/Runnable;)Z
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public static b(Ljava/util/concurrent/Callable;)Ljava/lang/Object;
|
|
.locals 2
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"<T:",
|
|
"Ljava/lang/Object;",
|
|
">(",
|
|
"Ljava/util/concurrent/Callable<",
|
|
"TT;>;)TT;"
|
|
}
|
|
.end annotation
|
|
|
|
.annotation runtime Ljava/lang/Deprecated;
|
|
.end annotation
|
|
|
|
.line 1
|
|
:try_start_0
|
|
invoke-static {p0}, Lorg/chromium/base/ThreadUtils;->a(Ljava/util/concurrent/Callable;)Ljava/lang/Object;
|
|
|
|
move-result-object p0
|
|
:try_end_0
|
|
.catch Ljava/util/concurrent/ExecutionException; {:try_start_0 .. :try_end_0} :catch_0
|
|
|
|
return-object p0
|
|
|
|
:catch_0
|
|
move-exception p0
|
|
|
|
.line 2
|
|
new-instance v0, Ljava/lang/RuntimeException;
|
|
|
|
const-string v1, "Error occurred waiting for callable"
|
|
|
|
invoke-direct {v0, v1, p0}, Ljava/lang/RuntimeException;-><init>(Ljava/lang/String;Ljava/lang/Throwable;)V
|
|
|
|
throw v0
|
|
.end method
|
|
|
|
.method public static b(Ljava/util/concurrent/FutureTask;)Ljava/util/concurrent/FutureTask;
|
|
.locals 1
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"<T:",
|
|
"Ljava/lang/Object;",
|
|
">(",
|
|
"Ljava/util/concurrent/FutureTask<",
|
|
"TT;>;)",
|
|
"Ljava/util/concurrent/FutureTask<",
|
|
"TT;>;"
|
|
}
|
|
.end annotation
|
|
|
|
.annotation runtime Ljava/lang/Deprecated;
|
|
.end annotation
|
|
|
|
.line 3
|
|
invoke-static {}, Lorg/chromium/base/ThreadUtils;->e()Z
|
|
|
|
move-result v0
|
|
|
|
if-eqz v0, :cond_0
|
|
|
|
.line 4
|
|
invoke-virtual {p0}, Ljava/util/concurrent/FutureTask;->run()V
|
|
|
|
goto :goto_0
|
|
|
|
.line 5
|
|
:cond_0
|
|
invoke-static {p0}, Lorg/chromium/base/ThreadUtils;->a(Ljava/util/concurrent/FutureTask;)Ljava/util/concurrent/FutureTask;
|
|
|
|
:goto_0
|
|
return-object p0
|
|
.end method
|
|
|
|
.method public static b()V
|
|
.locals 1
|
|
|
|
.line 9
|
|
sget-boolean v0, Lorg/chromium/base/ThreadUtils;->d:Z
|
|
|
|
if-eqz v0, :cond_0
|
|
|
|
:cond_0
|
|
return-void
|
|
.end method
|
|
|
|
.method public static b(Ljava/lang/Runnable;)V
|
|
.locals 1
|
|
.annotation runtime Ljava/lang/Deprecated;
|
|
.end annotation
|
|
|
|
.line 6
|
|
invoke-static {}, Lorg/chromium/base/ThreadUtils;->e()Z
|
|
|
|
move-result v0
|
|
|
|
if-eqz v0, :cond_0
|
|
|
|
.line 7
|
|
invoke-interface {p0}, Ljava/lang/Runnable;->run()V
|
|
|
|
goto :goto_0
|
|
|
|
.line 8
|
|
:cond_0
|
|
invoke-static {}, Lorg/chromium/base/ThreadUtils;->c()Landroid/os/Handler;
|
|
|
|
move-result-object v0
|
|
|
|
invoke-virtual {v0, p0}, Landroid/os/Handler;->post(Ljava/lang/Runnable;)Z
|
|
|
|
:goto_0
|
|
return-void
|
|
.end method
|
|
|
|
.method public static c()Landroid/os/Handler;
|
|
.locals 3
|
|
|
|
.line 1
|
|
sget-object v0, Lorg/chromium/base/ThreadUtils;->a:Ljava/lang/Object;
|
|
|
|
monitor-enter v0
|
|
|
|
.line 2
|
|
:try_start_0
|
|
sget-object v1, Lorg/chromium/base/ThreadUtils;->c:Landroid/os/Handler;
|
|
|
|
if-nez v1, :cond_1
|
|
|
|
.line 3
|
|
sget-boolean v1, Lorg/chromium/base/ThreadUtils;->b:Z
|
|
|
|
if-nez v1, :cond_0
|
|
|
|
.line 4
|
|
new-instance v1, Landroid/os/Handler;
|
|
|
|
invoke-static {}, Landroid/os/Looper;->getMainLooper()Landroid/os/Looper;
|
|
|
|
move-result-object v2
|
|
|
|
invoke-direct {v1, v2}, Landroid/os/Handler;-><init>(Landroid/os/Looper;)V
|
|
|
|
sput-object v1, Lorg/chromium/base/ThreadUtils;->c:Landroid/os/Handler;
|
|
|
|
goto :goto_0
|
|
|
|
.line 5
|
|
:cond_0
|
|
new-instance v1, Ljava/lang/RuntimeException;
|
|
|
|
const-string v2, "Did not yet override the UI thread"
|
|
|
|
invoke-direct {v1, v2}, Ljava/lang/RuntimeException;-><init>(Ljava/lang/String;)V
|
|
|
|
throw v1
|
|
|
|
.line 6
|
|
:cond_1
|
|
:goto_0
|
|
sget-object v1, Lorg/chromium/base/ThreadUtils;->c:Landroid/os/Handler;
|
|
|
|
monitor-exit v0
|
|
|
|
return-object v1
|
|
|
|
:catchall_0
|
|
move-exception v1
|
|
|
|
.line 7
|
|
monitor-exit v0
|
|
:try_end_0
|
|
.catchall {:try_start_0 .. :try_end_0} :catchall_0
|
|
|
|
throw v1
|
|
.end method
|
|
|
|
.method public static d()Landroid/os/Looper;
|
|
.locals 1
|
|
|
|
.line 1
|
|
invoke-static {}, Lorg/chromium/base/ThreadUtils;->c()Landroid/os/Handler;
|
|
|
|
move-result-object v0
|
|
|
|
invoke-virtual {v0}, Landroid/os/Handler;->getLooper()Landroid/os/Looper;
|
|
|
|
move-result-object v0
|
|
|
|
return-object v0
|
|
.end method
|
|
|
|
.method public static e()Z
|
|
.locals 2
|
|
|
|
.line 1
|
|
invoke-static {}, Lorg/chromium/base/ThreadUtils;->c()Landroid/os/Handler;
|
|
|
|
move-result-object v0
|
|
|
|
invoke-virtual {v0}, Landroid/os/Handler;->getLooper()Landroid/os/Looper;
|
|
|
|
move-result-object v0
|
|
|
|
invoke-static {}, Landroid/os/Looper;->myLooper()Landroid/os/Looper;
|
|
|
|
move-result-object v1
|
|
|
|
if-ne v0, v1, :cond_0
|
|
|
|
const/4 v0, 0x1
|
|
|
|
goto :goto_0
|
|
|
|
:cond_0
|
|
const/4 v0, 0x0
|
|
|
|
:goto_0
|
|
return v0
|
|
.end method
|
|
|
|
.method private static isThreadPriorityAudio(I)Z
|
|
.locals 1
|
|
.annotation build Lorg/chromium/base/annotations/CalledByNative;
|
|
.end annotation
|
|
|
|
.line 1
|
|
invoke-static {p0}, Landroid/os/Process;->getThreadPriority(I)I
|
|
|
|
move-result p0
|
|
|
|
const/16 v0, -0x10
|
|
|
|
if-ne p0, v0, :cond_0
|
|
|
|
const/4 p0, 0x1
|
|
|
|
goto :goto_0
|
|
|
|
:cond_0
|
|
const/4 p0, 0x0
|
|
|
|
:goto_0
|
|
return p0
|
|
.end method
|
|
|
|
.method public static setThreadPriorityAudio(I)V
|
|
.locals 1
|
|
.annotation build Lorg/chromium/base/annotations/CalledByNative;
|
|
.end annotation
|
|
|
|
const/16 v0, -0x10
|
|
|
|
.line 1
|
|
invoke-static {p0, v0}, Landroid/os/Process;->setThreadPriority(II)V
|
|
|
|
return-void
|
|
.end method
|