1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). |
1 // Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies). |
2 // All rights reserved. |
2 // All rights reserved. |
3 // This component and the accompanying materials are made available |
3 // This component and the accompanying materials are made available |
4 // under the terms of "Eclipse Public License v1.0" |
4 // under the terms of "Eclipse Public License v1.0" |
5 // which accompanies this distribution, and is available |
5 // which accompanies this distribution, and is available |
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
45 |
45 |
46 void CTimerList::ConstructL() |
46 void CTimerList::ConstructL() |
47 { |
47 { |
48 CTimer::ConstructL(); |
48 CTimer::ConstructL(); |
49 } |
49 } |
50 |
50 |
|
51 static void DoCleanUp(TAny* aTimerInfo) |
|
52 { |
|
53 CTimerList::TTimerInfo* timerInfo = static_cast<CTimerList::TTimerInfo*>(aTimerInfo); |
|
54 delete timerInfo; |
|
55 timerInfo = NULL; |
|
56 } |
|
57 |
51 TInt32 CTimerList::AddL(const TTimeIntervalMicroSeconds32& aInterval, const TCallBack& aCallBack) |
58 TInt32 CTimerList::AddL(const TTimeIntervalMicroSeconds32& aInterval, const TCallBack& aCallBack) |
52 { |
59 { |
53 TTimerInfo* info = new(ELeave) TTimerInfo; |
60 TTimerInfo* info = new(ELeave) TTimerInfo; |
54 |
61 CleanupStack::PushL(TCleanupItem(DoCleanUp, info)); |
55 info->iCallBack = aCallBack; |
62 info->iCallBack = aCallBack; |
56 info->iTime.UniversalTime(); |
63 info->iTime.UniversalTime(); |
57 info->iTime += TTimeIntervalMicroSeconds32(aInterval); |
64 info->iTime += TTimeIntervalMicroSeconds32(aInterval); |
58 |
65 |
59 AddL(info); |
66 AddL(info); |
60 |
67 CleanupStack::Pop(info); |
61 return reinterpret_cast<TInt32>(info); |
68 return reinterpret_cast<TInt32>(info); |
62 } |
69 } |
63 |
70 |
64 TInt32 CTimerList::AddL(const TTime& aTime, const TCallBack& aCallBack) |
71 TInt32 CTimerList::AddL(const TTime& aTime, const TCallBack& aCallBack) |
65 { |
72 { |
66 TTimerInfo* info = new(ELeave) TTimerInfo; |
73 TTimerInfo* info = new(ELeave) TTimerInfo; |
67 |
74 CleanupStack::PushL(TCleanupItem(DoCleanUp, info)); |
68 info->iCallBack = aCallBack; |
75 info->iCallBack = aCallBack; |
69 info->iTime = aTime; |
76 info->iTime = aTime; |
70 |
77 |
71 AddL(info); |
78 AddL(info); |
72 |
79 CleanupStack::Pop(info); |
73 return reinterpret_cast<TInt32>(info); |
80 return reinterpret_cast<TInt32>(info); |
74 } |
81 } |
75 |
82 |
76 void CTimerList::AddL(const TTimerInfo* aInfo) |
83 void CTimerList::AddL(const TTimerInfo* aInfo) |
77 { |
84 { |