diff -r 26645d81f48d -r cc28652e0254 persistentstorage/sql/SRC/Server/Compact/SqlCompact.cpp --- a/persistentstorage/sql/SRC/Server/Compact/SqlCompact.cpp Tue Aug 31 16:57:14 2010 +0300 +++ b/persistentstorage/sql/SRC/Server/Compact/SqlCompact.cpp Wed Sep 01 12:39:58 2010 +0100 @@ -13,16 +13,11 @@ // Description: // -#include "SqlAssert.h" +#include "SqlPanic.h" #include "SqlCompact.h" #include "SqlCompactEntry.h" #include "SqlCompactTimer.h" #include "SqlUtil.h" -#include "OstTraceDefinitions.h" -#ifdef OST_TRACE_COMPILER_IN_USE -#include "SqlCompactTraces.h" -#endif -#include "SqlTraceDef.h" ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -43,8 +38,8 @@ */ void TSqlCompactSettings::Invariant() const { - __ASSERT_DEBUG(iStepLength > 0, __SQLPANIC(ESqlPanicInternalError)); - __ASSERT_DEBUG(iFreePageThresholdKb >= 0, __SQLPANIC(ESqlPanicInternalError)); + __SQLASSERT(iStepLength > 0, ESqlPanicInternalError); + __SQLASSERT(iFreePageThresholdKb >= 0, ESqlPanicInternalError); } #endif//_DEBUG @@ -77,8 +72,8 @@ */ CSqlCompactor* CSqlCompactor::NewL(TSqlCompactConnFactoryL aConnFactoryL, TInt aCompactStepInterval) { - __ASSERT_DEBUG(aConnFactoryL != NULL, __SQLPANIC2(ESqlPanicBadArgument)); - __ASSERT_DEBUG(aCompactStepInterval > 0, __SQLPANIC2(ESqlPanicBadArgument)); + __SQLASSERT(aConnFactoryL != NULL, ESqlPanicBadArgument); + __SQLASSERT(aCompactStepInterval > 0, ESqlPanicBadArgument); CSqlCompactor* self = new (ELeave) CSqlCompactor(aConnFactoryL); CleanupStack::PushL(self); self->ConstructL(aCompactStepInterval); @@ -94,7 +89,7 @@ { for(TInt idx=iEntries.Count()-1;idx>=0;--idx) { - __ASSERT_DEBUG(iEntries[idx] != NULL, __SQLPANIC(ESqlPanicInternalError)); + __SQLASSERT(iEntries[idx] != NULL, ESqlPanicInternalError); while(iEntries[idx]->Release() != 0) { } @@ -139,13 +134,12 @@ */ void CSqlCompactor::AddEntryL(const TDesC& aFullName, const TSqlCompactSettings& aSettings) { - __ASSERT_DEBUG(aFullName.Length() > 0 && aFullName.Length() <= KMaxFileName, __SQLPANIC(ESqlPanicBadArgument)); + __SQLASSERT(aFullName.Length() > 0 && aFullName.Length() <= KMaxFileName, ESqlPanicBadArgument); SQLCOMPACTOR_INVARIANT(); CSqlCompactEntry* entry = NULL; TInt idx = iEntries.FindInOrder(aFullName, &CSqlCompactor::Search); if(idx == KErrNotFound) { - SQL_TRACE_COMPACT(OstTraceExt4(TRACE_INTERNALS, CSQLCOMPACTOR_ADDENTRYL1, "0x%X;CSqlCompactor::AddEntryL;New entry;aFullName=%S;iStepLength=%d;iFreePageThreashold=%d", (TUint)this, __SQLPRNSTR(aFullName), aSettings.iStepLength, aSettings.iFreePageThresholdKb)); entry = CSqlCompactEntry::NewLC(aFullName, iConnFactoryL, aSettings, *iTimer); TLinearOrder order(&CSqlCompactor::Compare); __SQLLEAVE_IF_ERROR(iEntries.InsertInOrder(entry, order)); @@ -153,9 +147,8 @@ } else { - SQL_TRACE_COMPACT(OstTraceExt4(TRACE_INTERNALS, CSQLCOMPACTOR_ADDENTRYL2, "0x%X;CSqlCompactor::AddEntryL;Reuse entry;aFullName=%S;iStepLength=%d;iFreePageThreashold=%d", (TUint)this, __SQLPRNSTR(aFullName), aSettings.iStepLength, aSettings.iFreePageThresholdKb)); entry = iEntries[idx]; - __ASSERT_DEBUG(entry != NULL, __SQLPANIC(ESqlPanicInternalError)); + __SQLASSERT(entry != NULL, ESqlPanicInternalError); (void)entry->AddRef(); } SQLCOMPACTOR_INVARIANT(); @@ -170,14 +163,13 @@ */ void CSqlCompactor::ReleaseEntry(const TDesC& aFullName) { - SQL_TRACE_COMPACT(OstTraceExt2(TRACE_INTERNALS, CSQLCOMPACTOR_RELEASEENTRY1, "0x%X;CSqlCompactor::ReleaseEntry;aFullName=%S", (TUint)this, __SQLPRNSTR(aFullName))); SQLCOMPACTOR_INVARIANT(); TInt idx = iEntries.FindInOrder(aFullName, &CSqlCompactor::Search); - __ASSERT_DEBUG(idx >= 0, __SQLPANIC(ESqlPanicInternalError)); + __SQLASSERT(idx >= 0, ESqlPanicInternalError); if(idx >= 0) { CSqlCompactEntry* entry = iEntries[idx]; - __ASSERT_DEBUG(entry != NULL, __SQLPANIC(ESqlPanicInternalError)); + __SQLASSERT(entry != NULL, ESqlPanicInternalError); if(entry) { if(entry->Release() == 0) @@ -207,7 +199,7 @@ iConnFactoryL(aConnFactoryL), iEntries(KEntriesGranularity) { - __ASSERT_DEBUG(aConnFactoryL != NULL, __SQLPANIC(ESqlPanicBadArgument)); + __SQLASSERT(aConnFactoryL != NULL, ESqlPanicBadArgument); } /** @@ -219,7 +211,7 @@ */ void CSqlCompactor::ConstructL(TInt aCompactStepInterval) { - __ASSERT_DEBUG(aCompactStepInterval > 0, __SQLPANIC(ESqlPanicBadArgument)); + __SQLASSERT(aCompactStepInterval > 0, ESqlPanicBadArgument); iTimer = CSqlCompactTimer::NewL(aCompactStepInterval); } @@ -231,11 +223,11 @@ */ /* static */TInt CSqlCompactor::Search(const TDesC* aFullName, const CSqlCompactEntry& aEntry) { - __ASSERT_DEBUG(&aEntry != NULL, __SQLPANIC2(ESqlPanicInternalError)); - __ASSERT_DEBUG(aFullName != NULL, __SQLPANIC2(ESqlPanicInternalError)); + __SQLASSERT(&aEntry != NULL, ESqlPanicInternalError); + __SQLASSERT(aFullName != NULL, ESqlPanicInternalError); const TDesC& fullName = *aFullName; - __ASSERT_DEBUG(fullName.Length() > 0 && fullName.Length() <= KMaxFileName, __SQLPANIC2(ESqlPanicInternalError)); - __ASSERT_DEBUG(aEntry.FullName().Length() > 0 && aEntry.FullName().Length() <= KMaxFileName, __SQLPANIC2(ESqlPanicInternalError)); + __SQLASSERT(fullName.Length() > 0 && fullName.Length() <= KMaxFileName, ESqlPanicInternalError); + __SQLASSERT(aEntry.FullName().Length() > 0 && aEntry.FullName().Length() <= KMaxFileName, ESqlPanicInternalError); return fullName.CompareF(aEntry.FullName()); } @@ -244,10 +236,10 @@ */ /* static */TInt CSqlCompactor::Compare(const CSqlCompactEntry& aLeft, const CSqlCompactEntry& aRight) { - __ASSERT_DEBUG(&aLeft != NULL, __SQLPANIC2(ESqlPanicInternalError)); - __ASSERT_DEBUG(&aRight != NULL, __SQLPANIC2(ESqlPanicInternalError)); - __ASSERT_DEBUG(aLeft.FullName().Length() > 0 && aLeft.FullName().Length() <= KMaxFileName, __SQLPANIC2(ESqlPanicInternalError)); - __ASSERT_DEBUG(aRight.FullName().Length() > 0 && aRight.FullName().Length() <= KMaxFileName, __SQLPANIC2(ESqlPanicInternalError)); + __SQLASSERT(&aLeft != NULL, ESqlPanicInternalError); + __SQLASSERT(&aRight != NULL, ESqlPanicInternalError); + __SQLASSERT(aLeft.FullName().Length() > 0 && aLeft.FullName().Length() <= KMaxFileName, ESqlPanicInternalError); + __SQLASSERT(aRight.FullName().Length() > 0 && aRight.FullName().Length() <= KMaxFileName, ESqlPanicInternalError); return aLeft.FullName().CompareF(aRight.FullName()); } @@ -257,12 +249,12 @@ */ void CSqlCompactor::Invariant() const { - __ASSERT_DEBUG(iConnFactoryL != NULL, __SQLPANIC(ESqlPanicInternalError)); - __ASSERT_DEBUG(iTimer != NULL, __SQLPANIC(ESqlPanicInternalError)); + __SQLASSERT(iConnFactoryL != NULL, ESqlPanicInternalError); + __SQLASSERT(iTimer != NULL, ESqlPanicInternalError); iTimer->Invariant(); for(TInt idx=iEntries.Count()-1;idx>=0;--idx) { - __ASSERT_DEBUG(iEntries[idx] != NULL, __SQLPANIC(ESqlPanicInternalError)); + __SQLASSERT(iEntries[idx] != NULL, ESqlPanicInternalError); iEntries[idx]->Invariant(); } }