os/graphics/windowing/windowserver/test/tdynamicres/inc/wsgcedebugsession.h
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
sl@0
     1
// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     2
// All rights reserved.
sl@0
     3
// This component and the accompanying materials are made available
sl@0
     4
// under the terms of "Eclipse Public License v1.0"
sl@0
     5
// which accompanies this distribution, and is available
sl@0
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     7
//
sl@0
     8
// Initial Contributors:
sl@0
     9
// Nokia Corporation - initial contribution.
sl@0
    10
//
sl@0
    11
// Contributors:
sl@0
    12
//
sl@0
    13
// Description:
sl@0
    14
//
sl@0
    15
sl@0
    16
#ifndef WSGCEDEBUGSESSION_H_
sl@0
    17
#define WSGCEDEBUGSESSION_H_
sl@0
    18
sl@0
    19
#include <w32std.h>
sl@0
    20
#include <w32debug.h>
sl@0
    21
struct TWsDebugWindowId;
sl@0
    22
sl@0
    23
class RWsDebugSession:public RWsSession
sl@0
    24
	{
sl@0
    25
public:
sl@0
    26
	RWsDebugSession(TInt aScreenNo = -1);
sl@0
    27
	~ RWsDebugSession();
sl@0
    28
	using RWsSession::DebugInfo;		//exposes the following two functions:
sl@0
    29
//	TInt	DebugInfo(TInt aFunction, TInt aParam=0) const;
sl@0
    30
//	TInt	DebugInfo(TInt aFunction, TDes8& aReturnBuf, TInt aParam=0) const;
sl@0
    31
	
sl@0
    32
	/**	Returns an array of debug data about the specified object. 
sl@0
    33
	 *  The data is placed in the aHostBuffer 
sl@0
    34
	 * 	If data is returned, aReturnedObject points to the start of the returned data, and the return value is the number of DataType objects.
sl@0
    35
	 * 	If no data is returned, aReturnedObject is NULL.
sl@0
    36
	 *  If so the return code indicates an error code, or the required number of objects.
sl@0
    37
	 * 	The object index is specified using the masks and shifts in TWsDebugClassArgMask
sl@0
    38
	 *  Various error codes may be returned from the server, some of which may simply explain why no data is available.
sl@0
    39
	 * 	The client may return 
sl@0
    40
	 * 		KErrCancel to indicate that there is zero length of data
sl@0
    41
	 * 		KErrCorrupt if the size of the returned data is not an exact multiple of DataType.
sl@0
    42
	 * 	No other type checking is performed.  
sl@0
    43
	 **/
sl@0
    44
	template <class DataType>	// DataType may be TSurfaceId, TInt,TRect, TSurfaceConfiguration (not TRegion)
sl@0
    45
	TInt	DebugInfo(TWsDebugInfoFunc aFunction, TInt aObjectIndex, TDes8& aHostBuffer,const DataType*&aReturnedObject)const
sl@0
    46
	{
sl@0
    47
	return DebugInfo(aFunction,aObjectIndex,aHostBuffer,(const void*&)aReturnedObject,sizeof(DataType));
sl@0
    48
	}
sl@0
    49
	/**	Fills the region object with the specified debug information.
sl@0
    50
	 * 	If required the region is resized to fit the data, which may fail with KErrNoMemory
sl@0
    51
	 * 	The region will be forced to error state if an error code is returned.
sl@0
    52
	 * 	Other details: see overloads
sl@0
    53
	 **/
sl@0
    54
	TInt	DebugInfo(TWsDebugInfoFunc aFunction, TInt aObjectIndex, TRegion& aPreAllocatedReturnedRegion)const;
sl@0
    55
	
sl@0
    56
	/** Indicates the start of a "consistancy-critical-read" section and fetches the window list.
sl@0
    57
	 * 	Any number of debug commands can be fetched in the section, then client can check if the were interrupted by a server recalculation.
sl@0
    58
	 **/
sl@0
    59
	TInt	ResetUpdatedAndGetSurfaceWindowList (const TWsDebugWindowId*&);
sl@0
    60
	/** Indicates the start or end of a "consistancy-critical-read" section
sl@0
    61
	 * 	Any number of debug commands can be fetched in the section, then client can check if the were interrupted by a server recalculation.
sl@0
    62
	 * 	If this method returns ETrue then the data fetched since the start may be inconsistant, and should be refetched.
sl@0
    63
	 * 	This method may also be used as a dirty way of waiting for a deferred update to occur.
sl@0
    64
	 **/
sl@0
    65
	TBool	ResetUpdated();
sl@0
    66
	/**	Returns the screen number assigned when the stub was created. 
sl@0
    67
	 **/
sl@0
    68
	TInt DebugScreenNo()	{	return iScreenNo;	}
sl@0
    69
	/** Helper method to correctly format the aObjectIndex parameter.
sl@0
    70
	 **/
sl@0
    71
	inline TInt ObjInd(TInt aWin=0,TInt aLayer=0,TInt aExtra=0)
sl@0
    72
		{	return ObjIndScr(iScreenNo,aWin,aLayer,aExtra);	}
sl@0
    73
	/** Helper method to correctly format the aObjectIndex parameter.
sl@0
    74
	 **/
sl@0
    75
	inline TInt ObjIndScr(TInt aScreen,TInt aWin=0,TInt aLayer=0,TInt aExtra=0);
sl@0
    76
	
sl@0
    77
	inline	TInt Finish(TBool aAndFlush=ETrue)
sl@0
    78
		{
sl@0
    79
		if (aAndFlush)
sl@0
    80
			Flush();
sl@0
    81
		return RWsSession::Finish();
sl@0
    82
		}
sl@0
    83
protected:
sl@0
    84
	// Resolves the template parameter to a size. See overload docs for more info.
sl@0
    85
	TInt	DebugInfo(TWsDebugInfoFunc aFunction, TInt aObjectIndex, TDes8& aHostBuffer,const void*&aReturnedObject,TInt aSize)const;
sl@0
    86
	TInt	iScreenNo;
sl@0
    87
	TInt	iSurfaceUpdateSerial;
sl@0
    88
	RBuf8	iSurfaceListBuffer;
sl@0
    89
	};
sl@0
    90
inline TInt RWsDebugSession::ObjIndScr(TInt aScreen,TInt aWin,TInt aLayer,TInt aExtra)
sl@0
    91
	{
sl@0
    92
	return 	(aScreen<<EWsDebugArgScreenShift)
sl@0
    93
		|	(aWin<<EWsDebugArgWindowShift)
sl@0
    94
		|	(aLayer<<EWsDebugArgLayerShift)
sl@0
    95
		|	(aExtra<<EWsDebugArgExtraShift);
sl@0
    96
	}
sl@0
    97
sl@0
    98
#endif /*WSGCEDEBUGSESSION_H_*/