equal
deleted
inserted
replaced
17 #include <mtp/mtpprotocolconstants.h> |
17 #include <mtp/mtpprotocolconstants.h> |
18 #include "cmtphandleallocator.h" |
18 #include "cmtphandleallocator.h" |
19 #include "tmtptypeobjecthandle.h" |
19 #include "tmtptypeobjecthandle.h" |
20 #include "dbutility.h" |
20 #include "dbutility.h" |
21 #include "cmtpobjectstore.h" |
21 #include "cmtpobjectstore.h" |
|
22 #include "mtpdebug.h" |
|
23 #include "OstTraceDefinitions.h" |
|
24 #ifdef OST_TRACE_COMPILER_IN_USE |
|
25 #include "cmtphandleallocatorTraces.h" |
|
26 #endif |
|
27 |
22 |
28 |
23 static const TUint KMTPMinimumId = 0x00000000; |
29 static const TUint KMTPMinimumId = 0x00000000; |
24 static const TUint KMTPMaximumId = 0x00FFFFFE; |
30 static const TUint KMTPMaximumId = 0x00FFFFFE; |
25 static const TInt64 KMTPPOUIDStart = -1; |
31 static const TInt64 KMTPPOUIDStart = -1; |
26 static const TInt KMTPMaxDataProviderGranularity = 8; |
32 static const TInt KMTPMaxDataProviderGranularity = 8; |
133 { |
139 { |
134 __ASSERT_DEBUG(aDataProviderId >= iNextIds.Count(), User::Invariant()); |
140 __ASSERT_DEBUG(aDataProviderId >= iNextIds.Count(), User::Invariant()); |
135 TInt increase = aDataProviderId - iNextIds.Count() + KMTPMaxDataProviderGranularity; |
141 TInt increase = aDataProviderId - iNextIds.Count() + KMTPMaxDataProviderGranularity; |
136 while (increase--) |
142 while (increase--) |
137 { |
143 { |
138 User::LeaveIfError(iNextIds.Append(KMTPMinimumId)); |
144 LEAVEIFERROR(iNextIds.Append(KMTPMinimumId), |
|
145 OstTrace0( TRACE_ERROR, CMTPHANDLEALLOCATOR_EXTENDARRAYL, "add KMTPMinimumId to iNextIds error!" )); |
139 } |
146 } |
140 } |
147 } |
141 |
148 |
142 /** |
149 /** |
143 Second-phase construction |
150 Second-phase construction |
180 iObjectStore.CalcFreeHandlesL(aDataProviderId); |
187 iObjectStore.CalcFreeHandlesL(aDataProviderId); |
181 |
188 |
182 index = iNextIDPool.FindInOrder( aDataProviderId, CDPHandleCache::HanldeCacheOrderFromKeyAscending ); |
189 index = iNextIDPool.FindInOrder( aDataProviderId, CDPHandleCache::HanldeCacheOrderFromKeyAscending ); |
183 if( index == KErrNotFound ) |
190 if( index == KErrNotFound ) |
184 { |
191 { |
|
192 OstTrace1( TRACE_ERROR, CMTPHANDLEALLOCATOR_NEXTIDFROMPOOLL, "can't find DpId %d in iNextIDPool", aDataProviderId); |
185 User::Leave(KErrOverflow); |
193 User::Leave(KErrOverflow); |
186 } |
194 } |
187 } |
195 } |
188 |
196 |
189 TUint32 ret = iNextIDPool[index]->NextHandleID(); |
197 TUint32 ret = iNextIDPool[index]->NextHandleID(); |
192 iNextIDPool.Remove(index); |
200 iNextIDPool.Remove(index); |
193 } |
201 } |
194 |
202 |
195 if(ret > KMTPMaximumId ) |
203 if(ret > KMTPMaximumId ) |
196 { |
204 { |
|
205 OstTrace1( TRACE_ERROR, DUP1_CMTPHANDLEALLOCATOR_NEXTIDFROMPOOLL, |
|
206 "next HandleID %d in NextIDPool exceeds KMTPMaximuId!", ret ); |
197 User::Leave(KErrOverflow); |
207 User::Leave(KErrOverflow); |
198 } |
208 } |
199 |
209 |
200 return ret; |
210 return ret; |
201 } |
211 } |