emailuis/emailui/src/FreestyleEmailUi.cpp
branchRCL_3
changeset 60 d620048b4810
parent 0 8466d47a6819
child 61 dcf0eedfc1a3
equal deleted inserted replaced
52:efd4f1afd43e 60:d620048b4810
     1 /*
     1 /*
     2 * Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
     2 * Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
    19 #include "emailtrace.h"
    19 #include "emailtrace.h"
    20 #include "FreestyleEmailUiApplication.h"
    20 #include "FreestyleEmailUiApplication.h"
    21 #include "FreestyleEmailUiDocument.h"
    21 #include "FreestyleEmailUiDocument.h"
    22 #include "FreestyleEmailUiConstants.h"
    22 #include "FreestyleEmailUiConstants.h"
    23 #include <eikstart.h>
    23 #include <eikstart.h>
       
    24 #include <u32std.h>
       
    25 #include <MemoryManager.h>
       
    26 
       
    27 #define __USE_FAST_ALLOCATOR
    24 
    28 
    25 CApaDocument* CFreestyleEmailUiApplication::CreateDocumentL()
    29 CApaDocument* CFreestyleEmailUiApplication::CreateDocumentL()
    26     {
    30     {
    27     FUNC_LOG;
    31     FUNC_LOG;
    28     CApaDocument* document = CFreestyleEmailUiDocument::NewL(*this);
    32     CApaDocument* document = CFreestyleEmailUiDocument::NewL(*this);
    39     {
    43     {
    40     FUNC_LOG;
    44     FUNC_LOG;
    41     return new CFreestyleEmailUiApplication;
    45     return new CFreestyleEmailUiApplication;
    42     }
    46     }
    43 
    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
    44 
    76 
    45 GLDEF_C TInt E32Main()
    77 GLDEF_C TInt E32Main()
    46     {
    78     {
       
    79 #ifdef __USE_FAST_ALLOCATOR
       
    80     // initialize MemmoryManager
       
    81     MemoryManager::InitFastAllocator();
       
    82 #endif // __USE_FAST_ALLOCATOR
    47     return EikStart::RunApplication(NewApplication);
    83     return EikStart::RunApplication(NewApplication);
    48     }
    84     }
    49     
       
    50 
    85 
       
    86