emailuis/emailui/src/FreestyleEmailUi.cpp
branchRCL_3
changeset 25 3533d4323edc
equal deleted inserted replaced
24:d189ee25cf9d 25:3533d4323edc
       
     1 /*
       
     2 * Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  FreestyleEmailUi application entry point implementation
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include "emailtrace.h"
       
    20 #include "FreestyleEmailUiApplication.h"
       
    21 #include "FreestyleEmailUiDocument.h"
       
    22 #include "FreestyleEmailUiConstants.h"
       
    23 #include <eikstart.h>
       
    24 #include <u32std.h>
       
    25 #include <MemoryManager.h>
       
    26 
       
    27 //#define __USE_FAST_ALLOCATOR
       
    28 
       
    29 CApaDocument* CFreestyleEmailUiApplication::CreateDocumentL()
       
    30     {
       
    31     FUNC_LOG;
       
    32     CApaDocument* document = CFreestyleEmailUiDocument::NewL(*this);
       
    33     return document;
       
    34     }
       
    35 
       
    36 TUid CFreestyleEmailUiApplication::AppDllUid() const
       
    37     {
       
    38     FUNC_LOG;
       
    39     return KFSEmailUiUid;
       
    40     }
       
    41 
       
    42 LOCAL_C CApaApplication* NewApplication()
       
    43     {
       
    44     FUNC_LOG;
       
    45     return new CFreestyleEmailUiApplication;
       
    46     }
       
    47 
       
    48 #ifdef __USE_FAST_ALLOCATOR
       
    49 EXPORT_C TInt UserHeap::SetupThreadHeap( TBool aSubThread, SStdEpocThreadCreateInfo& aInfo )
       
    50     {
       
    51     TInt error( KErrNone );
       
    52     if (!aInfo.iAllocator && aInfo.iHeapInitialSize>0)
       
    53         {
       
    54         // new heap required
       
    55         RHeap* pH = NULL;
       
    56         error = CreateThreadHeap(aInfo, pH);
       
    57         if (!error && !aSubThread)
       
    58             {
       
    59             // main thread - new allocator created and set as default heap
       
    60             MemoryManager::CreateFastAllocator();
       
    61             }
       
    62         }
       
    63     else if (aInfo.iAllocator)
       
    64         {
       
    65         // sharing a heap
       
    66         RAllocator* pA = aInfo.iAllocator;
       
    67         error = pA->Open();
       
    68 		if (!error)
       
    69 			{
       
    70 			User::SwitchAllocator(pA);
       
    71 			}
       
    72         }
       
    73     return error;
       
    74     }
       
    75 #endif // __USE_FAST_ALLOCATOR
       
    76 
       
    77 GLDEF_C TInt E32Main()
       
    78     {
       
    79 #ifdef __USE_FAST_ALLOCATOR
       
    80     // initialize MemmoryManager
       
    81     MemoryManager::InitFastAllocator();
       
    82 #endif // __USE_FAST_ALLOCATOR
       
    83     return EikStart::RunApplication(NewApplication);
       
    84     }
       
    85 
       
    86