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