package com.google.android.gms.internal.ads; import com.google.android.gms.common.internal.Preconditions; /* loaded from: classes3.dex */ public final class zzbnr extends zzcai { private final com.google.android.gms.ads.internal.util.zzbd zzb; private final Object zza = new Object(); private boolean zzc = false; private int zzd = 0; public zzbnr(com.google.android.gms.ads.internal.util.zzbd zzbdVar) { this.zzb = zzbdVar; } public final zzbnm zza() { zzbnm zzbnmVar = new zzbnm(this); com.google.android.gms.ads.internal.util.zze.zza("createNewReference: Trying to acquire lock"); synchronized (this.zza) { com.google.android.gms.ads.internal.util.zze.zza("createNewReference: Lock acquired"); zzj(new zzbnn(this, zzbnmVar), new zzbno(this, zzbnmVar)); Preconditions.checkState(this.zzd >= 0); this.zzd++; } com.google.android.gms.ads.internal.util.zze.zza("createNewReference: Lock released"); return zzbnmVar; } public final void zzb() { com.google.android.gms.ads.internal.util.zze.zza("markAsDestroyable: Trying to acquire lock"); synchronized (this.zza) { com.google.android.gms.ads.internal.util.zze.zza("markAsDestroyable: Lock acquired"); Preconditions.checkState(this.zzd >= 0); com.google.android.gms.ads.internal.util.zze.zza("Releasing root reference. JS Engine will be destroyed once other references are released."); this.zzc = true; zzc(); } com.google.android.gms.ads.internal.util.zze.zza("markAsDestroyable: Lock released"); } public final void zzc() { com.google.android.gms.ads.internal.util.zze.zza("maybeDestroy: Trying to acquire lock"); synchronized (this.zza) { try { com.google.android.gms.ads.internal.util.zze.zza("maybeDestroy: Lock acquired"); Preconditions.checkState(this.zzd >= 0); if (this.zzc && this.zzd == 0) { com.google.android.gms.ads.internal.util.zze.zza("No reference is left (including root). Cleaning up engine."); zzj(new zzbnq(this), new zzcae()); } else { com.google.android.gms.ads.internal.util.zze.zza("There are still references to the engine. Not destroying."); } } catch (Throwable th) { throw th; } } com.google.android.gms.ads.internal.util.zze.zza("maybeDestroy: Lock released"); } public final void zzd() { com.google.android.gms.ads.internal.util.zze.zza("releaseOneReference: Trying to acquire lock"); synchronized (this.zza) { com.google.android.gms.ads.internal.util.zze.zza("releaseOneReference: Lock acquired"); Preconditions.checkState(this.zzd > 0); com.google.android.gms.ads.internal.util.zze.zza("Releasing 1 reference for JS Engine"); this.zzd--; zzc(); } com.google.android.gms.ads.internal.util.zze.zza("releaseOneReference: Lock released"); } }