applayerpluginsandutils/httptransportplugins/httptransporthandler/chttptimer.cpp
changeset 0 b16258d2340f
equal deleted inserted replaced
-1:000000000000 0:b16258d2340f
       
     1 // Copyright (c) 2008-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 "chttptimer.h"
       
    17 #include "mhttptimerobserver.h"
       
    18 
       
    19 
       
    20 CHttpTimer* CHttpTimer::NewL(MHttpTimerObserver& aTimerObserver)
       
    21 	{
       
    22 	return new (ELeave) CHttpTimer(aTimerObserver);
       
    23 	}
       
    24 
       
    25 
       
    26 CHttpTimer::CHttpTimer(MHttpTimerObserver& aTimerObserver)
       
    27 :CActive(EPriorityStandard),iTimerObserver(aTimerObserver)
       
    28 	{
       
    29 	CActiveScheduler::Add(this);
       
    30 	iTimer.CreateLocal();
       
    31 	}
       
    32 
       
    33 CHttpTimer::~CHttpTimer()
       
    34 	{
       
    35 	Cancel();
       
    36 	iTimer.Close();	
       
    37 	}
       
    38 	
       
    39 void CHttpTimer::After(TTimeIntervalMicroSeconds32 anInterval)
       
    40 	{
       
    41 	if(!IsActive())
       
    42 		{
       
    43 		iTimer.After(iStatus, anInterval);	
       
    44 		SetActive();
       
    45 		}
       
    46 	}
       
    47 
       
    48 void CHttpTimer::DoCancel()
       
    49 	{
       
    50 	iTimer.Cancel();
       
    51 	}
       
    52 
       
    53 void CHttpTimer::RunL()
       
    54 	{
       
    55 	iTimerObserver.TimeOut();
       
    56 	}
       
    57 
       
    58