libraries/ltkutils/inc/heaputils.h
changeset 53 17466b56148d
parent 0 7f656887cf89
child 59 c9dfb364c2d1
--- a/libraries/ltkutils/inc/heaputils.h	Wed Sep 01 17:56:27 2010 +0100
+++ b/libraries/ltkutils/inc/heaputils.h	Tue Sep 07 11:07:30 2010 +0100
@@ -9,7 +9,9 @@
 // Initial Contributors:
 // Accenture - Initial contribution
 //
-
+// Contributors:
+// Adrian Issott (Nokia) - Updates for kernel-side alloc helper
+//
 
 #ifndef FSHELL_HEAP_UTILS_H
 #define FSHELL_HEAP_UTILS_H
@@ -41,6 +43,7 @@
 public:
 	HUIMPORT_C RAllocatorHelper();
 #ifdef __KERNEL_MODE__
+	TLinAddr GetKernelAllocator(DChunk* aKernelChunk);
 	TInt OpenKernelHeap();
 #else
 	HUIMPORT_C TInt Open(RAllocator* aAllocator);
@@ -116,13 +119,19 @@
 
 protected:
 	TInt FinishConstruction();
-	TInt IdentifyAllocatorType(TBool aAllocatorIsUdeb);
+	TInt IdentifyAllocatorType(TBool aAllocatorIsUdeb, TBool aIsTheKernelHeap=EFalse);
 	TInt OpenChunkHeap(TLinAddr aChunkBase, TInt aChunkMaxSize);
 #ifndef __KERNEL_MODE__
 	static TInt EuserIsUdeb();
 #endif
 	virtual TInt ReadData(TLinAddr aLocation, TAny* aResult, TInt aSize) const;
 	virtual TInt WriteData(TLinAddr aLocation, const TAny* aData, TInt aSize);
+
+#ifndef __KERNEL_MODE__
+protected:
+#else
+public:
+#endif	
 	virtual TInt TryLock();
 	virtual void TryUnlock();
 
@@ -171,10 +180,10 @@
 
 #ifdef __KERNEL_MODE__
 
-class RKernelSideAllocatorHelper : public RAllocatorHelper
-	{
+class RUserAllocatorHelper : public RAllocatorHelper
+    {
 public:
-	RKernelSideAllocatorHelper();
+	RUserAllocatorHelper();
 	TInt OpenUserHeap(TUint aThreadId, TLinAddr aAllocatorAddress, TBool aEuserIsUdeb);
 	virtual DChunk* OpenUnderlyingChunk(); // Must be in CS
 	virtual void Close();
@@ -188,6 +197,24 @@
 	DThread* iThread;
 	};
 
+class RKernelCopyAllocatorHelper : public RAllocatorHelper
+	{
+public:
+	RKernelCopyAllocatorHelper();
+	TInt OpenCopiedHeap(DChunk* aOriginalChunk, DChunk* aCopiedChunk, TInt aOffset);
+	virtual DChunk* OpenUnderlyingChunk(); // Must be in CS
+	virtual void Close();
+
+protected:
+	virtual TInt ReadData(TLinAddr aLocation, TAny* aResult, TInt aSize) const;
+	virtual TInt WriteData(TLinAddr aLocation, const TAny* aData, TInt aSize);
+	virtual TInt TryLock();
+	virtual void TryUnlock();
+private:
+	DChunk* iCopiedChunk;
+	TInt iOffset; // from the original kernel heap to the copied heap
+	};
+
 #else
 
 class RProxyAllocatorHelper : public RAllocatorHelper