use of com.android.tools.perflib.heap.memoryanalyzer.MemoryAnalysisResultEntry in project android by JetBrains.
the class HprofAnalysisContentsDelegate method getNodeForEntry.
@Override
@Nullable
public DefaultMutableTreeNode getNodeForEntry(int index, @NotNull AnalysisResultEntry entry) {
if (!(entry instanceof MemoryAnalysisResultEntry)) {
return null;
}
DefaultMutableTreeNode subtreeRoot = new DefaultMutableTreeNode();
if (entry instanceof DuplicatedStringsEntry) {
DuplicatedStringsEntry duplicatedStringsEntry = (DuplicatedStringsEntry) entry;
subtreeRoot.setUserObject(new EntryListItem(index, duplicatedStringsEntry));
for (Instance instance : duplicatedStringsEntry.getOffender().getOffenders()) {
subtreeRoot.add(new DefaultMutableTreeNode(new InstanceListItem(subtreeRoot.getChildCount(), instance)));
}
} else if (entry instanceof LeakedActivityEntry) {
LeakedActivityEntry leakedActivityEntry = (LeakedActivityEntry) entry;
subtreeRoot.setUserObject(new InstanceListItem(index, leakedActivityEntry.getOffender().getOffenders().get(0)));
} else {
throw new RuntimeException("Failed to handle a subtype of MemoryAnalysisResultEntry \"" + entry.getClass().getSimpleName() + "\". Perhaps this method needs to be updated?");
}
return subtreeRoot;
}
Aggregations