147 lines
5.4 KiB
Java
147 lines
5.4 KiB
Java
package com.squareup.leakcanary;
|
|
|
|
import com.squareup.leakcanary.Reachability;
|
|
import java.io.File;
|
|
import java.io.Serializable;
|
|
import java.util.ArrayList;
|
|
import java.util.Collections;
|
|
import java.util.List;
|
|
|
|
/* loaded from: classes.dex */
|
|
public final class HeapDump implements Serializable {
|
|
public final boolean computeRetainedHeapSize;
|
|
public final ExcludedRefs excludedRefs;
|
|
public final long gcDurationMs;
|
|
public final long heapDumpDurationMs;
|
|
public final File heapDumpFile;
|
|
public final List<Class<? extends Reachability.Inspector>> reachabilityInspectorClasses;
|
|
public final String referenceKey;
|
|
public final String referenceName;
|
|
public final long watchDurationMs;
|
|
|
|
public interface Listener {
|
|
public static final Listener NONE = new Listener() { // from class: com.squareup.leakcanary.HeapDump.Listener.1
|
|
@Override // com.squareup.leakcanary.HeapDump.Listener
|
|
public void analyze(HeapDump heapDump) {
|
|
}
|
|
};
|
|
|
|
void analyze(HeapDump heapDump);
|
|
}
|
|
|
|
@Deprecated
|
|
public HeapDump(File file, String str, String str2, ExcludedRefs excludedRefs, long j, long j2, long j3) {
|
|
this(new Builder().heapDumpFile(file).referenceKey(str).referenceName(str2).excludedRefs(excludedRefs).computeRetainedHeapSize(true).watchDurationMs(j).gcDurationMs(j2).heapDumpDurationMs(j3));
|
|
}
|
|
|
|
public static Builder builder() {
|
|
return new Builder();
|
|
}
|
|
|
|
public Builder buildUpon() {
|
|
return new Builder(this);
|
|
}
|
|
|
|
public static final class Builder {
|
|
boolean computeRetainedHeapSize;
|
|
ExcludedRefs excludedRefs;
|
|
long gcDurationMs;
|
|
long heapDumpDurationMs;
|
|
File heapDumpFile;
|
|
List<Class<? extends Reachability.Inspector>> reachabilityInspectorClasses;
|
|
String referenceKey;
|
|
String referenceName;
|
|
long watchDurationMs;
|
|
|
|
Builder() {
|
|
this.heapDumpFile = null;
|
|
this.referenceKey = null;
|
|
this.referenceName = "";
|
|
this.excludedRefs = null;
|
|
this.watchDurationMs = 0L;
|
|
this.gcDurationMs = 0L;
|
|
this.heapDumpDurationMs = 0L;
|
|
this.computeRetainedHeapSize = false;
|
|
this.reachabilityInspectorClasses = null;
|
|
}
|
|
|
|
public HeapDump build() {
|
|
Preconditions.checkNotNull(this.excludedRefs, "excludedRefs");
|
|
Preconditions.checkNotNull(this.heapDumpFile, "heapDumpFile");
|
|
Preconditions.checkNotNull(this.referenceKey, "referenceKey");
|
|
Preconditions.checkNotNull(this.reachabilityInspectorClasses, "reachabilityInspectorClasses");
|
|
return new HeapDump(this);
|
|
}
|
|
|
|
public Builder computeRetainedHeapSize(boolean z) {
|
|
this.computeRetainedHeapSize = z;
|
|
return this;
|
|
}
|
|
|
|
public Builder excludedRefs(ExcludedRefs excludedRefs) {
|
|
this.excludedRefs = (ExcludedRefs) Preconditions.checkNotNull(excludedRefs, "excludedRefs");
|
|
return this;
|
|
}
|
|
|
|
public Builder gcDurationMs(long j) {
|
|
this.gcDurationMs = j;
|
|
return this;
|
|
}
|
|
|
|
public Builder heapDumpDurationMs(long j) {
|
|
this.heapDumpDurationMs = j;
|
|
return this;
|
|
}
|
|
|
|
public Builder heapDumpFile(File file) {
|
|
this.heapDumpFile = (File) Preconditions.checkNotNull(file, "heapDumpFile");
|
|
return this;
|
|
}
|
|
|
|
public Builder reachabilityInspectorClasses(List<Class<? extends Reachability.Inspector>> list) {
|
|
Preconditions.checkNotNull(list, "reachabilityInspectorClasses");
|
|
this.reachabilityInspectorClasses = Collections.unmodifiableList(new ArrayList(list));
|
|
return this;
|
|
}
|
|
|
|
public Builder referenceKey(String str) {
|
|
this.referenceKey = (String) Preconditions.checkNotNull(str, "referenceKey");
|
|
return this;
|
|
}
|
|
|
|
public Builder referenceName(String str) {
|
|
this.referenceName = (String) Preconditions.checkNotNull(str, "referenceName");
|
|
return this;
|
|
}
|
|
|
|
public Builder watchDurationMs(long j) {
|
|
this.watchDurationMs = j;
|
|
return this;
|
|
}
|
|
|
|
Builder(HeapDump heapDump) {
|
|
this.heapDumpFile = heapDump.heapDumpFile;
|
|
this.referenceKey = heapDump.referenceKey;
|
|
this.referenceName = heapDump.referenceName;
|
|
this.excludedRefs = heapDump.excludedRefs;
|
|
this.computeRetainedHeapSize = heapDump.computeRetainedHeapSize;
|
|
this.watchDurationMs = heapDump.watchDurationMs;
|
|
this.gcDurationMs = heapDump.gcDurationMs;
|
|
this.heapDumpDurationMs = heapDump.heapDumpDurationMs;
|
|
this.reachabilityInspectorClasses = heapDump.reachabilityInspectorClasses;
|
|
}
|
|
}
|
|
|
|
HeapDump(Builder builder) {
|
|
this.heapDumpFile = builder.heapDumpFile;
|
|
this.referenceKey = builder.referenceKey;
|
|
this.referenceName = builder.referenceName;
|
|
this.excludedRefs = builder.excludedRefs;
|
|
this.computeRetainedHeapSize = builder.computeRetainedHeapSize;
|
|
this.watchDurationMs = builder.watchDurationMs;
|
|
this.gcDurationMs = builder.gcDurationMs;
|
|
this.heapDumpDurationMs = builder.heapDumpDurationMs;
|
|
this.reachabilityInspectorClasses = builder.reachabilityInspectorClasses;
|
|
}
|
|
}
|