browserui/browser/BrowserAppSrc/BrowserAppEntryPoint.cpp
changeset 22 d6f226a5ad2c
parent 0 84ad3b177aa3
child 31 868cceedabd3
--- a/browserui/browser/BrowserAppSrc/BrowserAppEntryPoint.cpp	Thu Sep 24 12:40:29 2009 +0300
+++ b/browserui/browser/BrowserAppSrc/BrowserAppEntryPoint.cpp	Mon Oct 26 08:18:09 2009 +0200
@@ -20,6 +20,7 @@
 
 #include "BrowserApplication.h"
 #include <e32std.h>
+#include <u32std.h>
 #include <eikapp.h>
 #include <eikstart.h>
 #include "MemoryManager.h"
@@ -32,22 +33,41 @@
     return new CBrowserApplication;
     }
 
+EXPORT_C TInt UserHeap::SetupThreadHeap(TBool, SStdEpocThreadCreateInfo& aInfo)
+	{
+    TInt r = KErrNone;
+    if (!aInfo.iAllocator && aInfo.iHeapInitialSize>0)
+		{
+		// new heap required
+		RHeap* pH = NULL;
+		r = CreateThreadHeap(aInfo, pH);
+		if (r == KErrNone)
+			{       // should happen for main thread, otherwise panic      
+					RAllocator* oldAllocator = MemoryManager::SwitchToFastAllocator();
+			}
+		}
+	else if (aInfo.iAllocator)
+		{
+		// sharing a heap
+		RAllocator* pA = aInfo.iAllocator;
+		pA->Open();
+		User::SwitchAllocator(pA);
+		}
+
+    return r;
+	}
+
 GLDEF_C TInt E32Main()
     {
     ROomMonitorSession oomMs;
-    TInt result = oomMs.Connect();
-    if ( result == KErrNone )
+    TInt r = oomMs.Connect();
+    if (r == KErrNone)
         {
-        result = oomMs.RequestFreeMemory( KFreeMemoryTarget );
+        r = oomMs.RequestFreeMemory(KFreeMemoryTarget);
         oomMs.Close();
-        if ( result == KErrNone )
-            {
-            RAllocator* oldAllocator = MemoryManager::SwitchToFastAllocator();
-            result = EikStart::RunApplication( NewApplication );
-            MemoryManager::CloseFastAllocator(oldAllocator);
-            }
         }
-    return result;
+    
+	return EikStart::RunApplication(NewApplication);
     }
 
 //  End of File