예제 #1
0
/*
 * \internal
 * Called from the qtmain.lib application wrapper.
 * Create a new heap as requested, but use the new allocator
 */
Q_CORE_EXPORT TInt qt_symbian_SetupThreadHeap(TBool aNotFirst, SStdEpocThreadCreateInfo& aInfo)
{
    TInt r = KErrNone;
    if (!aInfo.iAllocator && aInfo.iHeapInitialSize>0)
    {
        // new heap required
        RHeap* pH = NULL;
        r = UserHeap::CreateThreadHeap(aInfo, pH);
    }
    else if (aInfo.iAllocator)
    {
        // sharing a heap
        RAllocator* pA = aInfo.iAllocator;
        pA->Open();
        User::SwitchAllocator(pA);
    }
    return r;
}
예제 #2
0
EXPORT_C TInt UserHeap::SetupThreadHeap(TBool, SStdEpocThreadCreateInfo& aInfo)
/**
@internalComponent
*/
	{
	TInt r = KErrNone;
	if (!aInfo.iAllocator && aInfo.iHeapInitialSize>0)
		{
		// new heap required
		RHeap* pH = NULL;
		r = CreateThreadHeap(aInfo, pH);
		}
	else if (aInfo.iAllocator)
		{
		// sharing a heap
		RAllocator* pA = aInfo.iAllocator;
		pA->Open();
		User::SwitchAllocator(pA);
		}
	return r;
	}
예제 #3
0
/* \internal
 *
 * Uses link-time symbol preemption to capture a call from the application
 * startup. On return, there is some kind of heap allocator installed on the
 * thread.
*/
TInt UserHeap::SetupThreadHeap(TBool aNotFirst, SStdEpocThreadCreateInfo& aInfo)
{
    TInt r = KErrNone;

#ifndef __WINS__
    // attempt to create the fast allocator through a known export ordinal in qtcore.dll
    RLibrary qtcore;
    if (qtcore.Load(QtCoreLibName) == KErrNone)
    {
        const int qt_symbian_SetupThreadHeap_eabi_ordinal = 3713;
        TLibraryFunction libFunc = qtcore.Lookup(qt_symbian_SetupThreadHeap_eabi_ordinal);
        if (libFunc)
        {
            typedef int (*TSetupThreadHeapFunc)(TBool aNotFirst, SStdEpocThreadCreateInfo& aInfo);
            TSetupThreadHeapFunc p_qt_symbian_SetupThreadHeap = TSetupThreadHeapFunc(libFunc);
            r = (*p_qt_symbian_SetupThreadHeap)(aNotFirst, aInfo);
        }
        qtcore.Close();
        if (libFunc)
            return r;
    }
#endif

    // no fast allocator support - use default allocator creation
    if (!aInfo.iAllocator && aInfo.iHeapInitialSize>0)
        {
        // new heap required
        RHeap* pH = NULL;
        r = UserHeap::CreateThreadHeap(aInfo, pH);
        }
    else if (aInfo.iAllocator)
        {
        // sharing a heap
        RAllocator* pA = aInfo.iAllocator;
        pA->Open();
        User::SwitchAllocator(pA);
        r = KErrNone;
        }
    return r;
}