Exemplo n.º 1
0
PassRefPtr<SharedMemory> SharedMemory::create(const Handle& handle, Protection protection)
{
    if (handle.isNull())
        return 0;

    // Convert number to string, and open the global chunk
    TBuf<KMaxKernelName> chunkName;
    chunkName.Format(_L("%d"), handle.m_chunkID);

    RChunk chunk;
    // NOTE: Symbian OS doesn't support read-only global chunks.
    TInt error = chunk.OpenGlobal(chunkName, false);
    if (error) {
        qCritical() << "Failed to create WK2 shared memory from handle " << error;
        return 0;
    }

    chunk.Adjust(chunk.MaxSize());
    RefPtr<SharedMemory> sharedMemory(adoptRef(new SharedMemory));
    sharedMemory->m_handle = chunk.Handle();
    sharedMemory->m_size = chunk.Size();
    sharedMemory->m_data = static_cast<void*>(chunk.Base());
    return sharedMemory.release();
}
Exemplo n.º 2
0
void UnfragmentMemoryFunc()
	{
	if (FragData.iDiscard && CacheSizeAdjustable)
		DPTest::SetCacheSize(OrigMinCacheSize, OrigMaxCacheSize);
	Chunk.Decommit(0, Chunk.MaxSize());
	}