taskswitcher/server/src/tsdataobservertask.cpp
changeset 116 305818acdca4
equal deleted inserted replaced
112:dbfb5e38438b 116:305818acdca4
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 *
       
    16 */
       
    17 
       
    18 #include "tsdataobservertask.h"
       
    19 #include "tstaskmonitorglobals.h"
       
    20 // -----------------------------------------------------------------------------
       
    21 //
       
    22 // -----------------------------------------------------------------------------
       
    23 //
       
    24 CTsDataObserverTask::CTsDataObserverTask( MTsDataObserverStorage& aStorage, 
       
    25                                           const RMessage2& aMsg )
       
    26 :
       
    27     iStorage( aStorage ),
       
    28     iMsg( aMsg )
       
    29     {
       
    30     // No implementation required
       
    31     }
       
    32 
       
    33 
       
    34 // -----------------------------------------------------------------------------
       
    35 //
       
    36 // -----------------------------------------------------------------------------
       
    37 //
       
    38 CTsDataObserverTask::~CTsDataObserverTask()
       
    39     {
       
    40     if( EFalse == iMsg.IsNull() )
       
    41         {
       
    42         iMsg.Complete( iDataChanged ? KErrNone : KErrCancel );
       
    43         }
       
    44     }
       
    45 // -----------------------------------------------------------------------------
       
    46 //
       
    47 // -----------------------------------------------------------------------------
       
    48 //
       
    49 void CTsDataObserverTask::ExecuteLD( MTsDataObserverStorage& aStorage,
       
    50                                      const RMessage2& aMsg )
       
    51     {
       
    52     CTsDataObserver *self = new (ELeave)CTsDataObserverTask( aStorage, aMsg );
       
    53     CleanupStack::PushL( self );
       
    54     aStorage.PushL( self );
       
    55     CleanupStack::Pop( self );
       
    56     }
       
    57 
       
    58 // -----------------------------------------------------------------------------
       
    59 //
       
    60 // -----------------------------------------------------------------------------
       
    61 //
       
    62 void CTsDataObserverTask::DataChanged()
       
    63     {
       
    64     iDataChanged = ETrue;
       
    65     iStorage.Pop( this );
       
    66     delete this; 
       
    67     }