|
1 // Copyright (c) 2003-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 // Sets compiler switches to control WSERV's build |
|
15 // |
|
16 // |
|
17 |
|
18 #ifndef __WSTOP_H__ |
|
19 #define __WSTOP_H__ |
|
20 |
|
21 #include <e32std.h> |
|
22 #include <e32base.h> |
|
23 #include <f32file.h> |
|
24 #include <w32debug.h> |
|
25 #include "w32cmd.h" |
|
26 #include "server.h" |
|
27 #include "tcursor.h" |
|
28 #include "ScrDev.H" |
|
29 #include "Direct.H" |
|
30 |
|
31 /** |
|
32 @internalTechnology |
|
33 */ |
|
34 class CWsRootWindow; |
|
35 typedef CDebugLogBase *(*CreateDebugLog)(TBool aIsFirst, TDesC &aParams); |
|
36 |
|
37 class CWsShellLogon : public CActive |
|
38 { |
|
39 public: |
|
40 CWsShellLogon(); |
|
41 ~CWsShellLogon(); |
|
42 void ConstructL(RFs &aFs); |
|
43 inline TFullName FullName(); |
|
44 private: |
|
45 void DoCancel(); |
|
46 void RunL(); |
|
47 void Request(); |
|
48 private: |
|
49 #if defined(__WINS__) |
|
50 RLibrary iLib; |
|
51 RThread iShellThread; |
|
52 RProcess iShellProcess; |
|
53 #else |
|
54 RProcess iShell; |
|
55 #endif |
|
56 }; |
|
57 |
|
58 class CWsTop |
|
59 { |
|
60 enum {EShellBootModeReboot=0,EShellBootModeNoReboot=1,EShellBootModeExit=2}; |
|
61 private: |
|
62 class CShellStarter : public CTimer |
|
63 { |
|
64 public: |
|
65 CShellStarter() : CTimer(EPriorityNormal) {CActiveScheduler::Add(this);} |
|
66 void ConstructL() {CTimer::ConstructL();} |
|
67 private: |
|
68 void RunL() { CWsTop::StartShell(); } |
|
69 }; |
|
70 |
|
71 public: |
|
72 static void RunServerL(); |
|
73 static void InitStaticsL(); |
|
74 static void DeleteStaticsL(); |
|
75 static inline CWsWindowGroup *FocusWindowGroup(); |
|
76 static CWsClient *FocusWindowGroupOwner(); |
|
77 |
|
78 static RWsTextCursor *CurrentTextCursor(); |
|
79 static void SetCurrentTextCursor(RWsTextCursor *aCurrentTextCursor); |
|
80 static inline void KillForegroundSession(); |
|
81 // |
|
82 static void TriggerRedraws(CWsRootWindow* aRootWindow); |
|
83 static void ClientDestroyed(const CWsClient *aClient); |
|
84 static void NewSession(const CWsClient *aClient); |
|
85 static inline TBool ShuttingDown(); |
|
86 static void StartShell(); |
|
87 static void SessionExited(CWsClient *aClient); |
|
88 static void ShellExited(); |
|
89 static void Exit(); |
|
90 enum TReloadWsIni |
|
91 { |
|
92 EDoReloadWsIni, |
|
93 EDoNotReloadWsIni |
|
94 }; |
|
95 static void EnableLogging(TReloadWsIni aSetting = EDoReloadWsIni); |
|
96 static void DisableLogging(); |
|
97 static TInt SetSendOffEventsToShell(CWsClient *aClient,const TWsClCmdOffEventsToShell &aData); |
|
98 static void StopWindowGettingOffEvents(CWsWindowBase* aWindow); |
|
99 static void HandleSwitchOff(TInt aEvent,TBool aDoSwitchOff); |
|
100 static inline CScreen* Screen(); |
|
101 static inline CScreen* Screen(TInt aScreenId); |
|
102 static inline TInt NumberOfScreens(); |
|
103 static void RedrawScreens(); |
|
104 static void UpdateAllScreens(); |
|
105 static void ClearAllRedrawStores(); |
|
106 static void LogCommand(RWsSession::TLoggingCommand aCommand); |
|
107 static inline RTimer& Timer(); |
|
108 static void StateDump(); |
|
109 static void SetCurrentFocusScreen(CScreen* aScreen); |
|
110 static inline CScreen* CurrentFocusScreen(); |
|
111 static TInt SetCurrentFocusScreen(TInt aScreenNo); |
|
112 static inline CWindowServer* WindowServer(); |
|
113 static void SetCheckHeapOnDisconnectClient(const CWsClient* aClient); |
|
114 static void SetCheckHeapOnDisconnectMode(TWsCheckHeapOnDisconnectMode aCheckHeapOnDisconnectMode); |
|
115 static TInt FetchCheckHeapResult(); |
|
116 static TBool NeedsHeapCheckAndRestart(TInt aStartHeapCount); |
|
117 static TBool ReleaseMemory(); |
|
118 static inline TBool IsFadeEnabled(); |
|
119 static inline TBool FinishEveryFlush(); |
|
120 static TBool MultiFocusPolicy(); |
|
121 |
|
122 private: |
|
123 static void InitLogging(); |
|
124 static void InitScreenL( TInt aScreenNumber) ; |
|
125 |
|
126 private: |
|
127 // Data |
|
128 static CShellStarter *iShellStarter; |
|
129 static CWindowServer *iServer; |
|
130 static RLibrary iDebugLib; |
|
131 static CWsShellLogon *iShell; |
|
132 static const CWsClient *iShellClient; |
|
133 static TBool iPreviousShellClient; |
|
134 static TInt iShellBootMode; |
|
135 static TBool iShuttingDown; |
|
136 static TBool iIsFirstLog; |
|
137 static CWsWindowBase *iWindowToSendOffEventsTo; |
|
138 static CArrayPtrFlat<CScreen>* iScreens ; |
|
139 static CScreen* iCurrentFocusScreen; |
|
140 static TInt iNumberOfScreens ; |
|
141 static RTimer iTimer; |
|
142 static TBool iIgnoreSwitchOffEvent; |
|
143 static TBool iFadeEnabled; |
|
144 static TBool iFinishEveryFlush; |
|
145 static TBool iMultiFocusPolicy; |
|
146 static const CWsClient* iTriggerHeapCheckOnClientExit; |
|
147 static TWsCheckHeapOnDisconnectMode iHeapCheckMode; |
|
148 static TInt iCheckHeapResult; |
|
149 static TBool iDoHeapCheckAndRestart; |
|
150 }; |
|
151 |
|
152 NONSHARABLE_CLASS(CWsActiveScheduler): public CActiveScheduler, public MWsActiveSchedulerDebug |
|
153 { |
|
154 public: |
|
155 static CWsActiveScheduler* Static(); |
|
156 CWsActiveScheduler(); |
|
157 ~CWsActiveScheduler(); |
|
158 void PrepareDraw(); |
|
159 void CancelPrepare(); |
|
160 void StartDraw(); |
|
161 void StopDraw(TInt aPixelsUpdated); |
|
162 void DrawStats(TInt& aUpdatesPerSecond,TInt64& aPixelsPerSecond,TInt aWindowInSeconds) const; |
|
163 void WaitForAnyRequest(); |
|
164 void Error(TInt aError) const; |
|
165 void AccumReclaimedIdleTime(TInt64 aMicroSeconds); |
|
166 TInt64 ReclaimedIdleTime() const { return iReclaimedIdleTime; } |
|
167 TInt64 Requests() const { return iRequests; } |
|
168 TInt64 Errors() const { return iErrors; } |
|
169 virtual TInt64 Draws() const { return iDraws; } |
|
170 virtual TInt64 Total() const { return iTotal; } |
|
171 virtual TInt64 Preparing() const { return iPreparing; } |
|
172 virtual TInt64 Drawing() const { return iDrawing; } |
|
173 virtual TInt64 Idle() const { return iIdle; } |
|
174 private: |
|
175 #ifdef _DEBUG |
|
176 enum TState |
|
177 { |
|
178 ENormal, |
|
179 EPreparingDraw, |
|
180 EDrawing, |
|
181 EDrawn |
|
182 }; |
|
183 TState iState; |
|
184 #endif |
|
185 // request stats |
|
186 TInt64 iRequests; |
|
187 mutable TInt64 iErrors; |
|
188 TInt64 iDraws; |
|
189 TTime iRun; |
|
190 TTime iRunDraw; |
|
191 TInt64 iTotal; |
|
192 TInt64 iPreparing; |
|
193 TInt64 iDrawing; |
|
194 TInt64 iIdle; |
|
195 TInt64 iReclaimedIdleTime; |
|
196 //TBool iPaused; |
|
197 // pixels-per-second stats |
|
198 NONSHARABLE_STRUCT(TSample) |
|
199 { |
|
200 TTime iStart; |
|
201 TUint64 iDuration; |
|
202 TUint32 iPixels; |
|
203 }; |
|
204 TInt iFastCounterFreq; |
|
205 TUint iNumSamples; |
|
206 TUint iCurrent; |
|
207 TSample* iData; |
|
208 }; |
|
209 |
|
210 |
|
211 // |
|
212 // inlines // |
|
213 // |
|
214 |
|
215 // |
|
216 // CWsTop |
|
217 // |
|
218 inline TBool CWsTop::ShuttingDown() |
|
219 {return(iShuttingDown);} |
|
220 inline CWsWindowGroup *CWsTop::FocusWindowGroup() |
|
221 {return(iCurrentFocusScreen->FocusWindowGroup());} |
|
222 inline void CWsTop::KillForegroundSession() |
|
223 {iCurrentFocusScreen->KillForegroundSession();} |
|
224 inline CScreen* CWsTop::Screen() |
|
225 {return CWsTop::Screen( 0 ) ;} |
|
226 inline CScreen* CWsTop::Screen(TInt aScreen) |
|
227 {return (*iScreens)[aScreen];} |
|
228 inline TInt CWsTop::NumberOfScreens() |
|
229 {return iNumberOfScreens;} |
|
230 inline CScreen* CWsTop::CurrentFocusScreen() |
|
231 {return iCurrentFocusScreen;} |
|
232 inline RTimer& CWsTop::Timer() |
|
233 {return iTimer;} |
|
234 inline CWindowServer* CWsTop::WindowServer() |
|
235 {return iServer;} |
|
236 inline TBool CWsTop::IsFadeEnabled() |
|
237 {return iFadeEnabled;} |
|
238 inline TBool CWsTop::FinishEveryFlush() |
|
239 {return iFinishEveryFlush;} |
|
240 #endif |