os/graphics/fbs/fontandbitmapserver/sfbs/BackGroundCompression.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.
     1 // Copyright (c) 2005-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 //
    15 
    16 #include "SERVER.H"
    17 
    18 
    19 NONSHARABLE_CLASS(CFbsBackgroundCompressionQueueElement): public CBase
    20 /**
    21 @internalComponent
    22 */
    23 	{
    24 	friend class CFbsBackgroundCompression;
    25 private:
    26 	CFbsBackgroundCompressionQueueElement(CBitmapObject* aSrcObj, TBitmapfileCompressionScheme aScheme);
    27 	~CFbsBackgroundCompressionQueueElement();
    28 	void CompleteOutstandingRequestAndDestroy(TInt aReason);
    29 	void CompleteOutstandingRequest(const CSession2* aSession);
    30 
    31 private:
    32 	TDblQueLink iLink;
    33 	CBitmapObject* iSourceObject;
    34 	TBitmapfileCompressionScheme iCompressionScheme;
    35 	RMessage2 iMessage;
    36 	};
    37 
    38 NONSHARABLE_CLASS(CFbsBackgroundCompression): public CActive
    39 /**
    40 @internalComponent
    41 */
    42 	{
    43 public:
    44 	static CFbsBackgroundCompression* NewL(CFbTop& aFbTop);
    45 	~CFbsBackgroundCompression();
    46 	TInt AddToCompressionQueue(CBitmapObject* aSrcObj, TBitmapfileCompressionScheme aScheme, const RMessage2* aMessage);
    47 	void RemoveFromCompressionQueue(CBitmapObject* aSrcObj);
    48 	void CompleteOutstandingRequests(const CSession2* aSession);
    49 	void CompressAll();
    50 
    51 private:
    52 	CFbsBackgroundCompression(CFbTop& aFbTop);
    53 	void ConstructL();
    54 	TInt PrepareCompression();
    55 	void FinalizeCompression(const TRequestStatus& aStatus);
    56 	void RunL();
    57 	void DoCancel();
    58 	static TInt ThreadFunction(CFbsBackgroundCompression* aSelf);
    59 
    60 private:
    61 	CFbTop& iFbTop;
    62 	RThread iThread;
    63 	TBool iThreadCreated;
    64 	RSemaphore iThreadGo;
    65 	RMutex iThreadMutex;
    66 	TDblQue<CFbsBackgroundCompressionQueueElement> iCompressionQueue;
    67 	CBitmapObject* volatile iBitmapObject;
    68 	volatile TBitmapfileCompressionScheme iCompressionScheme;
    69 	};