FileDocCategorySizeDatePackage
State.javaAPI DocAndroid 5.1 API4797Thu Mar 12 22:18:30 GMT 2015com.android.hit

State

public class State extends Object

Fields Summary
HashMap
mHeaps
Heap
mCurrentHeap
Constructors Summary
public State()

        mHeaps = new HashMap<Integer, Heap>();
        setToDefaultHeap();
    
Methods Summary
public final voidaddClass(long id, ClassObj theClass)

        mCurrentHeap.addClass(id, theClass);
    
public final voidaddInstance(long id, Instance instance)

        mCurrentHeap.addInstance(id, instance);
    
public final voidaddRoot(RootObj root)

        mCurrentHeap.addRoot(root);
    
public final voidaddStackFrame(StackFrame theFrame)

        mCurrentHeap.addStackFrame(theFrame);
    
public final voidaddStackTrace(StackTrace theTrace)

        mCurrentHeap.addStackTrace(theTrace);
    
public final voidaddThread(ThreadObj thread, int serialNumber)

        mCurrentHeap.addThread(thread, serialNumber);
    
public final voiddumpInstanceCounts()

        for (Heap heap: mHeaps.values()) {
            System.out.println(
                "+------------------ instance counts for heap: " + heap.mName);
            heap.dumpInstanceCounts();
        }
    
public final voiddumpSizes()

        for (Heap heap: mHeaps.values()) {
            System.out.println(
                "+------------------ sizes for heap: " + heap.mName);
            heap.dumpSizes();
        }
    
public final voiddumpSubclasses()

        for (Heap heap: mHeaps.values()) {
            System.out.println(
                "+------------------ subclasses for heap: " + heap.mName);
            heap.dumpSubclasses();
        }
    
public final ClassObjfindClass(long id)

        for (Heap heap: mHeaps.values()) {
            ClassObj theClass = heap.getClass(id);

            if (theClass != null) {
                return theClass;
            }
        }

        return null;
    
public final ClassObjfindClass(java.lang.String name)

        for (Heap heap: mHeaps.values()) {
            ClassObj theClass = heap.getClass(name);

            if (theClass != null) {
                return theClass;
            }
        }

        return null;
    
public final InstancefindReference(long id)

        for (Heap heap: mHeaps.values()) {
            Instance instance = heap.getInstance(id);

            if (instance != null) {
                return instance;
            }
        }

        //  Couldn't find an instance of a class, look for a class object
        return findClass(id);
    
public HeapgetHeap(int id)

        return mHeaps.get(id);
    
public HeapgetHeap(java.lang.String name)

        for (Heap heap: mHeaps.values()) {
            if (heap.mName.equals(name)) {
                return heap;
            }
        }

        return null;
    
public final StackFramegetStackFrame(long id)

        return mCurrentHeap.getStackFrame(id);
    
public final StackTracegetStackTrace(int traceSerialNumber)

        return mCurrentHeap.getStackTrace(traceSerialNumber);
    
public final StackTracegetStackTraceAtDepth(int traceSerialNumber, int depth)

        return mCurrentHeap.getStackTraceAtDepth(traceSerialNumber, depth);
    
public final ThreadObjgetThread(int serialNumber)

        return mCurrentHeap.getThread(serialNumber);
    
public final voidresolveReferences()

        for (Heap heap: mHeaps.values()) {
            heap.resolveInstanceRefs(this);
            heap.resolveClassStatics(this);
            heap.resolveRoots(this);
        }
    
public HeapsetHeapTo(int id, java.lang.String name)

        Heap heap = mHeaps.get(id);

        if (heap == null) {
            heap = new Heap(name);
            heap.mState = this;
            mHeaps.put(id, heap);
        }

        mCurrentHeap = heap;

        return mCurrentHeap;
    
public HeapsetToDefaultHeap()

        return setHeapTo(0, "default");