browserui/browser/BrowserAppSrc/BrowserAppEntryPoint.cpp
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Mon, 26 Oct 2009 08:18:09 +0200
changeset 22 d6f226a5ad2c
parent 0 84ad3b177aa3
child 31 868cceedabd3
permissions -rw-r--r--
Revision: 200941 Kit: 200943

/*
* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of the License "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
* Description: 
*     Browser App Entry point
*     
*
*/


#include "BrowserApplication.h"
#include <e32std.h>
#include <u32std.h>
#include <eikapp.h>
#include <eikstart.h>
#include "MemoryManager.h"
#include <OOMMonitorSession.h>

const int KFreeMemoryTarget = 6000000;

LOCAL_C CApaApplication* NewApplication( )
    {
    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 r = oomMs.Connect();
    if (r == KErrNone)
        {
        r = oomMs.RequestFreeMemory(KFreeMemoryTarget);
        oomMs.Close();
        }
    
	return EikStart::RunApplication(NewApplication);
    }

//  End of File