56
|
1 |
// Copyright (c) 2007-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 |
// Implementation of RLowMemorySecuritySvrSession
|
|
15 |
//
|
|
16 |
//
|
|
17 |
|
|
18 |
#include "r_low_memory_security_svr_session.h"
|
|
19 |
#include <e32debug.h>
|
|
20 |
|
|
21 |
// test the effects of heap failure on global RSecuritySvrSession::GetList() in debug mode,
|
|
22 |
// in release mode normal call is made (heap checking not applicable)
|
|
23 |
TInt RLowMemorySecuritySvrSession::GetList(const Debug::TListId aListId, TDes8& aListData, TUint32& aDataSize)
|
|
24 |
{
|
|
25 |
TInt failAt = 0;
|
|
26 |
TInt err = KErrNoMemory;
|
|
27 |
while(err == KErrNoMemory)
|
|
28 |
{
|
|
29 |
failAt++;
|
|
30 |
FailAlloc(failAt);
|
|
31 |
MarkHeap();
|
|
32 |
err = this->RSecuritySvrSession::GetList(aListId, aListData, aDataSize);
|
|
33 |
if(KErrNoMemory == err)
|
|
34 |
{
|
|
35 |
MarkHeapEnd();
|
|
36 |
}
|
|
37 |
HeapReset();
|
|
38 |
//RDebug::Printf("Debug::RLowMemorySecuritySvrSession::GetList(): failAt: %d, err: %d", failAt, err);
|
|
39 |
}
|
|
40 |
return err;
|
|
41 |
}
|
|
42 |
|
|
43 |
// test the effects of heap failure on thread-specific RSecuritySvrSession::GetList() in debug mode,
|
|
44 |
// in release mode normal call is made (heap checking not applicable)
|
|
45 |
TInt RLowMemorySecuritySvrSession::GetList(const TThreadId aThreadId, const Debug::TListId aListId, TDes8& aListData, TUint32& aDataSize)
|
|
46 |
{
|
|
47 |
TInt failAt = 0;
|
|
48 |
TInt err = KErrNoMemory;
|
|
49 |
while(err == KErrNoMemory)
|
|
50 |
{
|
|
51 |
failAt++;
|
|
52 |
FailAlloc(failAt);
|
|
53 |
MarkHeap();
|
|
54 |
err = this->RSecuritySvrSession::GetList(aThreadId, aListId, aListData, aDataSize);
|
|
55 |
if(KErrNoMemory == err)
|
|
56 |
{
|
|
57 |
MarkHeapEnd();
|
|
58 |
}
|
|
59 |
HeapReset();
|
|
60 |
//RDebug::Printf("Debug::RLowMemorySecuritySvrSession::GetList(TThreadId): failAt: %d, err: %d", failAt, err);
|
|
61 |
}
|
|
62 |
return err;
|
|
63 |
}
|
|
64 |
|
|
65 |
// test the effects of heap failure on process-specific RSecuritySvrSession::GetList() in debug mode,
|
|
66 |
// in release mode normal call is made (heap checking not applicable)
|
|
67 |
TInt RLowMemorySecuritySvrSession::GetList(const TProcessId aProcessId, const Debug::TListId aListId, TDes8& aListData, TUint32& aDataSize)
|
|
68 |
{
|
|
69 |
TInt failAt = 0;
|
|
70 |
TInt err = KErrNoMemory;
|
|
71 |
while(err == KErrNoMemory)
|
|
72 |
{
|
|
73 |
failAt++;
|
|
74 |
FailAlloc(failAt);
|
|
75 |
MarkHeap();
|
|
76 |
err = this->RSecuritySvrSession::GetList(aProcessId, aListId, aListData, aDataSize);
|
|
77 |
if(KErrNoMemory == err)
|
|
78 |
{
|
|
79 |
MarkHeapEnd();
|
|
80 |
}
|
|
81 |
HeapReset();
|
|
82 |
//RDebug::Printf("Debug::RLowMemorySecuritySvrSession::GetList(TProcessId): failAt: %d, err: %d", failAt, err);
|
|
83 |
}
|
|
84 |
return err;
|
|
85 |
}
|
|
86 |
|