loggingservices/eventlogger/LogWrap/src/LOGACT.CPP
changeset 0 08ec8eefde2f
equal deleted inserted replaced
-1:000000000000 0:08ec8eefde2f
       
     1 // Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #include <logwrap.h>
       
    17 #include "LOGPANIC.H"
       
    18 
       
    19 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS 
       
    20 /**
       
    21 @internalAll
       
    22 */
       
    23 const TInt KLogActiveDoNotCompleteIfActive = KMaxTInt-1;
       
    24 
       
    25 #endif
       
    26 
       
    27 EXPORT_C CLogActive::CLogActive(TInt aPriority)
       
    28 : CActive(aPriority)
       
    29 	{
       
    30 	CActiveScheduler::Add(this);
       
    31 	}
       
    32 
       
    33 
       
    34 EXPORT_C CLogActive::~CLogActive()
       
    35 	{
       
    36 	}
       
    37 
       
    38 EXPORT_C void CLogActive::Queue(TRequestStatus& aStatus)
       
    39 	{
       
    40 	__ASSERT_DEBUG(iReport==NULL, Panic(ELogAlreadyActive));
       
    41 
       
    42 	aStatus=KRequestPending;
       
    43 	iReport=&aStatus;
       
    44 	}
       
    45 
       
    46 EXPORT_C void CLogActive::DoCancel()
       
    47 	{
       
    48 	TInt result=KErrCancel;
       
    49 	Complete(result);
       
    50 	}
       
    51 
       
    52 EXPORT_C void CLogActive::RunL()
       
    53 	{
       
    54 	TInt status=iStatus.Int();
       
    55 	if (status>=KErrNone)
       
    56 		{
       
    57 		TRAPD(error,DoRunL());
       
    58 		__ASSERT_DEBUG(error==KErrNone || !IsActive(), User::Invariant());
       
    59 		if (IsActive())	
       
    60 			return;
       
    61 		status=error;
       
    62 		}
       
    63 	Complete(status);
       
    64 	}
       
    65 
       
    66 EXPORT_C void CLogActive::Complete(TInt aStatus)
       
    67 	{
       
    68 	if (iReport)
       
    69 		{
       
    70 		DoComplete(aStatus);
       
    71 		if (IsActive() && aStatus == KLogActiveDoNotCompleteIfActive)
       
    72 			return;
       
    73 		User::RequestComplete(iReport, aStatus);
       
    74 		}
       
    75 	}
       
    76 
       
    77 EXPORT_C void CLogActive::DoComplete(TInt&)
       
    78 	{
       
    79 	}