sl@0: // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // sl@0: sl@0: /** sl@0: @file sl@0: @internalComponent sl@0: */ sl@0: sl@0: #ifndef SGDRIVERIMPL_INL sl@0: #define SGDRIVERIMPL_INL sl@0: sl@0: sl@0: inline void Panic(TSgResourceAdapterPanicReason aReason) sl@0: { sl@0: User::Panic(KSgResourceAdapterPanicCategory, aReason); sl@0: } sl@0: sl@0: sl@0: // XSgBase sl@0: sl@0: inline XSgBase::XSgBase(XSgDriverImpl& aDriverImpl) sl@0: : iDriverImpl(aDriverImpl) sl@0: {} sl@0: sl@0: sl@0: inline void XSgBase::IncRefCount() sl@0: { sl@0: __ASSERT_DEBUG(iDriverImpl.IsMutexHeld(), Panic(ESgPanicMutexNotHeld)); sl@0: __ASSERT_DEBUG(iRefCount >= 0, Panic(ESgPanicBadReferenceCount)); sl@0: ++iRefCount; sl@0: } sl@0: sl@0: sl@0: inline TInt XSgBase::DecRefCount() sl@0: { sl@0: __ASSERT_DEBUG(iDriverImpl.IsMutexHeld(), Panic(ESgPanicMutexNotHeld)); sl@0: __ASSERT_DEBUG(iRefCount > 0, Panic(ESgPanicBadReferenceCount)); sl@0: return --iRefCount; sl@0: } sl@0: sl@0: sl@0: /** sl@0: @internalComponent sl@0: @test sl@0: */ sl@0: inline TInt XSgBase::RefCount() const sl@0: { sl@0: return iRefCount; sl@0: } sl@0: sl@0: sl@0: inline TAny* XSgBase::operator new(TUint aSize, TAny* aBase) sl@0: { sl@0: Mem::FillZ(aBase, aSize); sl@0: return aBase; sl@0: } sl@0: sl@0: sl@0: // XSgDriverImpl sl@0: sl@0: inline XSgDriverImpl::XSgDriverImpl(RHeap* aHeap) sl@0: : iHeap(aHeap) sl@0: {} sl@0: sl@0: sl@0: inline TAny* XSgDriverImpl::operator new(TUint aSize, TAny* aBase) sl@0: { sl@0: Mem::FillZ(aBase, aSize); sl@0: return aBase; sl@0: } sl@0: sl@0: sl@0: inline void XSgDriverImpl::Wait() sl@0: { sl@0: iMutex.Wait(); sl@0: } sl@0: sl@0: sl@0: inline void XSgDriverImpl::Signal() sl@0: { sl@0: iMutex.Signal(); sl@0: } sl@0: sl@0: sl@0: inline TBool XSgDriverImpl::IsMutexHeld() const sl@0: { sl@0: return iMutex.IsHeld(); sl@0: } sl@0: sl@0: sl@0: inline TAny* XSgDriverImpl::Alloc(TInt aSize) sl@0: { sl@0: return iHeap->Alloc(aSize); sl@0: } sl@0: sl@0: sl@0: inline void XSgDriverImpl::Free(TAny* aCell) sl@0: { sl@0: iHeap->Free(aCell); sl@0: } sl@0: sl@0: sl@0: inline TInt XSgDriverImpl::CreateSurface(const RSurfaceManager::TSurfaceCreationAttributesBuf& aReqs, TSurfaceId& aSurfaceId) sl@0: { sl@0: return iSurfaceManager.CreateSurface(aReqs, aSurfaceId); sl@0: } sl@0: sl@0: sl@0: inline TInt XSgDriverImpl::CreateSurface(const RSurfaceManager::TSurfaceCreationAttributesBuf& aReqs, TSurfaceId& aSurfaceId, const RChunk& aChunk) sl@0: { sl@0: return iSurfaceManager.CreateSurface(aReqs, aSurfaceId, aChunk); sl@0: } sl@0: sl@0: sl@0: inline TInt XSgDriverImpl::OpenSurface(const TSurfaceId& aSurfaceId) sl@0: { sl@0: return iSurfaceManager.OpenSurface(aSurfaceId); sl@0: } sl@0: sl@0: sl@0: inline TInt XSgDriverImpl::CloseSurface(const TSurfaceId& aSurfaceId) sl@0: { sl@0: return iSurfaceManager.CloseSurface(aSurfaceId); sl@0: } sl@0: sl@0: sl@0: inline TInt XSgDriverImpl::SurfaceInfo(const TSurfaceId& aSurfaceId, RSurfaceManager::TInfoBuf& aInfo) sl@0: { sl@0: return iSurfaceManager.SurfaceInfo(aSurfaceId, aInfo); sl@0: } sl@0: sl@0: sl@0: inline TInt XSgDriverImpl::SynchronizeCache(const TSurfaceId& aSurfaceId, TInt aBuffer, RSurfaceManager::TSyncOperation aOperation) sl@0: { sl@0: return iSurfaceManager.SynchronizeCache(aSurfaceId, aBuffer, aOperation); sl@0: } sl@0: sl@0: sl@0: inline TInt XSgDriverImpl::GetSurfaceHint(const TSurfaceId& aSurfaceId, RSurfaceManager::THintPair& aHint) sl@0: { sl@0: return iSurfaceManager.GetSurfaceHint(aSurfaceId, aHint); sl@0: } sl@0: sl@0: sl@0: #endif // SGDRIVERIMPL_INL