Search in sources :

Example 1 with LeakedActivityEntry

use of com.android.tools.perflib.heap.memoryanalyzer.LeakedActivityAnalyzerTask.LeakedActivityEntry 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;
}
Also used : MemoryAnalysisResultEntry(com.android.tools.perflib.heap.memoryanalyzer.MemoryAnalysisResultEntry) DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) LeakedActivityEntry(com.android.tools.perflib.heap.memoryanalyzer.LeakedActivityAnalyzerTask.LeakedActivityEntry) DuplicatedStringsEntry(com.android.tools.perflib.heap.memoryanalyzer.DuplicatedStringsAnalyzerTask.DuplicatedStringsEntry) Nullable(org.jetbrains.annotations.Nullable)

Aggregations

DuplicatedStringsEntry (com.android.tools.perflib.heap.memoryanalyzer.DuplicatedStringsAnalyzerTask.DuplicatedStringsEntry)1 LeakedActivityEntry (com.android.tools.perflib.heap.memoryanalyzer.LeakedActivityAnalyzerTask.LeakedActivityEntry)1 MemoryAnalysisResultEntry (com.android.tools.perflib.heap.memoryanalyzer.MemoryAnalysisResultEntry)1 DefaultMutableTreeNode (javax.swing.tree.DefaultMutableTreeNode)1 Nullable (org.jetbrains.annotations.Nullable)1