windowing/windowserver/nga/SERVER/openwfc/wstop.h
changeset 0 5d03bc08d59c
child 116 171fae344dd4
equal deleted inserted replaced
-1:000000000000 0:5d03bc08d59c
       
     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 class CWsPluginManager;
       
    36 typedef CDebugLogBase *(*CreateDebugLog)(TBool aIsFirst, TDesC &aParams);
       
    37 
       
    38 class CWsShellLogon : public CActive
       
    39 	{
       
    40 public:
       
    41 	CWsShellLogon();
       
    42 	~CWsShellLogon();
       
    43 	void ConstructL(RFs &aFs);
       
    44 	inline TFullName FullName();
       
    45 private:
       
    46 	void DoCancel();
       
    47 	void RunL();
       
    48 	void Request();
       
    49 private:
       
    50 #if defined(__WINS__)
       
    51 	RLibrary iLib;
       
    52 	RThread iShellThread;
       
    53 	RProcess iShellProcess;
       
    54 #else
       
    55 	RProcess iShell;
       
    56 #endif
       
    57 	};
       
    58 
       
    59 class CWsTop
       
    60 	{
       
    61 	enum {EShellBootModeReboot=0,EShellBootModeNoReboot=1,EShellBootModeExit=2};
       
    62 private:
       
    63 	class CShellStarter : public CTimer
       
    64 		{
       
    65 		public:
       
    66 			CShellStarter() : CTimer(EPriorityNormal) {CActiveScheduler::Add(this);}
       
    67 			void ConstructL() {CTimer::ConstructL();}
       
    68 		private:
       
    69 			void RunL() { CWsTop::StartShell(); }
       
    70 		};
       
    71 	
       
    72 public:
       
    73 	static void RunServerL();
       
    74 	static void InitStaticsL();
       
    75 	static void DeleteStaticsL();
       
    76 	static inline CWsWindowGroup *FocusWindowGroup();
       
    77 	static CWsClient *FocusWindowGroupOwner();
       
    78 
       
    79 	static RWsTextCursor *CurrentTextCursor();
       
    80 	static void SetCurrentTextCursor(RWsTextCursor *aCurrentTextCursor);
       
    81 	static inline void KillForegroundSession();
       
    82 //
       
    83 	static void TriggerRedraws(CWsRootWindow* aRootWindow);
       
    84 	static void ClientDestroyed(const CWsClient *aClient);
       
    85 	static void NewSession(const CWsClient *aClient);
       
    86 	static inline TBool ShuttingDown();
       
    87 	static void StartShell();
       
    88 	static void SessionExited(CWsClient *aClient);
       
    89 	static void ShellExited();
       
    90 	static void Exit();
       
    91     enum TReloadWsIni 
       
    92         {
       
    93         EDoReloadWsIni,
       
    94         EDoNotReloadWsIni
       
    95         };
       
    96     static void EnableLogging(TReloadWsIni aSetting = EDoReloadWsIni);
       
    97 	static void DisableLogging();
       
    98 	static TInt SetSendOffEventsToShell(CWsClient *aClient,const TWsClCmdOffEventsToShell &aData);
       
    99 	static void StopWindowGettingOffEvents(CWsWindowBase* aWindow);
       
   100 	static void HandleSwitchOff(TInt aEvent,TBool aDoSwitchOff);
       
   101 	static inline CScreen* Screen();
       
   102 	static inline CScreen* Screen(TInt aScreenId);
       
   103 	static inline TInt NumberOfScreens();
       
   104 	static void RedrawScreens();
       
   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 void ClearSurfaceMap(CWsClient* aClient);
       
   121 	static TBool SearchDuplicateSurfaceId(const TSurfaceId& aSurfaceId);
       
   122 	static TBool MultiFocusPolicy();
       
   123 	
       
   124 	static inline CWsPluginManager *PluginManager();
       
   125 	
       
   126 private:
       
   127 	static void InitLogging();
       
   128 	static void InitScreenL( TInt aScreenNumber)  ; 	
       
   129 
       
   130 private:
       
   131 // Data
       
   132 	static CShellStarter *iShellStarter;
       
   133 	static CWindowServer *iServer;
       
   134 	static RLibrary iDebugLib;
       
   135 	static CWsShellLogon *iShell;
       
   136 	static const CWsClient *iShellClient;
       
   137 	static TBool iPreviousShellClient;
       
   138 	static TInt iShellBootMode;
       
   139 	static TBool iShuttingDown;
       
   140 	static TBool iIsFirstLog;
       
   141 	static CWsWindowBase *iWindowToSendOffEventsTo;
       
   142 	static CArrayPtrFlat<CScreen>* iScreens ;
       
   143 	static CScreen* iCurrentFocusScreen;
       
   144 	static TInt iNumberOfScreens ;
       
   145 	static RTimer iTimer;
       
   146 	static TBool iIgnoreSwitchOffEvent;
       
   147 	static TBool iFadeEnabled;
       
   148 	static TBool iFinishEveryFlush;
       
   149 	static TBool iMultiFocusPolicy;
       
   150 	static const CWsClient* iTriggerHeapCheckOnClientExit;
       
   151 	static TWsCheckHeapOnDisconnectMode iHeapCheckMode;
       
   152 	static TInt iCheckHeapResult;
       
   153 	static TBool iDoHeapCheckAndRestart;
       
   154 	static CWsPluginManager *iPluginManager;
       
   155 	};
       
   156 	
       
   157 NONSHARABLE_CLASS(CWsActiveScheduler): public CActiveScheduler, public MWsActiveSchedulerDebug
       
   158 	{
       
   159 public:
       
   160 	static CWsActiveScheduler* Static();
       
   161 	CWsActiveScheduler();
       
   162 	~CWsActiveScheduler();
       
   163 	void PrepareDraw();
       
   164 	void CancelPrepare();
       
   165 	void StartDraw();
       
   166 	void StopDraw(TInt aPixelsUpdated);
       
   167 	void DrawStats(TInt& aUpdatesPerSecond,TInt64& aPixelsPerSecond,TInt aWindowInSeconds) const;
       
   168 	void WaitForAnyRequest();
       
   169 	void Error(TInt aError) const;
       
   170 	void AccumReclaimedIdleTime(TInt64 aMicroSeconds);
       
   171 	TInt64 ReclaimedIdleTime() const { return iReclaimedIdleTime; }
       
   172 	TInt64 Requests() const { return iRequests; }
       
   173 	TInt64 Errors() const { return iErrors; }
       
   174 	virtual TInt64 Draws() const { return iDraws; }
       
   175 	virtual TInt64 Total() const { return iTotal; }
       
   176 	virtual TInt64 Preparing() const { return iPreparing; }
       
   177 	virtual TInt64 Drawing() const { return iDrawing; }
       
   178 	virtual TInt64 Idle() const { return iIdle;	}
       
   179 private:
       
   180 #ifdef _DEBUG
       
   181 	enum TState
       
   182 		{
       
   183 		ENormal,
       
   184 		EPreparingDraw,
       
   185 		EDrawing,
       
   186 		EDrawn
       
   187 		};
       
   188 	TState iState;
       
   189 #endif
       
   190 	// request stats
       
   191 	TInt64 iRequests;
       
   192 	mutable TInt64 iErrors;
       
   193 	TInt64 iDraws;
       
   194 	TTime iRun;
       
   195 	TTime iRunDraw;
       
   196 	TInt64 iTotal;
       
   197 	TInt64 iPreparing;
       
   198 	TInt64 iDrawing;
       
   199 	TInt64 iIdle;
       
   200 	TInt64 iReclaimedIdleTime;
       
   201 	//TBool iPaused;
       
   202 	// pixels-per-second stats
       
   203 	NONSHARABLE_STRUCT(TSample)
       
   204 		{
       
   205 		TTime iStart;
       
   206 		TUint64 iDuration;
       
   207 		TUint32 iPixels;
       
   208 		};
       
   209 	TInt iFastCounterFreq;
       
   210 	TUint iNumSamples;
       
   211 	TUint iCurrent;
       
   212 	TSample* iData;	
       
   213 	};
       
   214 
       
   215 
       
   216 //
       
   217 // inlines			//
       
   218 //
       
   219 
       
   220 //
       
   221 // CWsTop
       
   222 //
       
   223 inline TBool CWsTop::ShuttingDown()
       
   224 	{return(iShuttingDown);}
       
   225 inline CWsWindowGroup *CWsTop::FocusWindowGroup()
       
   226 	{return(iCurrentFocusScreen->FocusWindowGroup());}
       
   227 inline void CWsTop::KillForegroundSession()
       
   228 	{iCurrentFocusScreen->KillForegroundSession();}
       
   229 inline CScreen* CWsTop::Screen()
       
   230 	{return CWsTop::Screen( 0 ) ;}
       
   231 inline CScreen* CWsTop::Screen(TInt aScreen)
       
   232 	{return (*iScreens)[aScreen];}
       
   233 inline TInt CWsTop::NumberOfScreens()
       
   234 	{return iNumberOfScreens;}
       
   235 inline CScreen* CWsTop::CurrentFocusScreen()	
       
   236 	{return iCurrentFocusScreen;}
       
   237 inline RTimer& CWsTop::Timer()
       
   238 	{return iTimer;}
       
   239 inline CWindowServer* CWsTop::WindowServer()
       
   240 	{return iServer;}
       
   241 inline TBool CWsTop::IsFadeEnabled()
       
   242 	{return iFadeEnabled;}
       
   243 inline TBool CWsTop::FinishEveryFlush()
       
   244 	{return iFinishEveryFlush;}
       
   245 inline CWsPluginManager *CWsTop::PluginManager()
       
   246 	{return iPluginManager;}
       
   247 
       
   248 #endif