503 @param aName The name to be given to the chunk to be created |
503 @param aName The name to be given to the chunk to be created |
504 @internalComponent |
504 @internalComponent |
505 */ |
505 */ |
506 void TChunkCreateInfo::SetThreadHeap(TInt aInitialSize, TInt aMaxSize, const TDesC& aName) |
506 void TChunkCreateInfo::SetThreadHeap(TInt aInitialSize, TInt aMaxSize, const TDesC& aName) |
507 { |
507 { |
508 iType = TChunkCreate::ENormal | TChunkCreate::EData; |
508 iType = TChunkCreate::ENormal | TChunkCreate::EData; |
|
509 iMaxSize = aMaxSize; |
509 iInitialBottom = 0; |
510 iInitialBottom = 0; |
510 iInitialTop = aInitialSize; |
511 iInitialTop = aInitialSize; |
511 iMaxSize = aMaxSize; |
|
512 iAttributes |= TChunkCreate::ELocalNamed; |
512 iAttributes |= TChunkCreate::ELocalNamed; |
513 iName = &aName; |
513 iName = &aName; |
514 iOwnerType = EOwnerThread; |
514 iOwnerType = EOwnerThread; |
515 } |
515 } |
516 |
516 |
4770 Exec::KernelHeapDebug(EDbgSetAllocFail,aType,(TAny*)aRate); |
4770 Exec::KernelHeapDebug(EDbgSetAllocFail,aType,(TAny*)aRate); |
4771 else |
4771 else |
4772 GetHeap()->__DbgSetAllocFail(aType,aRate); |
4772 GetHeap()->__DbgSetAllocFail(aType,aRate); |
4773 } |
4773 } |
4774 |
4774 |
|
4775 UEXPORT_C RAllocator::TAllocFail User::__DbgGetAllocFail(TBool aKernel) |
|
4776 // |
|
4777 // Obtains the current heap failure simulation type. |
|
4778 // |
|
4779 /** |
|
4780 After calling __DbgSetAllocFail(), this function may be called to retrieve the |
|
4781 value set. This is useful primarily for test code that doesn't know if a heap |
|
4782 has been set to fail and needs to check. |
|
4783 |
|
4784 @param aKernel ETrue, if checking is being done for the kernel heap; |
|
4785 EFalse, if checking is being done for the current thread's |
|
4786 default heap. |
|
4787 |
|
4788 @return RAllocator::ENone if heap is not in failure simulation mode; |
|
4789 Otherwise one of the other RAllocator::TAllocFail enumerations |
|
4790 */ |
|
4791 { |
|
4792 if (aKernel) |
|
4793 { |
|
4794 RAllocator::TAllocFail allocFail; |
|
4795 Exec::KernelHeapDebug(EDbgGetAllocFail, 0, &allocFail); |
|
4796 return(allocFail); |
|
4797 } |
|
4798 else |
|
4799 return(GetHeap()->__DbgGetAllocFail()); |
|
4800 } |
|
4801 |
4775 /** |
4802 /** |
4776 Simulates a heap allocation failure for the current thread's default heap, |
4803 Simulates a heap allocation failure for the current thread's default heap, |
4777 or the kernel heap. |
4804 or the kernel heap. |
4778 |
4805 |
4779 The aBurst failures will occur after subsequent calls to new or any of the |
4806 The aBurst failures will occur after subsequent calls to new or any of the |