glib/glibbackend/src/glibbackend_wsd.cpp
changeset 0 e4d67989cc36
equal deleted inserted replaced
-1:000000000000 0:e4d67989cc36
       
     1 /*
       
     2 * Copyright (c) 2009 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: 
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #include <e32std.h>
       
    21 #include "glibbackend_wsd.h"
       
    22 #include "glibbackendinternal.h"
       
    23 
       
    24 #if EMULATOR
       
    25 #include "pls.h" // For emulator WSD API 
       
    26 const TUid KGlibbackendUid3 = {0x10282414};     // This is the UID of the library
       
    27 
       
    28 int InitializeWsd(struct global_struct* g)
       
    29 {
       
    30 	g->VARIABLE_NAME(key_once,lowmem) = PTHREAD_ONCE_INIT;
       
    31 	InitGLIBHeap(g->_iPrivateHeap);
       
    32 	return KErrNone;
       
    33 }
       
    34 
       
    35 struct global_struct *Glibbackend_ImpurePtr()
       
    36 {
       
    37 #if defined(__WINSCW__) || defined(__WINS__)
       
    38 
       
    39 	// Access the PLS of this process
       
    40 	struct global_struct* p  = Pls<struct global_struct>(KGlibbackendUid3, &InitializeWsd);
       
    41     return p;
       
    42 
       
    43 #else
       
    44 		
       
    45 	return NULL;
       
    46 
       
    47 #endif
       
    48 
       
    49 }
       
    50 
       
    51 //Implementation of private heap for glib
       
    52 #ifdef __WINSCW__
       
    53 RHeap* PrivateHeap()
       
    54 	{
       
    55 	return (Glibbackend_ImpurePtr()->_iPrivateHeap);
       
    56 	}
       
    57 #define iPrivateHeap	(PrivateHeap())
       
    58 #else
       
    59 RHeap* 			iPrivateHeap;
       
    60 #endif // WINSCW
       
    61 
       
    62 
       
    63 #endif /* EMULATOR */ 
       
    64