30 LOCAL_C CApaApplication* NewApplication( ) |
31 LOCAL_C CApaApplication* NewApplication( ) |
31 { |
32 { |
32 return new CBrowserApplication; |
33 return new CBrowserApplication; |
33 } |
34 } |
34 |
35 |
|
36 EXPORT_C TInt UserHeap::SetupThreadHeap(TBool, SStdEpocThreadCreateInfo& aInfo) |
|
37 { |
|
38 TInt r = KErrNone; |
|
39 if (!aInfo.iAllocator && aInfo.iHeapInitialSize>0) |
|
40 { |
|
41 // new heap required |
|
42 RHeap* pH = NULL; |
|
43 r = CreateThreadHeap(aInfo, pH); |
|
44 if (r == KErrNone) |
|
45 { // should happen for main thread, otherwise panic |
|
46 RAllocator* oldAllocator = MemoryManager::SwitchToFastAllocator(); |
|
47 } |
|
48 } |
|
49 else if (aInfo.iAllocator) |
|
50 { |
|
51 // sharing a heap |
|
52 RAllocator* pA = aInfo.iAllocator; |
|
53 pA->Open(); |
|
54 User::SwitchAllocator(pA); |
|
55 } |
|
56 |
|
57 return r; |
|
58 } |
|
59 |
35 GLDEF_C TInt E32Main() |
60 GLDEF_C TInt E32Main() |
36 { |
61 { |
37 ROomMonitorSession oomMs; |
62 ROomMonitorSession oomMs; |
38 TInt result = oomMs.Connect(); |
63 TInt r = oomMs.Connect(); |
39 if ( result == KErrNone ) |
64 if (r == KErrNone) |
40 { |
65 { |
41 result = oomMs.RequestFreeMemory( KFreeMemoryTarget ); |
66 r = oomMs.RequestFreeMemory(KFreeMemoryTarget); |
42 oomMs.Close(); |
67 oomMs.Close(); |
43 if ( result == KErrNone ) |
|
44 { |
|
45 RAllocator* oldAllocator = MemoryManager::SwitchToFastAllocator(); |
|
46 result = EikStart::RunApplication( NewApplication ); |
|
47 MemoryManager::CloseFastAllocator(oldAllocator); |
|
48 } |
|
49 } |
68 } |
50 return result; |
69 |
|
70 return EikStart::RunApplication(NewApplication); |
51 } |
71 } |
52 |
72 |
53 // End of File |
73 // End of File |