32 lines
870 B
Java
32 lines
870 B
Java
|
package com.google.firebase.components;
|
||
|
|
||
|
import com.google.firebase.inject.Provider;
|
||
|
|
||
|
/* loaded from: classes.dex */
|
||
|
public class Lazy<T> implements Provider<T> {
|
||
|
private static final Object UNINITIALIZED = new Object();
|
||
|
private volatile Object instance = UNINITIALIZED;
|
||
|
private volatile Provider<T> provider;
|
||
|
|
||
|
public Lazy(Provider<T> provider) {
|
||
|
this.provider = provider;
|
||
|
}
|
||
|
|
||
|
@Override // com.google.firebase.inject.Provider
|
||
|
public T get() {
|
||
|
T t = (T) this.instance;
|
||
|
Object obj = UNINITIALIZED;
|
||
|
if (t == obj) {
|
||
|
synchronized (this) {
|
||
|
t = (T) this.instance;
|
||
|
if (t == obj) {
|
||
|
t = this.provider.get();
|
||
|
this.instance = t;
|
||
|
this.provider = null;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
return t;
|
||
|
}
|
||
|
}
|