1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/graphics/windowing/windowserver/test/tdynamicres/inc/wsgcedebugsession.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,98 @@
1.4 +// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +//
1.18 +
1.19 +#ifndef WSGCEDEBUGSESSION_H_
1.20 +#define WSGCEDEBUGSESSION_H_
1.21 +
1.22 +#include <w32std.h>
1.23 +#include <w32debug.h>
1.24 +struct TWsDebugWindowId;
1.25 +
1.26 +class RWsDebugSession:public RWsSession
1.27 + {
1.28 +public:
1.29 + RWsDebugSession(TInt aScreenNo = -1);
1.30 + ~ RWsDebugSession();
1.31 + using RWsSession::DebugInfo; //exposes the following two functions:
1.32 +// TInt DebugInfo(TInt aFunction, TInt aParam=0) const;
1.33 +// TInt DebugInfo(TInt aFunction, TDes8& aReturnBuf, TInt aParam=0) const;
1.34 +
1.35 + /** Returns an array of debug data about the specified object.
1.36 + * The data is placed in the aHostBuffer
1.37 + * If data is returned, aReturnedObject points to the start of the returned data, and the return value is the number of DataType objects.
1.38 + * If no data is returned, aReturnedObject is NULL.
1.39 + * If so the return code indicates an error code, or the required number of objects.
1.40 + * The object index is specified using the masks and shifts in TWsDebugClassArgMask
1.41 + * Various error codes may be returned from the server, some of which may simply explain why no data is available.
1.42 + * The client may return
1.43 + * KErrCancel to indicate that there is zero length of data
1.44 + * KErrCorrupt if the size of the returned data is not an exact multiple of DataType.
1.45 + * No other type checking is performed.
1.46 + **/
1.47 + template <class DataType> // DataType may be TSurfaceId, TInt,TRect, TSurfaceConfiguration (not TRegion)
1.48 + TInt DebugInfo(TWsDebugInfoFunc aFunction, TInt aObjectIndex, TDes8& aHostBuffer,const DataType*&aReturnedObject)const
1.49 + {
1.50 + return DebugInfo(aFunction,aObjectIndex,aHostBuffer,(const void*&)aReturnedObject,sizeof(DataType));
1.51 + }
1.52 + /** Fills the region object with the specified debug information.
1.53 + * If required the region is resized to fit the data, which may fail with KErrNoMemory
1.54 + * The region will be forced to error state if an error code is returned.
1.55 + * Other details: see overloads
1.56 + **/
1.57 + TInt DebugInfo(TWsDebugInfoFunc aFunction, TInt aObjectIndex, TRegion& aPreAllocatedReturnedRegion)const;
1.58 +
1.59 + /** Indicates the start of a "consistancy-critical-read" section and fetches the window list.
1.60 + * Any number of debug commands can be fetched in the section, then client can check if the were interrupted by a server recalculation.
1.61 + **/
1.62 + TInt ResetUpdatedAndGetSurfaceWindowList (const TWsDebugWindowId*&);
1.63 + /** Indicates the start or end of a "consistancy-critical-read" section
1.64 + * Any number of debug commands can be fetched in the section, then client can check if the were interrupted by a server recalculation.
1.65 + * If this method returns ETrue then the data fetched since the start may be inconsistant, and should be refetched.
1.66 + * This method may also be used as a dirty way of waiting for a deferred update to occur.
1.67 + **/
1.68 + TBool ResetUpdated();
1.69 + /** Returns the screen number assigned when the stub was created.
1.70 + **/
1.71 + TInt DebugScreenNo() { return iScreenNo; }
1.72 + /** Helper method to correctly format the aObjectIndex parameter.
1.73 + **/
1.74 + inline TInt ObjInd(TInt aWin=0,TInt aLayer=0,TInt aExtra=0)
1.75 + { return ObjIndScr(iScreenNo,aWin,aLayer,aExtra); }
1.76 + /** Helper method to correctly format the aObjectIndex parameter.
1.77 + **/
1.78 + inline TInt ObjIndScr(TInt aScreen,TInt aWin=0,TInt aLayer=0,TInt aExtra=0);
1.79 +
1.80 + inline TInt Finish(TBool aAndFlush=ETrue)
1.81 + {
1.82 + if (aAndFlush)
1.83 + Flush();
1.84 + return RWsSession::Finish();
1.85 + }
1.86 +protected:
1.87 + // Resolves the template parameter to a size. See overload docs for more info.
1.88 + TInt DebugInfo(TWsDebugInfoFunc aFunction, TInt aObjectIndex, TDes8& aHostBuffer,const void*&aReturnedObject,TInt aSize)const;
1.89 + TInt iScreenNo;
1.90 + TInt iSurfaceUpdateSerial;
1.91 + RBuf8 iSurfaceListBuffer;
1.92 + };
1.93 +inline TInt RWsDebugSession::ObjIndScr(TInt aScreen,TInt aWin,TInt aLayer,TInt aExtra)
1.94 + {
1.95 + return (aScreen<<EWsDebugArgScreenShift)
1.96 + | (aWin<<EWsDebugArgWindowShift)
1.97 + | (aLayer<<EWsDebugArgLayerShift)
1.98 + | (aExtra<<EWsDebugArgExtraShift);
1.99 + }
1.100 +
1.101 +#endif /*WSGCEDEBUGSESSION_H_*/