Update contrib.
1 // Copyright (c) 2008-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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
22 #include "stresslet.h"
26 // CStresslet::CRedrawHandler
29 CStresslet::CRedrawHandler* CStresslet::CRedrawHandler::NewL(CStresslet& aStresslet)
31 CRedrawHandler * self = new (ELeave) CRedrawHandler(aStresslet);
32 CleanupStack::PushL (self);
38 CStresslet::CRedrawHandler::~CRedrawHandler ()
43 CStresslet::CRedrawHandler::CRedrawHandler(CStresslet& aStresslet) :
44 CActive(EPriorityNormal), iStresslet(aStresslet)
48 void CStresslet::CRedrawHandler::ConstructL ()
50 CActiveScheduler::Add (this);
51 iStresslet.Session().RedrawReady (&iStatus);
55 void CStresslet::CRedrawHandler::RunL ()
57 iStresslet.Session().GetRedraw (iRedrawEvent);
59 if(iRedrawEvent.Handle () != 0)
61 iStresslet.HandleRedraw (iRedrawEvent);
64 iStresslet.Session().RedrawReady (&iStatus);
68 void CStresslet::CRedrawHandler::DoCancel ()
70 iStresslet.Session().RedrawReadyCancel ();
74 // CStresslet::CEventHandler
77 CStresslet::CEventHandler* CStresslet::CEventHandler::NewL (CStresslet& aStresslet)
79 CEventHandler * self = new (ELeave) CEventHandler(aStresslet);
80 CleanupStack::PushL (self);
86 CStresslet::CEventHandler::~CEventHandler ()
91 CStresslet::CEventHandler::CEventHandler (CStresslet& aStresslet) :
92 CActive(EPriorityNormal), iStresslet(aStresslet)
96 void CStresslet::CEventHandler::ConstructL ()
98 CActiveScheduler::Add (this);
99 iStresslet.Session().EventReady (&iStatus);
103 void CStresslet::CEventHandler::RunL ()
105 iStresslet.Session().GetEvent (iEvent);
107 iStresslet.HandleEvent (iEvent);
109 iStresslet.Session().EventReady (&iStatus);
114 void CStresslet::CEventHandler::DoCancel ()
116 iStresslet.Session().EventReadyCancel ();
120 // CStresslet::CStresslet
123 CStresslet::CStresslet (MTestStepReporter& aReporter) :
128 MTestStepReporter& CStresslet::Reporter ()
133 void CStresslet::ConcludeNow (void)
135 CActiveScheduler::Stop ();
138 void CStresslet::LaunchL (CStresslet* aStresslet)
140 CStresslet* obj = aStresslet;
142 CActiveScheduler* runner = new (ELeave) CActiveScheduler;
143 CleanupStack::PushL (runner);
144 CActiveScheduler::Install (runner);
148 CActiveScheduler::Start (); //runner
152 CleanupStack::PopAndDestroy (runner);
155 void CStresslet::ConstructL()
157 User::LeaveIfError(iWs.Connect());
158 iRedrawHandler = CRedrawHandler::NewL (*this);
159 iEventHandler = CEventHandler::NewL (*this);
160 iScreenDevice = new (ELeave)CWsScreenDevice(iWs);
161 User::LeaveIfError(iScreenDevice->Construct ());
162 User::LeaveIfError(iScreenDevice->CreateContext (iGc));
166 CStresslet::~CStresslet ()
168 delete iRedrawHandler;
169 delete iEventHandler;
173 RWsSession& CStresslet::Session ()
178 CWindowGc& CStresslet::WindowGc()
180 __ASSERT_ALWAYS(iGc, Panic(EPanic1));