os/graphics/windowing/windowserverplugins/openwfc/src/openwfcjob.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 // Copyright (c) 1995-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 "openwfcjob.h"
    17 #include "openwfcjobmanager.h"
    18 
    19 TOpenWfcJob::TOpenWfcJob(COpenWfcJobManger& aJobManager):
    20 iJobManager(aJobManager),
    21 iJobId(EInvalidJobId), 
    22 iCallingThread(KNullThreadId),
    23 iCompleteRequest(NULL)
    24 	{
    25 	
    26 	}
    27 
    28 void TOpenWfcJob::Set(EOpenWfcJobId aJob,
    29 		              TThreadId aThreadId,
    30 		              TRequestStatus* aRequest)
    31 	{
    32 	iJobId = aJob; 
    33 	iCallingThread = aThreadId;
    34 	iCompleteRequest =aRequest;
    35     JQLOG(("** TOpenWfcJob::Sett() : iCompleteRequest(0x%x) iJobId(%d)", aRequest, aJob));
    36 	}
    37 
    38 
    39 void TOpenWfcJob::Reset()
    40 	{
    41 	iJobId = EInvalidJobId; 
    42 	iCallingThread = KNullThreadId;
    43 	iCompleteRequest =NULL;
    44 	}
    45 
    46 TOpenWfcJob::~TOpenWfcJob()
    47 	{
    48 	}
    49 
    50 
    51 void TOpenWfcJob::Run()
    52 	{
    53 	switch (iJobId)
    54 		{
    55 		case EComposeJobId:
    56             JQLOG(("** LAUNCH * TOpenWfcJob::Run EComposeJobId"));
    57 			iJobManager.DoComposeJob(*this);
    58 			break;
    59 		case EPauseCompositionJobId:
    60             JQLOG(("** LAUNCH * TOpenWfcJob::Run EPauseCompositionJobId"));
    61 			iJobManager.DoPauseCompositionJob(*this);
    62 			break;
    63 		case EResumeCompositionJobId:
    64             JQLOG(("** LAUNCH * TOpenWfcJob::Run EResumeCompositionJobId"));
    65 			iJobManager.DoResumeCompositionJob(*this);
    66 			break;
    67 		default:
    68 		    JQLOG(("** ERROR * TOpenWfcJob::Run jobId(%d)", iJobId));
    69 			break;
    70 		}
    71 	}
    72 
    73 void TOpenWfcJob::CompleteRequest(TInt aResult)
    74     {
    75     if (iCompleteRequest)
    76         {
    77         RThread thread;
    78         
    79         if (thread.Open(iCallingThread) == KErrNone)
    80             {
    81             JQLOG(("** TOpenWfcJob::CompleteRequest(): CompleteReq(0x%x))", iCompleteRequest));
    82             thread.RequestComplete(iCompleteRequest, aResult);
    83             thread.Close();
    84             }
    85         }
    86     }