sl@0: // Copyright (c) 2010 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: #include sl@0: #include sl@0: #include sl@0: #include sl@0: sl@0: void CleanupEComArray(TAny* aArray); sl@0: sl@0: CExtDisplayConnectionProviderInterface* CExtDisplayConnectionProviderInterface::NewL() sl@0: { sl@0: RImplInfoPtrArray implInfoArray; sl@0: TCleanupItem cleanup(CleanupEComArray, &implInfoArray); sl@0: CleanupStack::PushL(cleanup); sl@0: sl@0: REComSession::ListImplementationsL(TUid::Uid(KMediaDisplayExtProviderInterfaceUid), implInfoArray); sl@0: sl@0: if(implInfoArray.Count() == 0) sl@0: { sl@0: CleanupStack::PopAndDestroy(); // implInfoArray sl@0: return NULL; sl@0: } sl@0: sl@0: CExtDisplayConnectionProviderInterface* self = sl@0: REINTERPRET_CAST(CExtDisplayConnectionProviderInterface*, REComSession::CreateImplementationL( sl@0: implInfoArray[0]->ImplementationUid(), _FOFF(CExtDisplayConnectionProviderInterface, iInstanceKey))); sl@0: sl@0: CleanupStack::PopAndDestroy(); // implInfoArray sl@0: return self; sl@0: } sl@0: sl@0: EXPORT_C CExtDisplayConnectionProviderInterface::~CExtDisplayConnectionProviderInterface() sl@0: { sl@0: REComSession::DestroyedImplementation(iInstanceKey); sl@0: } sl@0: sl@0: EXPORT_C CExtDisplayConnectionProviderInterface::CExtDisplayConnectionProviderInterface() sl@0: { sl@0: } sl@0: sl@0: // CleanupEComArray function is used for cleanup support of locally declared arrays sl@0: void CleanupEComArray(TAny* aArray) sl@0: { sl@0: (static_cast (aArray))->ResetAndDestroy(); sl@0: (static_cast (aArray))->Close(); sl@0: }