browserui/browser/BrowserAppSrc/BrowserAppEntryPoint.cpp
changeset 15 d6f226a5ad2c
parent 0 84ad3b177aa3
child 24 868cceedabd3
equal deleted inserted replaced
11:16a119033e3e 15:d6f226a5ad2c
    18 */
    18 */
    19 
    19 
    20 
    20 
    21 #include "BrowserApplication.h"
    21 #include "BrowserApplication.h"
    22 #include <e32std.h>
    22 #include <e32std.h>
       
    23 #include <u32std.h>
    23 #include <eikapp.h>
    24 #include <eikapp.h>
    24 #include <eikstart.h>
    25 #include <eikstart.h>
    25 #include "MemoryManager.h"
    26 #include "MemoryManager.h"
    26 #include <OOMMonitorSession.h>
    27 #include <OOMMonitorSession.h>
    27 
    28 
    30 LOCAL_C CApaApplication* NewApplication( )
    31 LOCAL_C CApaApplication* NewApplication( )
    31     {
    32     {
    32     return new CBrowserApplication;
    33     return new CBrowserApplication;
    33     }
    34     }
    34 
    35 
       
    36 EXPORT_C TInt UserHeap::SetupThreadHeap(TBool, SStdEpocThreadCreateInfo& aInfo)
       
    37 	{
       
    38     TInt r = KErrNone;
       
    39     if (!aInfo.iAllocator && aInfo.iHeapInitialSize>0)
       
    40 		{
       
    41 		// new heap required
       
    42 		RHeap* pH = NULL;
       
    43 		r = CreateThreadHeap(aInfo, pH);
       
    44 		if (r == KErrNone)
       
    45 			{       // should happen for main thread, otherwise panic      
       
    46 					RAllocator* oldAllocator = MemoryManager::SwitchToFastAllocator();
       
    47 			}
       
    48 		}
       
    49 	else if (aInfo.iAllocator)
       
    50 		{
       
    51 		// sharing a heap
       
    52 		RAllocator* pA = aInfo.iAllocator;
       
    53 		pA->Open();
       
    54 		User::SwitchAllocator(pA);
       
    55 		}
       
    56 
       
    57     return r;
       
    58 	}
       
    59 
    35 GLDEF_C TInt E32Main()
    60 GLDEF_C TInt E32Main()
    36     {
    61     {
    37     ROomMonitorSession oomMs;
    62     ROomMonitorSession oomMs;
    38     TInt result = oomMs.Connect();
    63     TInt r = oomMs.Connect();
    39     if ( result == KErrNone )
    64     if (r == KErrNone)
    40         {
    65         {
    41         result = oomMs.RequestFreeMemory( KFreeMemoryTarget );
    66         r = oomMs.RequestFreeMemory(KFreeMemoryTarget);
    42         oomMs.Close();
    67         oomMs.Close();
    43         if ( result == KErrNone )
       
    44             {
       
    45             RAllocator* oldAllocator = MemoryManager::SwitchToFastAllocator();
       
    46             result = EikStart::RunApplication( NewApplication );
       
    47             MemoryManager::CloseFastAllocator(oldAllocator);
       
    48             }
       
    49         }
    68         }
    50     return result;
    69     
       
    70 	return EikStart::RunApplication(NewApplication);
    51     }
    71     }
    52 
    72 
    53 //  End of File  
    73 //  End of File