devicediagnosticsfw/diagframework/src/diagpluginpoolimpl.cpp
branchRCL_3
changeset 25 b183ec05bd8c
parent 24 13d7c31c74e0
child 26 19bba8228ff0
equal deleted inserted replaced
24:13d7c31c74e0 25:b183ec05bd8c
     1 /*
       
     2 * Copyright (c) 2007 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:  Implementation of Diagnostics Plug-in Pool
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // CLASS DECLARATION
       
    20 #include "diagpluginpoolimpl.h"
       
    21 
       
    22 // SYSTEM INCLUDE FILES
       
    23 #include <ecom.h>
       
    24 #include <DiagPlugin.h>
       
    25 #include <DiagPluginPoolObserver.h>
       
    26 #include <DiagPluginConstructionParam.h>
       
    27 #include <DiagPluginPoolObserver.h>
       
    28 #include <DiagFrameworkDebug.h>
       
    29 #include <mmf/common/mmfcontrollerpluginresolver.h> // CleanupResetAndDestroyPushL
       
    30 
       
    31 // USER INCLUDE FILES
       
    32 #include "diagpluginloaderdependencyparser.h"
       
    33 #include "diagrootsuite.h"
       
    34 
       
    35 using namespace DiagPluginPool;
       
    36 using namespace DiagFwInternal;
       
    37 
       
    38 _LIT( KPanicCode, "PluginPool" );
       
    39 
       
    40 // ===========================================================================
       
    41 // PUBLIC MEMBER FUNCTIONS
       
    42 // ===========================================================================    
       
    43 
       
    44 // ---------------------------------------------------------------------------
       
    45 // NewL
       
    46 // ---------------------------------------------------------------------------
       
    47 //
       
    48 CDiagPluginPoolImpl* CDiagPluginPoolImpl::NewL( MDiagPluginPoolObserver& aObserver )
       
    49     {
       
    50     LOGSTRING("");
       
    51     CDiagPluginPoolImpl* self = CDiagPluginPoolImpl::NewLC( aObserver );
       
    52     CleanupStack::Pop( self );
       
    53     return self;
       
    54     }
       
    55 
       
    56 // ---------------------------------------------------------------------------
       
    57 // NewLC
       
    58 // ---------------------------------------------------------------------------
       
    59 //
       
    60 CDiagPluginPoolImpl* CDiagPluginPoolImpl::NewLC( MDiagPluginPoolObserver& aObserver )
       
    61     {
       
    62     CDiagPluginPoolImpl* self = new( ELeave )CDiagPluginPoolImpl( aObserver );
       
    63     CleanupStack::PushL( self );
       
    64     self->ConstructL();
       
    65     return self;
       
    66     }        
       
    67 
       
    68 // ---------------------------------------------------------------------------
       
    69 // Destructor
       
    70 // ---------------------------------------------------------------------------
       
    71 //
       
    72 CDiagPluginPoolImpl::~CDiagPluginPoolImpl()
       
    73     {
       
    74     LOGSTRING("");
       
    75     Cancel();
       
    76     iPlugins.ResetAndDestroy();
       
    77     iPlugins.Close();
       
    78     REComSession::FinalClose();
       
    79     }
       
    80     
       
    81 // ---------------------------------------------------------------------------
       
    82 // LoadAsyncL
       
    83 // ---------------------------------------------------------------------------
       
    84 //
       
    85 void CDiagPluginPoolImpl::LoadAsyncL()
       
    86     {
       
    87     LOGSTRING( "CDiagPluginPoolImpl::LoadAsyncL" )
       
    88 
       
    89     ASSERT ( !iPluginsLoaded );
       
    90     ASSERT ( !iPluginsLoading );
       
    91 
       
    92     iPluginsLoading = ETrue;       
       
    93        
       
    94     iConstructionParamArray = GeneratePluginListL();
       
    95     
       
    96     iTotalPluginsFound = iConstructionParamArray->Count();
       
    97 
       
    98     // No plug-ins found
       
    99     if ( ! iTotalPluginsFound )
       
   100         {
       
   101         DestroyConstructionParams();
       
   102         User::Leave( KErrNotFound );
       
   103         }                
       
   104             
       
   105     // Create root suite to define the hierarchy
       
   106     MDiagSuitePlugin* rootSuite = CDiagRootSuite::NewL();    
       
   107     CleanupStack::PushL( rootSuite );
       
   108     iPlugins.AppendL( rootSuite ); // ownership transfered        
       
   109     CleanupStack::Pop( rootSuite );
       
   110 
       
   111     SetNextIteration();
       
   112     }
       
   113     
       
   114 // ---------------------------------------------------------------------------
       
   115 // CreatePluginL
       
   116 // ---------------------------------------------------------------------------
       
   117 //
       
   118 MDiagPlugin* CDiagPluginPoolImpl::CreatePluginL( const TUid aUid )
       
   119     {
       
   120     TInt errorCode = KErrNone;
       
   121 
       
   122     LOGSTRING2( "CDiagPluginPoolImpl::CreatePluginL %d\n", aUid.iUid )
       
   123 
       
   124     // Create construction parameters list
       
   125     RConstructionParamArray* constructionParamsArray = GeneratePluginListL();
       
   126     CleanupStack::PushL( constructionParamsArray );
       
   127     CleanupResetAndDestroyPushL( *constructionParamsArray );
       
   128     
       
   129     MDiagPlugin* plugin = NULL;
       
   130     
       
   131     // Find plug-in with matching UID        
       
   132     for ( TInt i=0; i<constructionParamsArray->Count(); i++ )
       
   133         {
       
   134         if ( ( *constructionParamsArray )[i]->Uid() == aUid )
       
   135             {            
       
   136             plugin = CreatePluginFromConstructionParamsL( ( *constructionParamsArray )[i] );
       
   137             
       
   138             // Construction params owned by plug-in so remove from list
       
   139             constructionParamsArray->Remove(i);
       
   140             break;  //lint !e960 ok to break from for loop     
       
   141             }
       
   142         }
       
   143         
       
   144     if ( ! plugin )
       
   145         {                
       
   146         errorCode = KErrNotFound;                
       
   147         }
       
   148        
       
   149     CleanupStack::PopAndDestroy();        // *implInfoArray
       
   150     CleanupStack::PopAndDestroy( constructionParamsArray );
       
   151     
       
   152     User::LeaveIfError( errorCode );
       
   153         
       
   154     return plugin;    
       
   155     }
       
   156 
       
   157 // ---------------------------------------------------------------------------
       
   158 // FindPlugin
       
   159 // ---------------------------------------------------------------------------
       
   160 //
       
   161 TInt CDiagPluginPoolImpl::FindPlugin( TUid aUid, MDiagPlugin*& aPlugin ) const
       
   162     {
       
   163     LOGSTRING2( "CDiagPluginPoolImpl::FindPlugin 0x%x\n", aUid.iUid )
       
   164 
       
   165     aPlugin = NULL;
       
   166 
       
   167     // Find plug-in with matching UID in pool
       
   168     for ( TInt i=0; i<iPlugins.Count(); i++ )
       
   169         {           
       
   170         if ( iPlugins[i]->Uid() == aUid )           
       
   171             {
       
   172             aPlugin = iPlugins[i];            
       
   173             return KErrNone;
       
   174             }
       
   175         }
       
   176         
       
   177     return KErrNotFound;        
       
   178     }
       
   179 
       
   180 // ---------------------------------------------------------------------------
       
   181 // FindPlugin
       
   182 // ---------------------------------------------------------------------------
       
   183 //
       
   184 TInt CDiagPluginPoolImpl::FindPlugin( const TDesC& aServiceName,
       
   185                                         MDiagPlugin *& aPlugin ) const
       
   186     {    
       
   187     LOGSTRING2( "CDiagPluginPoolImpl::FindPlugin \"%S\"\n", &aServiceName )
       
   188 
       
   189     aPlugin = NULL;
       
   190     
       
   191     // Find plug-in with matching service name in pool
       
   192     for ( TInt i=0; i<iPlugins.Count(); i++ )
       
   193         {           
       
   194         if ( iPlugins[i]->ServiceLogicalName() == aServiceName )           
       
   195             {
       
   196             aPlugin = iPlugins[i];            
       
   197             return KErrNone;
       
   198             }
       
   199         }
       
   200         
       
   201     return KErrNotFound;
       
   202     }
       
   203 
       
   204 
       
   205 // ===========================================================================
       
   206 // PRIVATE CONSTRUCTORS
       
   207 // ===========================================================================
       
   208 
       
   209 // ---------------------------------------------------------------------------
       
   210 // CDiagPluginPool
       
   211 // ---------------------------------------------------------------------------
       
   212 //
       
   213 CDiagPluginPoolImpl::CDiagPluginPoolImpl( MDiagPluginPoolObserver& aObserver )
       
   214         // Priority is idle to allow plug-ins to load in background regardless of
       
   215         // what UI priority is set to.
       
   216     :   CActive( EPriorityIdle ),
       
   217         iObserver( aObserver ),
       
   218         iErrorCode( KErrNone )
       
   219     {
       
   220     }
       
   221 
       
   222 
       
   223 // ---------------------------------------------------------------------------
       
   224 // ConstructL
       
   225 // ---------------------------------------------------------------------------
       
   226 //
       
   227 void CDiagPluginPoolImpl::ConstructL()
       
   228     {
       
   229     CActiveScheduler::Add( this );
       
   230     }        
       
   231     
       
   232 
       
   233 // ===========================================================================
       
   234 // PRIVATE STATIC FUNCTIONS
       
   235 // ===========================================================================
       
   236 
       
   237 // ---------------------------------------------------------------------------
       
   238 // ObtainImplementationInfoL
       
   239 // ---------------------------------------------------------------------------
       
   240 //
       
   241 CDiagPluginPoolImpl::RConstructionParamArray* CDiagPluginPoolImpl::GeneratePluginListL()
       
   242     {     
       
   243 
       
   244     // Get list of plug-in implementation implementationInfo
       
   245     RImplInfoPtrArray* implInfoArray = new( ELeave )RImplInfoPtrArray;
       
   246     
       
   247     REComSession::ListImplementationsL( KDiagPluginInterfaceUid, *implInfoArray );
       
   248         
       
   249     // Leave if no matching plug-ins found        
       
   250     if ( ! implInfoArray->Count() )
       
   251         {
       
   252         delete implInfoArray;
       
   253         User::Leave( KErrNotFound );
       
   254         }
       
   255         
       
   256     CleanupStack::PushL( implInfoArray );
       
   257     CleanupResetAndDestroyPushL( *implInfoArray );         
       
   258         
       
   259     RConstructionParamArray* constructionParamsArray = new(ELeave)RConstructionParamArray;
       
   260     CleanupStack::PushL( constructionParamsArray );
       
   261     CleanupResetAndDestroyPushL( *constructionParamsArray );
       
   262     CDependencyParser* parser = CDependencyParser::NewLC();
       
   263     
       
   264     // Iterate through implementation information array and create construction data for each
       
   265     // plug-in.  Insert into array by order number.
       
   266     for ( TInt pluginIndex=0; pluginIndex < implInfoArray->Count(); pluginIndex++ )
       
   267         {
       
   268         CImplementationInformation* pluginImplementationInfo = ( *implInfoArray )[pluginIndex];
       
   269 
       
   270         if ( !pluginImplementationInfo->RomBased() )
       
   271             {
       
   272 #ifdef _DEBUG
       
   273             LOGSTRING2( "CDiagPluginPoolImpl::GeneratePluginListL() "
       
   274                 L" Loading non-rom plug-in 0x%08x", 
       
   275                 pluginImplementationInfo->ImplementationUid() );
       
   276 #else   // #ifdef _DEBUG
       
   277             // In non _DEBUG build, do not load plug-in that are not in ROM
       
   278             // for security reasons. Continue to next plug-in.
       
   279             //continue;
       
   280 #endif  // #else _DEBUG
       
   281             }
       
   282 
       
   283         // Obtain depenency and other information from opaque data field
       
   284         parser->ParseL( pluginImplementationInfo->OpaqueData(), 
       
   285                         pluginImplementationInfo->DataType() );
       
   286         
       
   287         CDiagPluginConstructionParam* constructionParams = 
       
   288             GenerateConstructionParamsLC( pluginImplementationInfo );
       
   289                 
       
   290         TInt orderNumber = constructionParams->Order();        
       
   291         
       
   292         // Find correct index to insert plug-in
       
   293         TInt insertIndex;
       
   294         for ( insertIndex=0; insertIndex<constructionParamsArray->Count(); insertIndex++ )
       
   295             {
       
   296             if ( orderNumber < (*constructionParamsArray)[insertIndex]->Order() )
       
   297                 {                
       
   298                 break;    //lint !e960 break OK here.
       
   299                 }
       
   300             } 
       
   301                         
       
   302         // Insert in order by order number
       
   303         constructionParamsArray->InsertL(constructionParams,insertIndex);            
       
   304         CleanupStack::Pop(constructionParams);
       
   305         }
       
   306                     
       
   307     // Clean up                    
       
   308     CleanupStack::PopAndDestroy(parser);              
       
   309     CleanupStack::Pop(); // constructionParamsArray
       
   310     CleanupStack::Pop(constructionParamsArray);            
       
   311     CleanupStack::PopAndDestroy(); // implInfoArray
       
   312     CleanupStack::PopAndDestroy(implInfoArray);                  
       
   313         
       
   314     return constructionParamsArray;
       
   315     }
       
   316     
       
   317 // ---------------------------------------------------------------------------
       
   318 // GenerateConstructionParamsL
       
   319 // ---------------------------------------------------------------------------
       
   320 //     
       
   321 CDiagPluginConstructionParam* CDiagPluginPoolImpl::GenerateConstructionParamsLC(
       
   322                                     const CImplementationInformation* aInfo )
       
   323     {
       
   324     CDependencyParser* parser = CDependencyParser::NewLC();
       
   325     
       
   326     // Obtain depenency and other information from opaque data field
       
   327     parser->ParseL( aInfo->OpaqueData(), aInfo->DataType() );
       
   328     
       
   329     CDiagPluginConstructionParam* params = CDiagPluginConstructionParam::NewL
       
   330                                     (
       
   331                                     parser->GetServiceProvided(),
       
   332                                     parser->GetServicesRequired(),
       
   333                                     parser->GetOrderNumber(),
       
   334                                     aInfo->ImplementationUid(),
       
   335                                     parser->GetParentUid()
       
   336                                     );
       
   337         
       
   338     CleanupStack::PopAndDestroy( parser );
       
   339     CleanupStack::PushL( params );
       
   340     
       
   341     return params;
       
   342     }
       
   343 
       
   344 // ---------------------------------------------------------------------------
       
   345 // CreatePluginFromImplementationInfoL
       
   346 // ---------------------------------------------------------------------------
       
   347 //    
       
   348 MDiagPlugin* CDiagPluginPoolImpl::CreatePluginFromConstructionParamsL(
       
   349                                     const CDiagPluginConstructionParam* aParams )
       
   350     {    
       
   351     MDiagPlugin* newPlugin = NULL;
       
   352     TUid destructorIdKey;
       
   353 
       
   354     // Call ECOM to load next plug-in
       
   355     TAny* object = REComSession::CreateImplementationL( aParams->Uid(), 
       
   356                                                         destructorIdKey, 
       
   357                                                         ( TAny* )aParams );
       
   358     if (!object)
       
   359     User::Leave(KErrNotFound);
       
   360     
       
   361     newPlugin = static_cast<MDiagPlugin*>( object );
       
   362     newPlugin->SetDtorIdKey( destructorIdKey );
       
   363     return newPlugin;
       
   364     }           
       
   365     
       
   366 // ===========================================================================
       
   367 // PRIVATE MEMBER FUNCTIONS
       
   368 // ===========================================================================
       
   369 
       
   370 // ---------------------------------------------------------------------------
       
   371 // AddNewPluginToSuiteL
       
   372 // ---------------------------------------------------------------------------
       
   373 //
       
   374 void CDiagPluginPoolImpl::AddNewPluginToSuiteL(MDiagPlugin* aPlugin)
       
   375     {
       
   376     // Search the plug-in list for a matching suite plug-in and add this newly
       
   377     // loaded plug-in to that corresponding suite.  If a suite is not found,
       
   378     // this plug-in will have no parent unless the parent suite is loaded
       
   379     // at some later point.
       
   380     for ( TInt pluginIndex = 0; pluginIndex < iPlugins.Count(); pluginIndex++ )
       
   381         {
       
   382         
       
   383         // Find matching parent suite
       
   384         if ( aPlugin->ParentUid() == iPlugins[pluginIndex]->Uid() )
       
   385             {               
       
   386             if ( iPlugins[pluginIndex]->Type() == MDiagPlugin::ETypeSuitePlugin )
       
   387                 {
       
   388                 // If parent is a suite, add child         
       
   389                 MDiagSuitePlugin* parent = static_cast<MDiagSuitePlugin*>( iPlugins[pluginIndex] );
       
   390                 
       
   391                 parent->AddChildL( aPlugin );
       
   392                 return;
       
   393                 }
       
   394             else
       
   395                 {
       
   396                 // if parent is not a suite, leave
       
   397                 User::Leave( KErrCorrupt );
       
   398                 }
       
   399             }            
       
   400         }   
       
   401     }
       
   402     
       
   403 // ---------------------------------------------------------------------------
       
   404 // AddPluginsToNewSuiteL
       
   405 // ---------------------------------------------------------------------------
       
   406 //    
       
   407 void CDiagPluginPoolImpl::AddPluginsToNewSuiteL(MDiagSuitePlugin* aPluginSuite)
       
   408     {        
       
   409     // Search the plug-in list for plug-ins with matching parent suite.
       
   410     for ( TInt pluginIndex = 0; pluginIndex < iPlugins.Count(); pluginIndex++ )
       
   411         {        
       
   412         // Add any "orphan" plug-ins
       
   413         if ( aPluginSuite->Uid() == iPlugins[pluginIndex]->ParentUid() )
       
   414             {                                      
       
   415             aPluginSuite->AddChildL( iPlugins[pluginIndex] );                      
       
   416             }            
       
   417         }   
       
   418     }    
       
   419 
       
   420 // ---------------------------------------------------------------------------
       
   421 // SetNextIteration
       
   422 // ---------------------------------------------------------------------------
       
   423 //
       
   424 void CDiagPluginPoolImpl::SetNextIteration()
       
   425     {
       
   426     TRequestStatus* status = &iStatus;
       
   427     
       
   428     // Complete own request
       
   429     User::RequestComplete( status, KErrNone );    
       
   430     SetActive();
       
   431     }
       
   432     
       
   433 // ---------------------------------------------------------------------------
       
   434 // LoadNextPlugin
       
   435 // ---------------------------------------------------------------------------
       
   436 //    
       
   437 void CDiagPluginPoolImpl::LoadNextPluginL()
       
   438     {
       
   439     // Get parameters to generate plug-in
       
   440     CDiagPluginConstructionParam* constructionParams = ( *iConstructionParamArray )[ 0 ];
       
   441     iCurrentPluginIndex++;
       
   442     MDiagPlugin* newPlugin = NULL;
       
   443     
       
   444     // Uid to report to application, defaults to NULL.
       
   445     TUid reportedUid = TUid::Null();
       
   446 
       
   447     // Create plug-in from ECOM structure
       
   448     // Any parsing or ECOM error will be caught here
       
   449     TRAPD( error, newPlugin = CreatePluginFromConstructionParamsL( constructionParams ) )
       
   450         
       
   451     // Construction params are now owned by plug-in so remove from array
       
   452     iConstructionParamArray->Remove( 0 );        
       
   453 
       
   454     LOGSTRING4( "CDiagPluginPoolImpl::LoadNextPluginL Plugin( %d/%d ): Error=%d\n",
       
   455                 iCurrentPluginIndex, iTotalPluginsFound, error )
       
   456                                                           
       
   457     // Check for error in plug-in creation                
       
   458     if ( error != KErrNone )
       
   459         {        
       
   460         if ( iErrorCode == KErrNone )
       
   461             {
       
   462             // Sets error code to whatever was the first error encountered        
       
   463             iErrorCode = error;
       
   464             }                     
       
   465         }
       
   466     else
       
   467         {
       
   468         
       
   469         CleanupDeletePushL( newPlugin );
       
   470         
       
   471         // Add to plug-in pool
       
   472         reportedUid = AddPluginToPoolLD( newPlugin );
       
   473         newPlugin = NULL;
       
   474         }
       
   475 
       
   476     // Load is not complete
       
   477     if ( iConstructionParamArray->Count() )
       
   478         {        
       
   479         
       
   480         // Set next plug-in to load in next active scheduler cycle
       
   481         SetNextIteration();
       
   482         
       
   483         // Report progress to client
       
   484         iObserver.LoadProgressL( iCurrentPluginIndex, iTotalPluginsFound, reportedUid );
       
   485         }
       
   486         
       
   487     // Load is complete        
       
   488     else
       
   489         {
       
   490         // Report load completed to client
       
   491         iPluginsLoading = EFalse;
       
   492         iPluginsLoaded = ETrue;
       
   493 
       
   494         iObserver.LoadCompletedL( iErrorCode );
       
   495 
       
   496         // Don't need implementation implementationInfo list anymore
       
   497         DestroyConstructionParams();
       
   498         }
       
   499     }
       
   500 
       
   501 // ---------------------------------------------------------------------------
       
   502 // DestroyConstructionParams
       
   503 // ---------------------------------------------------------------------------
       
   504 //    
       
   505 TUid CDiagPluginPoolImpl::AddPluginToPoolLD( MDiagPlugin* aPlugin )
       
   506     {
       
   507     
       
   508     TUid reportedUid = TUid::Null();
       
   509     
       
   510     // Add plug-in to list
       
   511     if ( aPlugin->IsSupported() )
       
   512         {
       
   513         iPlugins.AppendL( aPlugin );
       
   514         
       
   515         // Indicate to client that a plug-in was loaded with this UID
       
   516         reportedUid = aPlugin->Uid();
       
   517         
       
   518         // Update suite tree.  If this is a plug-in, try to find parent
       
   519         // suite and add.  If this is a suite, try to find child plug-ins
       
   520         // and add them.            
       
   521         AddNewPluginToSuiteL(aPlugin);
       
   522         
       
   523         if ( aPlugin->Type() == MDiagPlugin::ETypeSuitePlugin )
       
   524             {
       
   525             MDiagSuitePlugin* pluginSuite = 
       
   526                     static_cast<MDiagSuitePlugin*>(aPlugin);
       
   527             AddPluginsToNewSuiteL( pluginSuite );
       
   528             }            
       
   529         
       
   530         CleanupStack::Pop();    // aPlugin        
       
   531         }
       
   532     else
       
   533         {
       
   534         LOGSTRING2( " Plugin UID 0x%x NOT SUPPORTED. Skipped", aPlugin->Uid().iUid )
       
   535         CleanupStack::PopAndDestroy(); // aPlugin        
       
   536         }
       
   537         
       
   538     return reportedUid;        
       
   539     }
       
   540     
       
   541 // ---------------------------------------------------------------------------
       
   542 // DestroyConstructionParams
       
   543 // ---------------------------------------------------------------------------
       
   544 // 
       
   545 void CDiagPluginPoolImpl::DestroyConstructionParams( )
       
   546     {
       
   547     if ( iConstructionParamArray )
       
   548         {
       
   549         iConstructionParamArray->ResetAndDestroy();
       
   550         delete iConstructionParamArray;
       
   551         iConstructionParamArray = NULL;
       
   552         }
       
   553     }
       
   554     
       
   555 // ---------------------------------------------------------------------------
       
   556 // ResetAndNotify
       
   557 // ---------------------------------------------------------------------------
       
   558 //
       
   559 TInt CDiagPluginPoolImpl::ResetAndNotify(TInt aErrorCode)
       
   560     {
       
   561     // Reset load data
       
   562     iCurrentPluginIndex = 0;
       
   563     iPlugins.ResetAndDestroy();
       
   564 
       
   565     iPluginsLoading = EFalse;
       
   566 
       
   567     // Reset and delete implementation implementationInfo array
       
   568     DestroyConstructionParams();
       
   569 
       
   570     TRAPD( error, iObserver.LoadCompletedL( aErrorCode ) )
       
   571     
       
   572     return error;
       
   573     }
       
   574 
       
   575     
       
   576 
       
   577 // ===========================================================================
       
   578 // From CActive
       
   579 // ===========================================================================
       
   580 
       
   581 // ---------------------------------------------------------------------------
       
   582 // RunL
       
   583 // ---------------------------------------------------------------------------
       
   584 //
       
   585 void CDiagPluginPoolImpl::RunL()
       
   586     {
       
   587     // Load a plug-in in active scheduler cycle
       
   588     LoadNextPluginL();
       
   589     }
       
   590 
       
   591 // ---------------------------------------------------------------------------
       
   592 // DoCancel
       
   593 // ---------------------------------------------------------------------------
       
   594 //
       
   595 void CDiagPluginPoolImpl::DoCancel()
       
   596     {   
       
   597     LOGSTRING( "CDiagPluginPoolImpl::DoCancel" )
       
   598     
       
   599     TInt error = ResetAndNotify(KErrCancel);
       
   600 
       
   601     // Reset load data
       
   602     if ( error )
       
   603         {
       
   604         User::Panic( KPanicCode(), error );
       
   605         }
       
   606     }
       
   607 
       
   608 // ---------------------------------------------------------------------------
       
   609 // RunError
       
   610 // ---------------------------------------------------------------------------
       
   611 //
       
   612 TInt CDiagPluginPoolImpl::RunError( TInt aError )
       
   613     {
       
   614     // An unhandled exception occurs while running.  Destroy all currently
       
   615     // loaded plug-ins.
       
   616 
       
   617     LOGSTRING2( "CDiagPluginPoolImpl::RunError %d", aError )
       
   618 
       
   619     TInt err = ResetAndNotify( aError );
       
   620     LOGSTRING2( "CDiagPluginPoolImpl::RunError %d", err )
       
   621     
       
   622     return KErrNone;
       
   623     }
       
   624     
       
   625 // End of File
       
   626