- Added realracing3-community.apk (71.57 MB) - Removed 32-bit support (armeabi-v7a) - Only includes arm64-v8a libraries - Decompiled source code included - Added README-community.md with analysis
319 lines
11 KiB
Java
319 lines
11 KiB
Java
package androidx.collection;
|
|
|
|
import androidx.annotation.IntRange;
|
|
import androidx.collection.internal.Lock;
|
|
import androidx.collection.internal.LruHashMap;
|
|
import com.ironsource.nb;
|
|
import java.util.Iterator;
|
|
import java.util.LinkedHashMap;
|
|
import java.util.Map;
|
|
import kotlin.Unit;
|
|
import kotlin.jvm.internal.Intrinsics;
|
|
import kotlin.jvm.internal.SourceDebugExtension;
|
|
|
|
@SourceDebugExtension({"SMAP\nLruCache.kt\nKotlin\n*S Kotlin\n*F\n+ 1 LruCache.kt\nandroidx/collection/LruCache\n+ 2 fake.kt\nkotlin/jvm/internal/FakeKt\n+ 3 LockExt.kt\nandroidx/collection/internal/LockExtKt\n+ 4 Lock.jvm.kt\nandroidx/collection/internal/Lock\n+ 5 _Collections.kt\nkotlin/collections/CollectionsKt___CollectionsKt\n*L\n1#1,355:1\n1#2:356\n23#3,3:357\n23#3,3:361\n23#3,3:365\n23#3,3:369\n23#3,3:373\n23#3,3:377\n23#3,3:381\n23#3,3:385\n23#3,3:389\n23#3,3:393\n23#3,3:397\n23#3,3:401\n23#3,3:405\n23#3,3:409\n23#3,3:415\n26#4:360\n26#4:364\n26#4:368\n26#4:372\n26#4:376\n26#4:380\n26#4:384\n26#4:388\n26#4:392\n26#4:396\n26#4:400\n26#4:404\n26#4:408\n26#4:412\n26#4:418\n1855#5,2:413\n*S KotlinDebug\n*F\n+ 1 LruCache.kt\nandroidx/collection/LruCache\n*L\n65#1:357,3\n78#1:361,3\n95#1:365,3\n122#1:369,3\n151#1:373,3\n180#1:377,3\n255#1:381,3\n262#1:385,3\n268#1:389,3\n274#1:393,3\n279#1:397,3\n284#1:401,3\n289#1:405,3\n299#1:409,3\n308#1:415,3\n65#1:360\n78#1:364\n95#1:368\n122#1:372\n151#1:376\n180#1:380\n255#1:384\n262#1:388\n268#1:392\n274#1:396\n279#1:400\n284#1:404\n289#1:408\n299#1:412\n308#1:418\n300#1:413,2\n*E\n"})
|
|
/* loaded from: classes.dex */
|
|
public class LruCache<K, V> {
|
|
private int createCount;
|
|
private int evictionCount;
|
|
private int hitCount;
|
|
private final Lock lock;
|
|
private final LruHashMap<K, V> map;
|
|
private int maxSize;
|
|
private int missCount;
|
|
private int putCount;
|
|
private int size;
|
|
|
|
public V create(K key) {
|
|
Intrinsics.checkNotNullParameter(key, "key");
|
|
return null;
|
|
}
|
|
|
|
public void entryRemoved(boolean z, K key, V oldValue, V v) {
|
|
Intrinsics.checkNotNullParameter(key, "key");
|
|
Intrinsics.checkNotNullParameter(oldValue, "oldValue");
|
|
}
|
|
|
|
public int sizeOf(K key, V value) {
|
|
Intrinsics.checkNotNullParameter(key, "key");
|
|
Intrinsics.checkNotNullParameter(value, "value");
|
|
return 1;
|
|
}
|
|
|
|
public final int createCount() {
|
|
int i;
|
|
synchronized (this.lock) {
|
|
i = this.createCount;
|
|
}
|
|
return i;
|
|
}
|
|
|
|
public final int evictionCount() {
|
|
int i;
|
|
synchronized (this.lock) {
|
|
i = this.evictionCount;
|
|
}
|
|
return i;
|
|
}
|
|
|
|
public final V get(K key) {
|
|
V v;
|
|
Intrinsics.checkNotNullParameter(key, "key");
|
|
synchronized (this.lock) {
|
|
V v2 = this.map.get(key);
|
|
if (v2 != null) {
|
|
this.hitCount++;
|
|
return v2;
|
|
}
|
|
this.missCount++;
|
|
V create = create(key);
|
|
if (create == null) {
|
|
return null;
|
|
}
|
|
synchronized (this.lock) {
|
|
try {
|
|
this.createCount++;
|
|
v = (V) this.map.put(key, create);
|
|
if (v != null) {
|
|
this.map.put(key, v);
|
|
} else {
|
|
this.size += safeSizeOf(key, create);
|
|
Unit unit = Unit.INSTANCE;
|
|
}
|
|
} catch (Throwable th) {
|
|
throw th;
|
|
}
|
|
}
|
|
if (v != null) {
|
|
entryRemoved(false, key, create, v);
|
|
return v;
|
|
}
|
|
trimToSize(this.maxSize);
|
|
return create;
|
|
}
|
|
}
|
|
|
|
public final int hitCount() {
|
|
int i;
|
|
synchronized (this.lock) {
|
|
i = this.hitCount;
|
|
}
|
|
return i;
|
|
}
|
|
|
|
public final int maxSize() {
|
|
int i;
|
|
synchronized (this.lock) {
|
|
i = this.maxSize;
|
|
}
|
|
return i;
|
|
}
|
|
|
|
public final int missCount() {
|
|
int i;
|
|
synchronized (this.lock) {
|
|
i = this.missCount;
|
|
}
|
|
return i;
|
|
}
|
|
|
|
public final V put(K key, V value) {
|
|
V put;
|
|
Intrinsics.checkNotNullParameter(key, "key");
|
|
Intrinsics.checkNotNullParameter(value, "value");
|
|
synchronized (this.lock) {
|
|
try {
|
|
this.putCount++;
|
|
this.size += safeSizeOf(key, value);
|
|
put = this.map.put(key, value);
|
|
if (put != null) {
|
|
this.size -= safeSizeOf(key, put);
|
|
}
|
|
Unit unit = Unit.INSTANCE;
|
|
} catch (Throwable th) {
|
|
throw th;
|
|
}
|
|
}
|
|
if (put != null) {
|
|
entryRemoved(false, key, put, value);
|
|
}
|
|
trimToSize(this.maxSize);
|
|
return put;
|
|
}
|
|
|
|
public final int putCount() {
|
|
int i;
|
|
synchronized (this.lock) {
|
|
i = this.putCount;
|
|
}
|
|
return i;
|
|
}
|
|
|
|
public final V remove(K key) {
|
|
V remove;
|
|
Intrinsics.checkNotNullParameter(key, "key");
|
|
synchronized (this.lock) {
|
|
try {
|
|
remove = this.map.remove(key);
|
|
if (remove != null) {
|
|
this.size -= safeSizeOf(key, remove);
|
|
}
|
|
Unit unit = Unit.INSTANCE;
|
|
} catch (Throwable th) {
|
|
throw th;
|
|
}
|
|
}
|
|
if (remove != null) {
|
|
entryRemoved(false, key, remove, null);
|
|
}
|
|
return remove;
|
|
}
|
|
|
|
public void resize(@IntRange(from = 1, to = Long.MAX_VALUE) int i) {
|
|
if (i > 0) {
|
|
synchronized (this.lock) {
|
|
this.maxSize = i;
|
|
Unit unit = Unit.INSTANCE;
|
|
}
|
|
trimToSize(i);
|
|
return;
|
|
}
|
|
throw new IllegalArgumentException("maxSize <= 0".toString());
|
|
}
|
|
|
|
public final int size() {
|
|
int i;
|
|
synchronized (this.lock) {
|
|
i = this.size;
|
|
}
|
|
return i;
|
|
}
|
|
|
|
public String toString() {
|
|
String str;
|
|
synchronized (this.lock) {
|
|
try {
|
|
int i = this.hitCount;
|
|
int i2 = this.missCount + i;
|
|
str = "LruCache[maxSize=" + this.maxSize + ",hits=" + this.hitCount + ",misses=" + this.missCount + ",hitRate=" + (i2 != 0 ? (i * 100) / i2 : 0) + "%]";
|
|
} catch (Throwable th) {
|
|
throw th;
|
|
}
|
|
}
|
|
return str;
|
|
}
|
|
|
|
/* JADX WARN: Code restructure failed: missing block: B:13:0x0062, code lost:
|
|
|
|
throw new java.lang.IllegalStateException("LruCache.sizeOf() is reporting inconsistent results!".toString());
|
|
*/
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
/*
|
|
Code decompiled incorrectly, please refer to instructions dump.
|
|
To view partially-correct add '--show-bad-code' argument
|
|
*/
|
|
public void trimToSize(int r6) {
|
|
/*
|
|
r5 = this;
|
|
L0:
|
|
androidx.collection.internal.Lock r0 = r5.lock
|
|
monitor-enter(r0)
|
|
int r1 = r5.size // Catch: java.lang.Throwable -> L14
|
|
if (r1 < 0) goto L57
|
|
androidx.collection.internal.LruHashMap<K, V> r1 = r5.map // Catch: java.lang.Throwable -> L14
|
|
boolean r1 = r1.isEmpty() // Catch: java.lang.Throwable -> L14
|
|
if (r1 == 0) goto L16
|
|
int r1 = r5.size // Catch: java.lang.Throwable -> L14
|
|
if (r1 != 0) goto L57
|
|
goto L16
|
|
L14:
|
|
r6 = move-exception
|
|
goto L63
|
|
L16:
|
|
int r1 = r5.size // Catch: java.lang.Throwable -> L14
|
|
if (r1 <= r6) goto L55
|
|
androidx.collection.internal.LruHashMap<K, V> r1 = r5.map // Catch: java.lang.Throwable -> L14
|
|
boolean r1 = r1.isEmpty() // Catch: java.lang.Throwable -> L14
|
|
if (r1 == 0) goto L23
|
|
goto L55
|
|
L23:
|
|
androidx.collection.internal.LruHashMap<K, V> r1 = r5.map // Catch: java.lang.Throwable -> L14
|
|
java.util.Set r1 = r1.getEntries() // Catch: java.lang.Throwable -> L14
|
|
java.lang.Object r1 = kotlin.collections.CollectionsKt.firstOrNull(r1) // Catch: java.lang.Throwable -> L14
|
|
java.util.Map$Entry r1 = (java.util.Map.Entry) r1 // Catch: java.lang.Throwable -> L14
|
|
if (r1 != 0) goto L33
|
|
monitor-exit(r0)
|
|
return
|
|
L33:
|
|
java.lang.Object r2 = r1.getKey() // Catch: java.lang.Throwable -> L14
|
|
java.lang.Object r1 = r1.getValue() // Catch: java.lang.Throwable -> L14
|
|
androidx.collection.internal.LruHashMap<K, V> r3 = r5.map // Catch: java.lang.Throwable -> L14
|
|
r3.remove(r2) // Catch: java.lang.Throwable -> L14
|
|
int r3 = r5.size // Catch: java.lang.Throwable -> L14
|
|
int r4 = r5.safeSizeOf(r2, r1) // Catch: java.lang.Throwable -> L14
|
|
int r3 = r3 - r4
|
|
r5.size = r3 // Catch: java.lang.Throwable -> L14
|
|
int r3 = r5.evictionCount // Catch: java.lang.Throwable -> L14
|
|
r4 = 1
|
|
int r3 = r3 + r4
|
|
r5.evictionCount = r3 // Catch: java.lang.Throwable -> L14
|
|
monitor-exit(r0)
|
|
r0 = 0
|
|
r5.entryRemoved(r4, r2, r1, r0)
|
|
goto L0
|
|
L55:
|
|
monitor-exit(r0)
|
|
return
|
|
L57:
|
|
java.lang.String r6 = "LruCache.sizeOf() is reporting inconsistent results!"
|
|
java.lang.IllegalStateException r1 = new java.lang.IllegalStateException // Catch: java.lang.Throwable -> L14
|
|
java.lang.String r6 = r6.toString() // Catch: java.lang.Throwable -> L14
|
|
r1.<init>(r6) // Catch: java.lang.Throwable -> L14
|
|
throw r1 // Catch: java.lang.Throwable -> L14
|
|
L63:
|
|
monitor-exit(r0)
|
|
throw r6
|
|
*/
|
|
throw new UnsupportedOperationException("Method not decompiled: androidx.collection.LruCache.trimToSize(int):void");
|
|
}
|
|
|
|
public LruCache(@IntRange(from = 1, to = Long.MAX_VALUE) int i) {
|
|
this.maxSize = i;
|
|
if (i <= 0) {
|
|
throw new IllegalArgumentException("maxSize <= 0".toString());
|
|
}
|
|
this.map = new LruHashMap<>(0, 0.75f);
|
|
this.lock = new Lock();
|
|
}
|
|
|
|
private final int safeSizeOf(K k, V v) {
|
|
int sizeOf = sizeOf(k, v);
|
|
if (sizeOf >= 0) {
|
|
return sizeOf;
|
|
}
|
|
throw new IllegalStateException(("Negative size: " + k + nb.T + v).toString());
|
|
}
|
|
|
|
public final void evictAll() {
|
|
trimToSize(-1);
|
|
}
|
|
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
public final Map<K, V> snapshot() {
|
|
LinkedHashMap linkedHashMap = new LinkedHashMap();
|
|
synchronized (this.lock) {
|
|
try {
|
|
Iterator<T> it = this.map.getEntries().iterator();
|
|
while (it.hasNext()) {
|
|
Map.Entry entry = (Map.Entry) it.next();
|
|
linkedHashMap.put(entry.getKey(), entry.getValue());
|
|
}
|
|
Unit unit = Unit.INSTANCE;
|
|
} catch (Throwable th) {
|
|
throw th;
|
|
}
|
|
}
|
|
return linkedHashMap;
|
|
}
|
|
}
|