1960 |
1969 |
1961 /** |
1970 /** |
1962 Structure for compile-time definition of a secure ID |
1971 Structure for compile-time definition of a secure ID |
1963 @internalComponent |
1972 @internalComponent |
1964 */ |
1973 */ |
|
1974 #if defined(__ARMCC__) && __ARMCC_VERSION >= 400000 |
|
1975 #pragma push |
|
1976 #pragma diag_suppress 430 |
|
1977 #endif |
1965 class SSecureId |
1978 class SSecureId |
1966 { |
1979 { |
1967 public: |
1980 public: |
1968 inline const TSecureId* operator&() const; |
1981 inline const TSecureId* operator&() const; |
1969 inline operator const TSecureId&() const; |
1982 inline operator const TSecureId&() const; |
1970 inline operator TUint32() const; |
1983 inline operator TUint32() const; |
1971 inline operator TUid() const; |
1984 inline operator TUid() const; |
1972 public: |
1985 public: |
1973 TUint32 iId; |
1986 TUint32 iId; |
1974 }; |
1987 }; |
1975 |
1988 #if defined(__ARMCC__) && __ARMCC_VERSION >= 400000 |
|
1989 #pragma pop |
|
1990 #endif |
1976 |
1991 |
1977 |
1992 |
1978 |
1993 |
1979 /** |
1994 /** |
1980 Structure for compile-time definition of a vendor ID |
1995 Structure for compile-time definition of a vendor ID |
1981 @internalComponent |
1996 @internalComponent |
1982 */ |
1997 */ |
|
1998 #if defined(__ARMCC__) && __ARMCC_VERSION >= 400000 |
|
1999 #pragma push |
|
2000 #pragma diag_suppress 430 |
|
2001 #endif |
1983 class SVendorId |
2002 class SVendorId |
1984 { |
2003 { |
1985 public: |
2004 public: |
1986 inline const TVendorId* operator&() const; |
2005 inline const TVendorId* operator&() const; |
1987 inline operator const TVendorId&() const; |
2006 inline operator const TVendorId&() const; |
1988 inline operator TUint32() const; |
2007 inline operator TUint32() const; |
1989 inline operator TUid() const; |
2008 inline operator TUid() const; |
1990 public: |
2009 public: |
1991 TUint32 iId; |
2010 TUint32 iId; |
1992 }; |
2011 }; |
1993 |
2012 #if defined(__ARMCC__) && __ARMCC_VERSION >= 400000 |
|
2013 #pragma pop |
|
2014 #endif |
1994 |
2015 |
1995 |
2016 |
1996 |
2017 |
1997 /** |
2018 /** |
1998 Macro for compile-time definition of a secure ID |
2019 Macro for compile-time definition of a secure ID |
2628 Base class for heaps. |
2652 Base class for heaps. |
2629 */ |
2653 */ |
2630 class RAllocator : public MAllocator |
2654 class RAllocator : public MAllocator |
2631 { |
2655 { |
2632 public: |
2656 public: |
2633 |
2657 /** |
2634 |
2658 A set of heap allocation failure flags. |
2635 /** |
2659 |
2636 A set of heap allocation failure flags. |
2660 This enumeration indicates how to simulate heap allocation failure. |
2637 |
2661 |
2638 This enumeration indicates how to simulate heap allocation failure. |
2662 @see RAllocator::__DbgSetAllocFail() |
2639 |
2663 */ |
2640 @see RAllocator::__DbgSetAllocFail() |
2664 enum TAllocFail |
2641 */ |
2665 { |
2642 enum TAllocFail { |
2666 /** |
2643 /** |
2667 Attempts to allocate from this heap fail at a random rate; |
2644 Attempts to allocate from this heap fail at a random rate; |
2668 however, the interval pattern between failures is the same |
2645 however, the interval pattern between failures is the same |
2669 every time simulation is started. |
2646 every time simulation is started. |
2670 */ |
2647 */ |
2671 ERandom, |
2648 ERandom, |
2672 |
2649 |
2673 /** |
2650 |
2674 Attempts to allocate from this heap fail at a random rate. |
2651 /** |
2675 The interval pattern between failures may be different every |
2652 Attempts to allocate from this heap fail at a random rate. |
2676 time the simulation is started. |
2653 The interval pattern between failures may be different every |
2677 */ |
2654 time the simulation is started. |
2678 ETrueRandom, |
2655 */ |
2679 |
2656 ETrueRandom, |
2680 /** |
2657 |
2681 Attempts to allocate from this heap fail at a rate aRate; |
2658 |
2682 for example, if aRate is 3, allocation fails at every |
2659 /** |
2683 third attempt. |
2660 Attempts to allocate from this heap fail at a rate aRate; |
2684 */ |
2661 for example, if aRate is 3, allocation fails at every |
2685 EDeterministic, |
2662 third attempt. |
2686 |
2663 */ |
2687 /** |
2664 EDeterministic, |
2688 Cancels simulated heap allocation failure. |
2665 |
2689 */ |
2666 |
2690 ENone, |
2667 /** |
2691 |
2668 Cancels simulated heap allocation failure. |
2692 /** |
2669 */ |
2693 An allocation from this heap will fail after the next aRate - 1 |
2670 ENone, |
2694 allocation attempts. For example, if aRate = 1 then the next |
2671 |
2695 attempt to allocate from this heap will fail. |
2672 |
2696 */ |
2673 /** |
2697 EFailNext, |
2674 An allocation from this heap will fail after the next aRate - 1 |
2698 |
2675 allocation attempts. For example, if aRate = 1 then the next |
2699 /** |
2676 attempt to allocate from this heap will fail. |
2700 Cancels simulated heap allocation failure, and sets |
2677 */ |
2701 the nesting level for all allocated cells to zero. |
2678 EFailNext, |
2702 */ |
2679 |
2703 EReset, |
2680 /** |
2704 |
2681 Cancels simulated heap allocation failure, and sets |
2705 /** |
2682 the nesting level for all allocated cells to zero. |
2706 aBurst allocations from this heap fail at a random rate; |
2683 */ |
2707 however, the interval pattern between failures is the same |
2684 EReset, |
2708 every time the simulation is started. |
2685 |
2709 */ |
2686 /** |
2710 EBurstRandom, |
2687 aBurst allocations from this heap fail at a random rate; |
2711 |
2688 however, the interval pattern between failures is the same |
2712 /** |
2689 every time the simulation is started. |
2713 aBurst allocations from this heap fail at a random rate. |
2690 */ |
2714 The interval pattern between failures may be different every |
2691 EBurstRandom, |
2715 time the simulation is started. |
2692 |
2716 */ |
2693 |
2717 EBurstTrueRandom, |
2694 /** |
2718 |
2695 aBurst allocations from this heap fail at a random rate. |
2719 /** |
2696 The interval pattern between failures may be different every |
2720 aBurst allocations from this heap fail at a rate aRate. |
2697 time the simulation is started. |
2721 For example, if aRate is 10 and aBurst is 2, then 2 allocations |
2698 */ |
2722 will fail at every tenth attempt. |
2699 EBurstTrueRandom, |
2723 */ |
2700 |
2724 EBurstDeterministic, |
2701 |
2725 |
2702 /** |
2726 /** |
2703 aBurst allocations from this heap fail at a rate aRate. |
2727 aBurst allocations from this heap will fail after the next aRate - 1 |
2704 For example, if aRate is 10 and aBurst is 2, then 2 allocations |
2728 allocation attempts have occurred. For example, if aRate = 1 and |
2705 will fail at every tenth attempt. |
2729 aBurst = 3 then the next 3 attempts to allocate from this heap will fail. |
2706 */ |
2730 */ |
2707 EBurstDeterministic, |
2731 EBurstFailNext, |
2708 |
2732 |
2709 /** |
2733 /** |
2710 aBurst allocations from this heap will fail after the next aRate - 1 |
2734 Use this to determine how many times the current debug |
2711 allocation attempts have occurred. For example, if aRate = 1 and |
2735 failure mode has failed so far. |
2712 aBurst = 3 then the next 3 attempts to allocate from this heap will fail. |
2736 @see RAllocator::__DbgCheckFailure() |
2713 */ |
2737 */ |
2714 EBurstFailNext, |
2738 ECheckFailure, |
2715 |
2739 }; |
2716 /** |
2740 |
2717 Use this to determine how many times the current debug |
2741 /** |
2718 failure mode has failed so far. |
2742 Heap debug checking type flag. |
2719 @see RAllocator::__DbgCheckFailure() |
2743 */ |
2720 */ |
2744 enum TDbgHeapType |
2721 ECheckFailure, |
2745 { |
2722 }; |
2746 /** |
2723 |
2747 The heap is a user heap. |
2724 |
2748 */ |
2725 /** |
2749 EUser, |
2726 Heap debug checking type flag. |
2750 |
2727 */ |
2751 /** |
2728 enum TDbgHeapType { |
2752 The heap is the Kernel heap. |
2729 /** |
2753 */ |
2730 The heap is a user heap. |
2754 EKernel |
2731 */ |
2755 }; |
2732 EUser, |
2756 |
2733 |
2757 enum TAllocDebugOp |
2734 /** |
2758 { |
2735 The heap is the Kernel heap. |
2759 ECount, EMarkStart, EMarkEnd, ECheck, ESetFail, ECopyDebugInfo, ESetBurstFail, EGetFail, |
2736 */ |
2760 EGetSize=48, EGetMaxLength, EGetBase, EAlignInteger, EAlignAddr |
2737 EKernel |
2761 }; |
2738 }; |
2762 |
2739 |
|
2740 |
|
2741 enum TAllocDebugOp {ECount, EMarkStart, EMarkEnd, ECheck, ESetFail, ECopyDebugInfo, ESetBurstFail}; |
|
2742 |
|
2743 |
|
2744 /** |
2763 /** |
2745 Flags controlling reallocation. |
2764 Flags controlling reallocation. |
2746 */ |
2765 */ |
2747 enum TReAllocMode { |
2766 enum TReAllocMode |
2748 /** |
2767 { |
2749 A reallocation of a cell must not change |
2768 /** |
2750 the start address of the cell. |
2769 A reallocation of a cell must not change |
2751 */ |
2770 the start address of the cell. |
2752 ENeverMove=1, |
2771 */ |
2753 |
2772 ENeverMove=1, |
2754 /** |
2773 |
2755 Allows the start address of the cell to change |
2774 /** |
2756 if the cell shrinks in size. |
2775 Allows the start address of the cell to change |
2757 */ |
2776 if the cell shrinks in size. |
2758 EAllowMoveOnShrink=2 |
2777 */ |
2759 }; |
2778 EAllowMoveOnShrink=2 |
2760 |
2779 }; |
2761 |
2780 |
2762 enum TFlags {ESingleThreaded=1, EFixedSize=2, ETraceAllocs=4, EMonitorMemory=8,}; |
2781 enum TFlags {ESingleThreaded=1, EFixedSize=2, ETraceAllocs=4, EMonitorMemory=8,}; |
2763 struct SCheckInfo {TBool iAll; TInt iCount; const TDesC8* iFileName; TInt iLineNum;}; |
2782 struct SCheckInfo {TBool iAll; TInt iCount; const TDesC8* iFileName; TInt iLineNum;}; |
2764 #ifndef SYMBIAN_ENABLE_SPLIT_HEADERS |
2783 #ifndef SYMBIAN_ENABLE_SPLIT_HEADERS |
2765 struct SRAllocatorBurstFail {TInt iBurst; TInt iRate; TInt iUnused[2];}; |
2784 struct SRAllocatorBurstFail {TInt iBurst; TInt iRate; TInt iUnused[2];}; |
2766 #endif |
2785 #endif |
2784 UIMPORT_C void __DbgMarkStart(); |
2803 UIMPORT_C void __DbgMarkStart(); |
2785 UIMPORT_C TUint32 __DbgMarkEnd(TInt aCount); |
2804 UIMPORT_C TUint32 __DbgMarkEnd(TInt aCount); |
2786 UIMPORT_C TInt __DbgMarkCheck(TBool aCountAll, TInt aCount, const TDesC8& aFileName, TInt aLineNum); |
2805 UIMPORT_C TInt __DbgMarkCheck(TBool aCountAll, TInt aCount, const TDesC8& aFileName, TInt aLineNum); |
2787 inline void __DbgMarkCheck(TBool aCountAll, TInt aCount, const TUint8* aFileName, TInt aLineNum); |
2806 inline void __DbgMarkCheck(TBool aCountAll, TInt aCount, const TUint8* aFileName, TInt aLineNum); |
2788 UIMPORT_C void __DbgSetAllocFail(TAllocFail aType, TInt aRate); |
2807 UIMPORT_C void __DbgSetAllocFail(TAllocFail aType, TInt aRate); |
|
2808 UIMPORT_C TAllocFail __DbgGetAllocFail(); |
2789 UIMPORT_C void __DbgSetBurstAllocFail(TAllocFail aType, TUint aRate, TUint aBurst); |
2809 UIMPORT_C void __DbgSetBurstAllocFail(TAllocFail aType, TUint aRate, TUint aBurst); |
2790 UIMPORT_C TUint __DbgCheckFailure(); |
2810 UIMPORT_C TUint __DbgCheckFailure(); |
|
2811 UIMPORT_C TInt Size() const; |
|
2812 UIMPORT_C TInt MaxLength() const; |
|
2813 UIMPORT_C TUint8* Base() const; |
|
2814 UIMPORT_C TInt Align(TInt a) const; |
|
2815 UIMPORT_C TAny* Align(TAny* a) const; |
|
2816 |
2791 protected: |
2817 protected: |
2792 UIMPORT_C virtual TInt Extension_(TUint aExtensionId, TAny*& a0, TAny* a1); |
2818 UIMPORT_C virtual TInt Extension_(TUint aExtensionId, TAny*& a0, TAny* a1); |
2793 #ifndef __KERNEL_MODE__ |
2819 #ifndef __KERNEL_MODE__ |
2794 IMPORT_C virtual void DoClose(); |
2820 IMPORT_C virtual void DoClose(); |
2795 #endif |
2821 #endif |
|
2822 |
2796 protected: |
2823 protected: |
2797 TInt iAccessCount; |
2824 TInt iAccessCount; // Value of the allocator's access count (ie. Number of times RAllocator::Open() has been called) |
2798 TInt iHandleCount; |
2825 TInt iHandleCount; // Number of handles in the iHandles array |
2799 TInt* iHandles; |
2826 TInt* iHandles; // Array of handles to chunks used by the heap implementation |
2800 TUint32 iFlags; |
2827 TUint32 iFlags; // Flags describing attributes of the heap; see RAllocator::TFlags |
2801 TInt iCellCount; |
2828 TInt iCellCount; // Internal debugger use only; use MAllocator::AllocSize() instead |
2802 TInt iTotalAllocSize; |
2829 TInt iTotalAllocSize; // Internal debugger use only; use MAllocator::AllocSize() instead |
2803 }; |
2830 }; |
2804 |
2831 |
2805 |
|
2806 |
|
2807 |
|
2808 class UserHeap; |
2832 class UserHeap; |
|
2833 |
|
2834 // This #define is for tools such as MemSpy that need to work across different versions of |
|
2835 // Symbian and need to know whether they are working with the new or old heap |
|
2836 |
|
2837 #define __SYMBIAN_KERNEL_HYBRID_HEAP__ |
|
2838 |
2809 /** |
2839 /** |
2810 @publishedAll |
2840 @publishedAll |
2811 @released |
2841 @released |
2812 |
2842 |
2813 Represents the default implementation for a heap. |
2843 Represents the default implementation for a heap. |
2814 |
2844 |
2815 The default implementation uses an address-ordered first fit type algorithm. |
2845 The default implementation uses an address-ordered first fit type algorithm. |
2816 |
2846 |
2817 The heap itself is contained in a chunk and may be the only occupant of the |
2847 The heap itself is contained in a chunk and may be the only occupant of the |
2818 chunk or may share the chunk with the program stack. |
2848 chunk or may share the chunk with the program stack. |
2819 |
2849 |
2820 The class contains member functions for allocating, adjusting, freeing individual |
2850 The class contains member functions for allocating, adjusting, freeing individual |
2821 cells and generally managing the heap. |
2851 cells and generally managing the heap. |
2822 |
2852 |
2823 The class is not a handle in the same sense that RChunk is a handle; i.e. |
2853 The class is not a handle in the same sense that RChunk is a handle; i.e. |
2824 there is no Kernel object which corresponds to the heap. |
2854 there is no Kernel object which corresponds to the heap. |
2825 */ |
2855 */ |
|
2856 |
2826 class RHeap : public RAllocator |
2857 class RHeap : public RAllocator |
2827 { |
2858 { |
2828 public: |
2859 public: |
2829 /** |
2860 |
2830 The structure of a heap cell header for a heap cell on the free list. |
|
2831 */ |
|
2832 struct SCell { |
|
2833 /** |
|
2834 The length of the cell, which includes the length of |
|
2835 this header. |
|
2836 */ |
|
2837 TInt len; |
|
2838 |
|
2839 |
|
2840 /** |
|
2841 A pointer to the next cell in the free list. |
|
2842 */ |
|
2843 SCell* next; |
|
2844 }; |
|
2845 |
|
2846 |
|
2847 /** |
|
2848 The structure of a heap cell header for an allocated heap cell in a debug build. |
|
2849 */ |
|
2850 struct SDebugCell { |
|
2851 /** |
|
2852 The length of the cell, which includes the length of |
|
2853 this header. |
|
2854 */ |
|
2855 TInt len; |
|
2856 |
|
2857 |
|
2858 /** |
|
2859 The nested level. |
|
2860 */ |
|
2861 TInt nestingLevel; |
|
2862 |
|
2863 |
|
2864 /** |
|
2865 The cumulative number of allocated cells |
|
2866 */ |
|
2867 TInt allocCount; |
|
2868 }; |
|
2869 |
|
2870 /** |
|
2871 @internalComponent |
|
2872 */ |
|
2873 struct SHeapCellInfo { RHeap* iHeap; TInt iTotalAlloc; TInt iTotalAllocSize; TInt iTotalFree; TInt iLevelAlloc; SDebugCell* iStranded; }; |
|
2874 |
|
2875 /** |
|
2876 @internalComponent |
|
2877 */ |
|
2878 struct _s_align {char c; double d;}; |
|
2879 |
|
2880 /** |
|
2881 The default cell alignment. |
|
2882 */ |
|
2883 enum {ECellAlignment = sizeof(_s_align)-sizeof(double)}; |
|
2884 |
|
2885 /** |
|
2886 Size of a free cell header. |
|
2887 */ |
|
2888 enum {EFreeCellSize = sizeof(SCell)}; |
|
2889 |
|
2890 |
|
2891 #ifdef _DEBUG |
|
2892 /** |
|
2893 Size of an allocated cell header in a debug build. |
|
2894 */ |
|
2895 enum {EAllocCellSize = sizeof(SDebugCell)}; |
|
2896 #else |
|
2897 /** |
|
2898 Size of an allocated cell header in a release build. |
|
2899 */ |
|
2900 enum {EAllocCellSize = sizeof(SCell*)}; |
|
2901 #endif |
|
2902 |
|
2903 |
|
2904 /** |
|
2905 @internalComponent |
|
2906 */ |
|
2907 enum TDebugOp {EWalk=128}; |
|
2908 |
|
2909 |
|
2910 /** |
|
2911 @internalComponent |
|
2912 */ |
|
2913 enum TCellType |
|
2914 {EGoodAllocatedCell, EGoodFreeCell, EBadAllocatedCellSize, EBadAllocatedCellAddress, |
|
2915 EBadFreeCellAddress, EBadFreeCellSize}; |
|
2916 |
|
2917 |
|
2918 /** |
|
2919 @internalComponent |
|
2920 */ |
|
2921 enum TDebugHeapId {EUser=0, EKernel=1}; |
|
2922 |
|
2923 /** |
|
2924 @internalComponent |
|
2925 */ |
|
2926 enum TDefaultShrinkRatios {EShrinkRatio1=256, EShrinkRatioDflt=512}; |
|
2927 |
|
2928 #ifndef SYMBIAN_ENABLE_SPLIT_HEADERS |
|
2929 /** |
|
2930 @internalComponent |
|
2931 */ |
|
2932 #else |
|
2933 private: |
|
2934 #endif |
|
2935 typedef void (*TWalkFunc)(TAny*, TCellType, TAny*, TInt); |
|
2936 |
|
2937 public: |
|
2938 UIMPORT_C virtual TAny* Alloc(TInt aSize); |
2861 UIMPORT_C virtual TAny* Alloc(TInt aSize); |
2939 UIMPORT_C virtual void Free(TAny* aPtr); |
2862 UIMPORT_C virtual void Free(TAny* aPtr); |
2940 UIMPORT_C virtual TAny* ReAlloc(TAny* aPtr, TInt aSize, TInt aMode=0); |
2863 UIMPORT_C virtual TAny* ReAlloc(TAny* aPtr, TInt aSize, TInt aMode=0); |
2941 UIMPORT_C virtual TInt AllocLen(const TAny* aCell) const; |
2864 UIMPORT_C virtual TInt AllocLen(const TAny* aCell) const; |
2942 #ifndef __KERNEL_MODE__ |
2865 #ifndef __KERNEL_MODE__ |
2946 UIMPORT_C virtual TInt Available(TInt& aBiggestBlock) const; |
2869 UIMPORT_C virtual TInt Available(TInt& aBiggestBlock) const; |
2947 #endif |
2870 #endif |
2948 UIMPORT_C virtual TInt DebugFunction(TInt aFunc, TAny* a1=NULL, TAny* a2=NULL); |
2871 UIMPORT_C virtual TInt DebugFunction(TInt aFunc, TAny* a1=NULL, TAny* a2=NULL); |
2949 protected: |
2872 protected: |
2950 UIMPORT_C virtual TInt Extension_(TUint aExtensionId, TAny*& a0, TAny* a1); |
2873 UIMPORT_C virtual TInt Extension_(TUint aExtensionId, TAny*& a0, TAny* a1); |
2951 public: |
2874 inline RHeap() { } |
2952 UIMPORT_C RHeap(TInt aMaxLength, TInt aAlign=0, TBool aSingleThread=ETrue); |
2875 |
2953 UIMPORT_C RHeap(TInt aChunkHandle, TInt aOffset, TInt aMinLength, TInt aMaxLength, TInt aGrowBy, TInt aAlign=0, TBool aSingleThread=EFalse); |
2876 public: |
2954 UIMPORT_C TAny* operator new(TUint aSize, TAny* aBase) __NO_THROW; |
2877 |
2955 inline void operator delete(TAny* aPtr, TAny* aBase); |
2878 /** |
2956 inline TUint8* Base() const; |
2879 @internalComponent |
2957 inline TInt Size() const; |
2880 |
2958 inline TInt MaxLength() const; |
2881 The structure of a heap cell header for an allocated heap cell in a debug build. |
2959 inline TInt Align(TInt a) const; |
2882 */ |
2960 inline const TAny* Align(const TAny* a) const; |
2883 struct SDebugCell |
2961 inline TBool IsLastCell(const SCell* aCell) const; |
2884 { |
2962 inline void Lock() const; |
2885 /** |
2963 inline void Unlock() const; |
2886 The nested level. |
2964 inline TInt ChunkHandle() const; |
2887 */ |
|
2888 TInt nestingLevel; |
|
2889 |
|
2890 /** |
|
2891 The cumulative number of allocated cells |
|
2892 */ |
|
2893 TInt allocCount; |
|
2894 }; |
|
2895 |
|
2896 /** |
|
2897 @internalComponent |
|
2898 */ |
|
2899 struct SHeapCellInfo { RHeap* iHeap; TInt iTotalAlloc; TInt iTotalAllocSize; TInt iTotalFree; TInt iLevelAlloc; SDebugCell* iStranded; }; |
|
2900 |
|
2901 /** |
|
2902 Size of a free cell header. |
|
2903 */ |
|
2904 enum { EDebugHdrSize = sizeof(SDebugCell) }; |
|
2905 |
|
2906 /** |
|
2907 The default cell alignment. |
|
2908 */ |
|
2909 enum { ECellAlignment = 8 }; |
|
2910 |
|
2911 /** |
|
2912 Size of a free cell header. |
|
2913 */ |
|
2914 enum { EFreeCellSize = 4 }; |
|
2915 |
|
2916 #ifdef _DEBUG |
|
2917 /** |
|
2918 Size of an allocated cell header in a debug build. |
|
2919 */ |
|
2920 enum { EAllocCellSize = (4 + EDebugHdrSize) }; |
|
2921 #else |
|
2922 /** |
|
2923 Size of an allocated cell header in a release build. |
|
2924 */ |
|
2925 enum { EAllocCellSize = 4 }; |
|
2926 #endif |
|
2927 |
|
2928 /** |
|
2929 @internalComponent |
|
2930 */ |
|
2931 enum TDebugOp { EWalk = 128, EHybridHeap }; |
|
2932 |
|
2933 /** |
|
2934 @internalComponent |
|
2935 */ |
|
2936 enum TCellType |
|
2937 { |
|
2938 EGoodAllocatedCell, EGoodFreeCell, EBadAllocatedCellSize, EBadAllocatedCellAddress, |
|
2939 EBadFreeCellAddress, EBadFreeCellSize |
|
2940 }; |
|
2941 |
|
2942 /** |
|
2943 @internalComponent |
|
2944 */ |
|
2945 enum TDebugHeapId { EUser = 0, EKernel = 1 }; |
|
2946 |
|
2947 /** |
|
2948 @internalComponent |
|
2949 */ |
|
2950 enum TDefaultShrinkRatios { EShrinkRatio1 = 256, EShrinkRatioDflt = 512 }; |
|
2951 |
|
2952 /** |
|
2953 @internalComponent |
|
2954 */ |
|
2955 typedef void (*TWalkFunc)(TAny*, TCellType, TAny*, TInt); |
|
2956 |
2965 protected: |
2957 protected: |
2966 inline RHeap(); |
2958 |
2967 void Initialise(); |
2959 // These variables are present only for downwards binary compatibility. Most are unused, |
2968 SCell* DoAlloc(TInt aSize, SCell*& aLastFree); |
2960 // but some must be present so that previously inline functions continue to work. These |
2969 void DoFree(SCell* pC); |
2961 // old inline functions are now replaced with non inline versions so recompiling existing |
2970 TInt TryToGrowHeap(TInt aSize, SCell* aLastFree); |
2962 // code will automatically switch to the new versions and you should no longer access any |
2971 inline void FindFollowingFreeCell(SCell* aCell, SCell*& pPrev, SCell*& aNext); |
2963 // of the variables in here. |
2972 TInt TryToGrowCell(SCell* pC, SCell* pP, SCell* pE, TInt aSize); |
2964 // |
2973 TInt Reduce(SCell* aCell); |
2965 // These variables should now all be considered private and should NOT be accessed directly! |
2974 UIMPORT_C SCell* GetAddress(const TAny* aCell) const; |
2966 // |
2975 void CheckCell(const SCell* aCell) const; |
2967 TInt iUnused1; // Present for binary compatibility reasons only |
2976 void Walk(TWalkFunc aFunc, TAny* aPtr); |
2968 TInt iMaxLength; // Use RAllocator::MaxLength() to get this information now |
2977 static void WalkCheckCell(TAny* aPtr, TCellType aType, TAny* aCell, TInt aLen); |
2969 TInt iUnused2; // Present for binary compatibility reasons only |
2978 TInt DoCountAllocFree(TInt& aFree); |
2970 TInt iUnused3; // Present for binary compatibility reasons only |
2979 TInt DoCheckHeap(SCheckInfo* aInfo); |
2971 // These next two variables must remain in this order for correct object destruction |
2980 void DoMarkStart(); |
2972 TInt iChunkHandle; // Do not use; consider undocumented |
2981 TUint32 DoMarkEnd(TInt aExpected); |
2973 RFastLock iLock; // Do not use; consider undocumented |
2982 void DoSetAllocFail(TAllocFail aType, TInt aRate); |
2974 TUint8* iBase; // Use RAllocator::Base() to get this information now |
2983 TBool CheckForSimulatedAllocFail(); |
2975 TUint8* iTop; // Do not use; consider undocumented |
2984 inline TInt SetBrk(TInt aBrk); |
2976 TInt iAlign; // Use RAllocator::Align() to get this information now |
2985 inline TAny* ReAllocImpl(TAny* aPtr, TInt aSize, TInt aMode); |
2977 |
2986 void DoSetAllocFail(TAllocFail aType, TInt aRate, TUint aBurst); |
2978 // These variables are temporary to prevent source breaks from req417-52840. They are deprecated in |
2987 protected: |
2979 // favour of non hacky ways of determining this information but are required during the switchover to |
2988 TInt iMinLength; |
2980 // this method |
2989 TInt iMaxLength; |
2981 TAllocFail iFailType; // Use RAllocator::__DbgGetAllocFail() to get this information now |
2990 TInt iOffset; |
2982 TInt iNestingLevel; // Do not use; consider undocumented |
2991 TInt iGrowBy; |
2983 TAny* iTestData; // Do not use; consider undocumented |
2992 TInt iChunkHandle; |
|
2993 RFastLock iLock; |
|
2994 TUint8* iBase; |
|
2995 TUint8* iTop; |
|
2996 TInt iAlign; |
|
2997 TInt iMinCell; |
|
2998 TInt iPageSize; |
|
2999 SCell iFree; |
|
3000 protected: |
|
3001 TInt iNestingLevel; |
|
3002 TInt iAllocCount; |
|
3003 TAllocFail iFailType; |
|
3004 TInt iFailRate; |
|
3005 TBool iFailed; |
|
3006 TInt iFailAllocCount; |
|
3007 TInt iRand; |
|
3008 TAny* iTestData; |
|
3009 |
2984 |
3010 friend class UserHeap; |
2985 friend class UserHeap; |
3011 }; |
2986 }; |
3012 |
|
3013 |
|
3014 |
|
3015 |
|
3016 |
2987 |
3017 class OnlyCreateWithNull; |
2988 class OnlyCreateWithNull; |
3018 |
2989 |
3019 /** @internalTechnology */ |
2990 /** @internalTechnology */ |
3020 typedef void (OnlyCreateWithNull::* __NullPMF)(); |
2991 typedef void (OnlyCreateWithNull::* __NullPMF)(); |