contentstorage/casrv/carunningappmonitor/src/carunningapphandler.cpp
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Fri, 19 Mar 2010 09:35:23 +0200
changeset 60 f62f87b200ec
permissions -rw-r--r--
Revision: 201007 Kit: 201011

 /*
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
* Description: carunningapphandler.cpp
*
*/
#include "carunningapphandler.h"

#include "cadef.h"
#include "carunningappmonitor.h"

// -----------------------------------------------------------------------------
// CCaRunningAppHandler
// -----------------------------------------------------------------------------
//
CCaRunningAppHandler* CCaRunningAppHandler::NewL( TPluginParams* aParams )
    {
    if( aParams == 0 || aParams->storageProxy == 0 )
        {
        User::Leave(KErrCorrupt);
        }
    CCaRunningAppHandler* self = new (ELeave)CCaRunningAppHandler();
    CleanupStack::PushL( self );
    self->ConstructL( *aParams->storageProxy );
    CleanupStack::Pop( self );
    return self;
    }

// -----------------------------------------------------------------------------
// CCaRunningAppHandler
// -----------------------------------------------------------------------------
//
CCaRunningAppHandler::~CCaRunningAppHandler()
    {
    iRunningTasks.ResetAndDestroy();
    }

// -----------------------------------------------------------------------------
// CCaRunningAppHandler
// -----------------------------------------------------------------------------
//
CCaRunningAppHandler::CCaRunningAppHandler()
:
iRunningTasks( KDefaultGranularity )
    {
    //no implementation required
    }

// -----------------------------------------------------------------------------
// ConstructL
// -----------------------------------------------------------------------------
//
void CCaRunningAppHandler::ConstructL( CCaStorageProxy& aStorage )
    {
    CCaRunningAppMonitor::ExecuteL( *this, aStorage );
    }

// -----------------------------------------------------------------------------
// RegisterTaskL
// -----------------------------------------------------------------------------
//
void CCaRunningAppHandler::RegisterTaskL( CBase* aTask )
    {
    iRunningTasks.AppendL( aTask );
    }

// -----------------------------------------------------------------------------
// UnregisterTask
// -----------------------------------------------------------------------------
//
void CCaRunningAppHandler::UnregisterTask( CBase* aTask )
    {
    const TInt index( iRunningTasks.FindReverse( aTask ) );
    if( index != KErrNotFound )
        {
        iRunningTasks.Remove( index );
        }
    }