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