os/graphics/graphicstest/uibench/src/tgcesuiteserver.cpp
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) 2008-2010 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 /**
    17  @file
    18  @test
    19  @internalComponent - Internal Symbian test code 
    20 */
    21 
    22 #include "tgcesuiteserver.h"
    23 #include "tgraphicsresource.h"
    24 #include "tbitbltperf_directgdi.h"
    25 #include "tsimpledrawing_directgdi.h"
    26 #include "tdirectgdiperf.h"
    27 #include "teventhandlingperf.h"
    28 #include "tflipframerate.h"
    29 #include "trenderorientation.h"
    30 
    31 /**
    32 Same code for Secure and non-secure variants
    33 Called inside the MainL() function to create and start the
    34 CTestServer derived server.
    35 
    36 @return - Instance of the test server
    37 */
    38 CGceSuiteServer* CGceSuiteServer::NewL()
    39 	{
    40 	CGceSuiteServer * server = new (ELeave) CGceSuiteServer();
    41 	CleanupStack::PushL(server);
    42 
    43 	// Get server name from process so we can use SetCap to change the capabilites and use this server with a different filename
    44 	RProcess handle = RProcess();
    45 	TParsePtrC serverName(handle.FileName());
    46 
    47 	server->ConstructL(serverName.Name());
    48 	CleanupStack::Pop(server);
    49 	return server;
    50 	}
    51 
    52 
    53 /**
    54 MainL - uses the new Rendezvous() call to sync with the client
    55 */
    56 LOCAL_C void MainL()
    57 	{
    58 	// Active scheduler only for this thread. Test need to create own active scheduler	
    59 	CActiveScheduler* scheduler = new(ELeave) CActiveScheduler;
    60 	CActiveScheduler::Install(scheduler);
    61 
    62 	CGceSuiteServer* server = NULL;
    63 
    64 	// Create the CTestServer derived server
    65 	TRAPD(err,server = CGceSuiteServer::NewL());
    66 	if(!err)
    67 		{
    68 		// Sync with the client and enter the active scheduler
    69 		RProcess::Rendezvous(KErrNone);
    70 		scheduler->Start();
    71 		}
    72 	delete server;
    73 	delete scheduler;
    74 	}
    75 
    76 
    77 /**
    78 Secure variant only
    79 Process entry point. Called by client using RProcess API
    80 
    81 @return - Standard Epoc error code on process exit
    82 */
    83 GLDEF_C TInt E32Main()
    84 	{
    85 	__UHEAP_MARK;
    86 	CTrapCleanup* cleanup = CTrapCleanup::New();
    87 	if(cleanup == NULL)
    88 		{
    89 		return KErrNoMemory;
    90 		}
    91 	TRAPD(err,MainL());
    92 	delete cleanup;
    93 	__UHEAP_MARKEND;
    94 	return err;
    95     }
    96 
    97 /**
    98 Secure and non-secure variants
    99 Implementation of CTestServer pure virtual
   100 
   101 @return - A CTestStep derived instance
   102 */
   103 CTestStep* CGceSuiteServer::CreateTestStep(const TDesC& aStepName)
   104 	{
   105 	CTestStep* testStep = NULL;
   106 	
   107 	if(aStepName == KTGraphicsResource)
   108 		testStep = new CTGraphicsResource();
   109 	else if(aStepName == KTBitBltPerfDirectGdi)
   110 		testStep = new CTBitBltPerfDirectGdi();
   111 	else if(aStepName == KTDirectGdiPerfTest)
   112 		testStep = new CTDirectGdiPerf();
   113 	else if(aStepName == KTSimpleDrawingPerfDirectGdi)
   114 		testStep = new CTSimpleDrawingDirectGdi();
   115 	else if(aStepName == KEventHandlingPerfName)
   116 		testStep = new CTEventHandlingPerf();
   117 	else if(aStepName == KTFlipFramerate)
   118 	    testStep = new CTFlipFramerate();
   119 	else if(aStepName == KTRenderOrientation)
   120 	    testStep = new CTRenderOrientation;
   121 	
   122 	return testStep;
   123 	}