| Start/ | End/ | |||
| True | False | - | Line | Source |
| 1 | /* | |||
| 2 | * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). | |||
| 3 | * All rights reserved. | |||
| 4 | * This component and the accompanying materials are made available | |||
| 5 | * under the terms of "Eclipse Public License v1.0" | |||
| 6 | * which accompanies this distribution, and is available | |||
| 7 | * at the URL "http://www.eclipse.org/legal/epl-v10.html". | |||
| 8 | * | |||
| 9 | * Initial Contributors: | |||
| 10 | * Nokia Corporation - initial contribution. | |||
| 11 | * | |||
| 12 | * Contributors: | |||
| 13 | * | |||
| 14 | * Description: mp engine factory. | |||
| 15 | * | |||
| 16 | */ | |||
| 17 | ||||
| 18 | #include "mpengine.h" | |||
| 19 | #include "mpenginefactory.h" | |||
| 20 | #include "mptrace.h" | |||
| 21 | #include "logger.h" | |||
| 22 | ||||
| 23 | /*! | |||
| 24 | \class MpEngineFactory | |||
| 25 | \brief Music Player engine factory. | |||
| 26 | ||||
| 27 | MP Engine factory is responsible to create and mantain ownership of MP engines. | |||
| 28 | */ | |||
| 29 | ||||
| 30 | /*! | |||
| 31 | Constructs music player engine factory. | |||
| 32 | */ | |||
| Top | ||||
| 1 | 1 | 33 | MpEngineFactory::MpEngineFactory() | |
| 34 | : mSharedEngine( 0 ) | |||
| 35 | { | |||
| 36 | TX_ENTRY_ARGS("Stub") | |||
| 37 | } | |||
| 38 | ||||
| 39 | /*! | |||
| 40 | Destructs music player engine factory. | |||
| 41 | */ | |||
| Top | ||||
| 0 | 0 | - | 42 | MpEngineFactory::~MpEngineFactory() |
| 43 | { | |||
| 44 | TX_ENTRY_ARGS("Stub") | |||
| 45 | } | |||
| 46 | ||||
| 47 | /*! | |||
| 48 | Returns the singleton instance of music player engine factory. | |||
| 49 | */ | |||
| Top | ||||
| 4 | 0 | 50 | MpEngineFactory * MpEngineFactory::instance() | |
| 51 | { | |||
| 52 | TRACE("MpEngineFactory::instance() Stub"); | |||
| 52 | while ( 0 ) | |||
| 53 | static MpEngineFactory instance; | |||
| 4 | 54 | return &instance; | ||
| 55 | } | |||
| 56 | ||||
| 57 | /*! | |||
| 58 | Returns an instance to an engine with \a hostUid, and \a mode, if the shared engine is | |||
| 59 | already created parameters are ignored. | |||
| 60 | */ | |||
| Top | ||||
| 0 | 0 | - | 61 | MpEngine *MpEngineFactory::createSharedEngine( TUid hostUid , MpEngine::EngineMode mode ) |
| 62 | { | |||
| 63 | TRACE("MpEngineFactory::instance() createSharedEngine"); | |||
| 63 | while ( 0 ) | |||
| 0 | 0 | - | 64 | if ( !instance()->mSharedEngine ) { |
| 65 | instance()->mSharedEngine = new MpEngine(); | |||
| 66 | } | |||
| 0 | - | 67 | return instance()->mSharedEngine; | |
| 68 | } | |||
| 69 | ||||
| 70 | /*! | |||
| 71 | Returns an instance to the current shared engine previously created with createEngine(). | |||
| 72 | */ | |||
| Top | ||||
| 4 | 0 | 73 | MpEngine *MpEngineFactory::sharedEngine() | |
| 74 | { | |||
| 4 | 75 | return instance()->mSharedEngine; | ||
| 76 | } | |||
| 77 | ||||
| 78 | /*! | |||
| 79 | Closes all engines created on this process. | |||
| 80 | */ | |||
| Top | ||||
| 0 | 0 | - | 81 | void MpEngineFactory::close() |
| 82 | { | |||
| 0 | 0 | - | 83 | if ( instance()->mSharedEngine ) { |
| 84 | delete instance()->mSharedEngine; | |||
| 85 | instance()->mSharedEngine = 0; | |||
| 86 | ||||
| 87 | } | |||
| 88 | } | |||
| ***TER 38% (5/13) of SOURCE FILE mpenginefactory.cpp | ||||