applayerpluginsandutils/httptransportplugins/httptransporthandler/chttpasyncwaiter.cpp
changeset 0 b16258d2340f
equal deleted inserted replaced
-1:000000000000 0:b16258d2340f
       
     1 // Copyright (c) 2007-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 "chttpasyncwaiter.h"
       
    17  
       
    18 CHttpAsyncWaiter* CHttpAsyncWaiter::New()
       
    19     {
       
    20      return ( new CHttpAsyncWaiter() );
       
    21     }
       
    22  
       
    23  CHttpAsyncWaiter::CHttpAsyncWaiter()
       
    24      : CActive(EPriorityStandard)	
       
    25      {
       
    26      CActiveScheduler::Add(this);
       
    27      }   
       
    28  
       
    29  CHttpAsyncWaiter::~CHttpAsyncWaiter()
       
    30      {
       
    31      Cancel();
       
    32     }
       
    33      
       
    34  void CHttpAsyncWaiter::StartAndWait()
       
    35      {
       
    36      SetActive();
       
    37      CActiveScheduler::Start();
       
    38      }
       
    39      
       
    40  TInt CHttpAsyncWaiter::Result() const
       
    41      {
       
    42      return iError;
       
    43      }
       
    44      
       
    45  void CHttpAsyncWaiter::RunL()
       
    46      {
       
    47      iError = iStatus.Int();
       
    48      CActiveScheduler::Stop();
       
    49      }
       
    50      
       
    51  void CHttpAsyncWaiter::DoCancel()
       
    52      {
       
    53      iError = KErrCancel;
       
    54      CActiveScheduler::Stop();
       
    55      }
       
    56