emailservices/emailframework/src/CFSClientAPIRequestHandler.cpp
branchRCL_3
changeset 12 4ce476e64c59
parent 11 0396474f30f5
child 13 8592a65ad3fb
equal deleted inserted replaced
11:0396474f30f5 12:4ce476e64c59
    24 // ================= MEMBER FUNCTIONS ==========================================	
    24 // ================= MEMBER FUNCTIONS ==========================================	
    25 // -----------------------------------------------------------------------------
    25 // -----------------------------------------------------------------------------
    26 // CFSMailRequestHandler::CFSMailRequestHandler
    26 // CFSMailRequestHandler::CFSMailRequestHandler
    27 // -----------------------------------------------------------------------------
    27 // -----------------------------------------------------------------------------
    28 CFSClientAPIRequestHandler::CFSClientAPIRequestHandler(  
    28 CFSClientAPIRequestHandler::CFSClientAPIRequestHandler(  
    29     MEmailClientPluginManager* aPluginManager ) : iPluginManager(aPluginManager), iInstanceCounter( 1 )
    29     MEmailClientPluginManager* aPluginManager ) : iPluginManager(aPluginManager)
    30 {
    30 {
    31     FUNC_LOG;
    31     FUNC_LOG;
       
    32 
       
    33 	// store pointer to TLS
       
    34 	TInt err = Dll::SetTls(static_cast<TAny*>(this));
    32 }
    35 }
    33 
    36 
    34 // -----------------------------------------------------------------------------
    37 // -----------------------------------------------------------------------------
    35 // CFSMailRequestHandler::~CFSMailRequestHandler
    38 // CFSMailRequestHandler::~CFSMailRequestHandler
    36 // -----------------------------------------------------------------------------
    39 // -----------------------------------------------------------------------------
       
    40 
    37 CFSClientAPIRequestHandler::~CFSClientAPIRequestHandler()
    41 CFSClientAPIRequestHandler::~CFSClientAPIRequestHandler()
    38     {
    42     {
    39     FUNC_LOG;
    43     FUNC_LOG;
    40     }
       
    41 
       
    42 // -----------------------------------------------------------------------------
       
    43 // CFSMailRequestHandler::GetInstanceL
       
    44 // -----------------------------------------------------------------------------
       
    45 CFSClientAPIRequestHandler* CFSClientAPIRequestHandler::GetInstanceL( MEmailClientPluginManager* aPluginManager )
       
    46     {
       
    47     CFSClientAPIRequestHandler *requestHandler = static_cast<CFSClientAPIRequestHandler*>( Dll::Tls() );
       
    48     if ( requestHandler == NULL )
       
    49         {
       
    50         requestHandler = CFSClientAPIRequestHandler::NewL( aPluginManager );
       
    51         }
       
    52     else
       
    53         {
       
    54         requestHandler->iInstanceCounter++;
       
    55         }
       
    56 	
       
    57     return requestHandler;
       
    58     }
       
    59 
       
    60 // -----------------------------------------------------------------------------
       
    61 // CFSMailRequestHandler::ReleaseInstance
       
    62 // -----------------------------------------------------------------------------
       
    63 void CFSClientAPIRequestHandler::ReleaseInstance()
       
    64     {
       
    65     if( iInstanceCounter > 1 )
       
    66         {
       
    67         iInstanceCounter--;
       
    68         }
       
    69     else
       
    70         {
       
    71         delete this;
       
    72         }
       
    73     }
    44     }
    74 
    45 
    75 // -----------------------------------------------------------------------------
    46 // -----------------------------------------------------------------------------
    76 // CFSMailRequestHandler::NewL
    47 // CFSMailRequestHandler::NewL
    77 // -----------------------------------------------------------------------------
    48 // -----------------------------------------------------------------------------