remotestoragefw/remotefileengine/src/rsfwdormantmountloader.cpp
branchRCL_3
changeset 20 1aa8c82cb4cb
parent 0 3ad9d5175a89
equal deleted inserted replaced
19:88ee4cf65e19 20:1aa8c82cb4cb
       
     1 /*
       
     2 * Copyright (c) 2005 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:  class for restoring dormant mounts asynchronously when server starts
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include "rsfwdormantmountloader.h"
       
    21 #include "rsfwvolume.h"
       
    22 #include "rsfwfileengine.h"
       
    23 #include "rsfwfiletable.h"
       
    24 #include "mdebug.h"
       
    25 
       
    26 
       
    27 // ============================ MEMBER FUNCTIONS ===============================
       
    28 
       
    29 // -----------------------------------------------------------------------------
       
    30 // CRsfwDormantMountLoader::CRsfwDormantMountLoader
       
    31 // C++ default constructor can NOT contain any code, that
       
    32 // might leave.
       
    33 // -----------------------------------------------------------------------------
       
    34 //
       
    35 CRsfwDormantMountLoader::CRsfwDormantMountLoader() :
       
    36     CActive( CActive::EPriorityUserInput )
       
    37     {
       
    38     
       
    39     }
       
    40 
       
    41 // -----------------------------------------------------------------------------
       
    42 // CRsfwDormantMountLoader::ConstructL
       
    43 // Symbian 2nd phase constructor can leave.
       
    44 // -----------------------------------------------------------------------------
       
    45 //
       
    46 void CRsfwDormantMountLoader::ConstructL(CRsfwVolumeTable *aTheTable)
       
    47     {
       
    48     DEBUGSTRING(("CRsfwDormantMountLoader::ConstructL"));
       
    49     iVolumeTable = aTheTable;
       
    50     CActiveScheduler::Add( this );
       
    51     iTimer.CreateLocal();
       
    52     iTimer.After(iStatus, KDormantLoaderDelay);
       
    53     SetActive();
       
    54     }
       
    55 
       
    56 // -----------------------------------------------------------------------------
       
    57 // CRsfwDormantMountLoader::NewL()
       
    58 // Two-phased constructor.
       
    59 // -----------------------------------------------------------------------------
       
    60 //
       
    61 EXPORT_C CRsfwDormantMountLoader* CRsfwDormantMountLoader::NewL(CRsfwVolumeTable *aTheTable)
       
    62     {
       
    63     DEBUGSTRING(("CRsfwDormantMountLoader::NewL"));
       
    64     CRsfwDormantMountLoader* self = new ( ELeave ) CRsfwDormantMountLoader();
       
    65 
       
    66     CleanupStack::PushL( self );
       
    67     self->ConstructL(aTheTable);
       
    68     CleanupStack::Pop();
       
    69 
       
    70     return self;
       
    71     }
       
    72 
       
    73 // -----------------------------------------------------------------------------
       
    74 // Destructor
       
    75 // -----------------------------------------------------------------------------
       
    76 //
       
    77 EXPORT_C CRsfwDormantMountLoader::~CRsfwDormantMountLoader()
       
    78     {
       
    79     DEBUGSTRING16(("CRsfwDormantMountLoader::~CRsfwDormantMountLoader"));
       
    80     Deque();
       
    81     iTimer.Close();
       
    82     }
       
    83     
       
    84     
       
    85 // -----------------------------------------------------------------------------
       
    86 // CRsfwDormantMountLoader::SaveDirtyFiles
       
    87 // -----------------------------------------------------------------------------
       
    88 //   
       
    89  void CRsfwDormantMountLoader::ResolveDirtyFilesL()
       
    90     {
       
    91     DEBUGSTRING16(("CRsfwDormantMountLoader::ResolveDirtyFilesL"));   
       
    92     for (int i = 0; i < KMaxVolumes; i++) 
       
    93         {
       
    94         if (iVolumeTable) 
       
    95             { 
       
    96             DEBUGSTRING16(("CRsfwDormantMountLoader::ResolveDirtyFilesL drive %d", i)); 
       
    97             CRsfwVolume* volume = iVolumeTable->iVolumes[i];
       
    98             if (volume && volume->iFileEngine && volume->iFileEngine->iFileTable) 
       
    99                 {
       
   100                 DEBUGSTRING16(("drive contains active remote mount")); 
       
   101                 volume->iFileEngine->iFileTable->ResolveDirtyFilesL();
       
   102                 }
       
   103             }
       
   104         }
       
   105     }
       
   106     
       
   107 // -----------------------------------------------------------------------------
       
   108 // CRsfwDormantMountLoader::RunL
       
   109 // Handles an active object’s request completion event.
       
   110 // (other items were commented in a header).
       
   111 // -----------------------------------------------------------------------------
       
   112 //
       
   113 void CRsfwDormantMountLoader::RunL()
       
   114     {
       
   115     DEBUGSTRING(("CRsfwDormantMountLoader::RunL"));
       
   116     ResolveDirtyFilesL();
       
   117     iVolumeTable->DeleteTheMarker();
       
   118     iVolumeTable->iDormantMountRestorePending = EFalse;
       
   119     // "Simulate" operation completion (which may result in RFE shutdown)
       
   120     iVolumeTable->OperationCompleted(NULL);
       
   121     }
       
   122     
       
   123 // ----------------------------------------------------------------------------
       
   124 // CRsfwDormantMountLoader::RunError
       
   125 // ----------------------------------------------------------------------------
       
   126 //
       
   127 TInt CRsfwDormantMountLoader::RunError(TInt /*aError*/)
       
   128     {
       
   129     DEBUGSTRING16(("CRsfwDormantMountLoader::RunError"));		
       
   130     return KErrNone;
       
   131 	}    
       
   132     
       
   133 // -----------------------------------------------------------------------------
       
   134 // CRsfwDormantMountLoader::DoCancel
       
   135 // -----------------------------------------------------------------------------
       
   136 //  
       
   137 void CRsfwDormantMountLoader::DoCancel() 
       
   138 	{
       
   139 	DEBUGSTRING(("CRsfwDormantMountLoader::RunL"));	
       
   140 	}  
       
   141 
       
   142 
       
   143 // -----------------------------------------------------------------------------
       
   144 
       
   145 //  End of File