Update contrib.
1 // Copyright (c) 2006-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.
19 @internalComponent - Internal Symbian test code
23 #if !defined(__TCOMPOSITIONBACKEND_H__)
24 #define __TCOMPOSITIONBACKEND_H__
27 #include <graphics/surface.h>
28 #include <graphics/compositionsurfaceupdate.h>
29 #include <graphics/extensioncontainer.h>
30 #include "trequestorder.h"
33 The following constants signify the delay in microseconds between two
34 emulations of composition. During the emulation mock receiver will
35 process a number of outstanding requests and issues the signal
36 back to the SUS. Content update receiver with highest priority will process the
37 requests at highest rate.
39 const TInt KCompositionInterval = 1000000 / 20; // for composition threads with normal priority
40 const TInt KCompositionIntervalLong = KCompositionInterval * 2; // for composition threads with lower priority
41 const TInt KCompositionIntervalShort = KCompositionInterval / 2; // for composition threads with higher priority
55 TRequestStatus* iStatus;
57 TInt iDisplayedXTimes;
60 NONSHARABLE_CLASS(CTContentUpdateReceiver) :
61 public CExtensionContainer,
62 public MCompositionSurfaceUpdate
65 static CTContentUpdateReceiver* NewL(TInt aScreen);
66 ~CTContentUpdateReceiver();
67 static TInt ThreadFunction(TAny* aAny);
68 TInt Screen() {return iScreen;}
70 void SetCompositionOrder(CRequestOrder* aOrder) { iCompositionOrder = aOrder;}
71 IMPORT_C void SetVisible(TBool aVisible);
72 IMPORT_C TInt SetInternalPriority(TThreadPriority aInternalPriority);
73 inline TBool OutstandingRequest(); //returns ETrue if there are any oustanding requests need to be processed by the mock receiver
76 Mark the surface as dirty and request for composition.
77 The function doesn't take onwership of aRegion
79 virtual void ContentUpdated(const TSurfaceId& aSurface,
81 const TRegion* aRegion,
82 TRequestStatus* aStatusAvailable,
83 TRequestStatus* aStatusDisplayed,
85 TRequestStatus* aStatusDispXTimes,
86 TInt* aDisplayedXTimes);
88 virtual void Delete(void){}
89 virtual TInt ApiVersion(void) {return 0;}
90 virtual TVersion InternalVersion(void){return TVersion();}
91 protected: //From CBase
92 virtual TInt Extension_(TUint aExtensionId, TAny*& a0, TAny* a1);
94 CTContentUpdateReceiver(TInt aScreen);
96 TInt CheckNewNotifications();
97 void DoSetInternalPriorityL();
98 static TInt CallBack(TAny *aAny);
99 TInt Add(TRequestStatus *aStatus, RequestType aType,
100 TInt aDisplayedXTimes = 1, TUint32* aTimeStamp = NULL);
101 void Remove(TInt aIndex);
103 TThreadId iThreadId; //thread from which ContentUpdated is called
104 TThreadId iReceiverThreadId;
107 CPeriodic* iPeriodic;
108 RequestObject iArray[1024]; //should be big enough
109 TInt iNumberElements;
111 TBool iSetInternalPriority;
112 TThreadPriority iInternalPriority;
113 CRequestOrder* iCompositionOrder;
115 RSemaphore iPriorityLock;
118 IMPORT_C TInt StartTestUpdateReceiver(CTContentUpdateReceiver*& aReceiver, TInt aScreen);
119 IMPORT_C void CloseTestUpdateReceiver(CTContentUpdateReceiver* aReceiver);
123 inline TBool CTContentUpdateReceiver::OutstandingRequest()
124 { return iNumberElements > 0;}
127 #endif // __TCOMPOSITIONBACKEND_H__