|
1 // Copyright (c) 2002-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 "LOGREC.H" |
|
17 |
|
18 // User includes |
|
19 #include "logservpanic.h" |
|
20 #include "LogServDatabaseTransactionInterface.h" |
|
21 |
|
22 |
|
23 CLogRecover::CLogRecover(MLogServDatabaseTransactionInterface& aDatabase, TInt aPriority) |
|
24 : CLogActive(aPriority), iDatabase(aDatabase) |
|
25 { |
|
26 } |
|
27 |
|
28 TBool CLogRecover::Start(TRequestStatus& aStatus) |
|
29 { |
|
30 if (!iDatabase.DTIDatabaseIsDamaged()) |
|
31 return EFalse; |
|
32 |
|
33 TInt error = iOperation.Recover(iDatabase.DTIDatabase(), iStep()); |
|
34 if (error != KErrNone) |
|
35 { |
|
36 __ASSERT_DEBUG(ETrue, Panic(ELogRecoverError)); |
|
37 return EFalse; |
|
38 } |
|
39 |
|
40 if (iStep() > 0) |
|
41 { |
|
42 Queue(aStatus); |
|
43 TRequestStatus* st = &iStatus; |
|
44 User::RequestComplete(st, KErrNone); |
|
45 SetActive(); |
|
46 |
|
47 return ETrue; |
|
48 } |
|
49 |
|
50 return EFalse; |
|
51 } |
|
52 |
|
53 void CLogRecover::DoRunL() |
|
54 { |
|
55 if (iStep() > 0) |
|
56 { |
|
57 iOperation.Next(iStep, iStatus); |
|
58 SetActive(); |
|
59 } |
|
60 else |
|
61 __ASSERT_DEBUG(!iDatabase.DTIInTransaction(), Panic(ELogDatabaseDamaged3)); |
|
62 } |
|
63 |
|
64 void CLogRecover::DoComplete(TInt& /*aCompletionCode*/) |
|
65 { |
|
66 iOperation.Close(); |
|
67 } |