1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/graphics/graphicscomposition/surfaceupdate/tsrc/trequestorder.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,114 @@
1.4 +// Copyright (c) 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 +/**
1.20 + @file
1.21 + @test
1.22 + @internalComponent - Internal Symbian test code
1.23 +*/
1.24 +
1.25 +#include "trequestorder.h"
1.26 +
1.27 +CRequestOrder::CRequestOrder(TInt aNumberAsynchronousRequests) :
1.28 + iNumberAsynchronousRequests(aNumberAsynchronousRequests)
1.29 + {
1.30 + }
1.31 +
1.32 +CRequestOrder::~CRequestOrder()
1.33 + {
1.34 + delete iOrderArray;
1.35 + iLock.Close();
1.36 + }
1.37 +
1.38 +void CRequestOrder::ConstructL()
1.39 + {
1.40 + User::LeaveIfError(iLock.CreateLocal());
1.41 +
1.42 + iOrderArray = new (ELeave) TOrderArray[iNumberAsynchronousRequests];
1.43 + User::LeaveIfNull(iOrderArray);
1.44 +
1.45 + ResetAll();
1.46 + }
1.47 +
1.48 +CRequestOrder* CRequestOrder::NewL(const TInt aNumberAsynchronousRequests)
1.49 + {
1.50 + CRequestOrder* requestOrder = new (ELeave) CRequestOrder(aNumberAsynchronousRequests);
1.51 + CleanupStack::PushL(requestOrder);
1.52 + requestOrder->ConstructL();
1.53 + CleanupStack::Pop();
1.54 + return requestOrder;
1.55 + }
1.56 +
1.57 +
1.58 +void CRequestOrder::ResetAll()
1.59 + {
1.60 + iIndex=0;
1.61 + iOrderIndexBefore=0;
1.62 + iOrderIndexComposition=0;
1.63 + iOrderIndexAfter=0;
1.64 +
1.65 + for(TInt i=0; i<iNumberAsynchronousRequests;i++)
1.66 + {
1.67 + iOrderArray[i].iType = EOrderErr;
1.68 + iOrderArray[i].iNumber = 0;
1.69 + }
1.70 + }
1.71 +
1.72 +TInt CRequestOrder::GetIndex()
1.73 + {
1.74 + return iIndex;
1.75 + }
1.76 +
1.77 +void CRequestOrder::SetOrder(TOrderType aOrderType)
1.78 + {
1.79 + iLock.Wait();
1.80 + iOrderArray[iIndex].iType = aOrderType;
1.81 + switch (aOrderType)
1.82 + {
1.83 + case EOrderBefore:
1.84 + {
1.85 + iOrderArray[iIndex].iNumber = iOrderIndexBefore++;
1.86 + break;
1.87 + }
1.88 + case EOrderComposition:
1.89 + {
1.90 + iOrderArray[iIndex].iNumber = iOrderIndexComposition++;
1.91 + break;
1.92 + }
1.93 + case EOrderAfter:
1.94 + {
1.95 + iOrderArray[iIndex].iNumber = iOrderIndexAfter++;
1.96 + break;
1.97 + }
1.98 + default:
1.99 + {
1.100 + _LIT(KMsg, "GRAPHICS-SURFACEUPDATE-0003");
1.101 + User::Panic(KMsg, 1);
1.102 + break;
1.103 + }
1.104 + }
1.105 + iIndex++;
1.106 + iLock.Signal();
1.107 + }
1.108 +
1.109 +TOrderType CRequestOrder::GetOrderType(TInt aIndex)
1.110 + {
1.111 + return iOrderArray[aIndex].iType;
1.112 + }
1.113 +
1.114 +TInt CRequestOrder::GetOrderNumber(TInt aIndex)
1.115 + {
1.116 + return iOrderArray[aIndex].iNumber;
1.117 + }