mirror of https://github.com/cutefishos/appmotor
				
				
				
			New: wrtbooster basic implementation added
							parent
							
								
									f021bde933
								
							
						
					
					
						commit
						97bd274cf7
					
				@ -0,0 +1,70 @@
 | 
			
		||||
/***************************************************************************
 | 
			
		||||
**
 | 
			
		||||
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
 | 
			
		||||
** All rights reserved.
 | 
			
		||||
** Contact: Nokia Corporation (directui@nokia.com)
 | 
			
		||||
**
 | 
			
		||||
** This file is part of applauncherd
 | 
			
		||||
**
 | 
			
		||||
** If you have questions regarding the use of this file, please contact
 | 
			
		||||
** Nokia at directui@nokia.com.
 | 
			
		||||
**
 | 
			
		||||
** This library is free software; you can redistribute it and/or
 | 
			
		||||
** modify it under the terms of the GNU Lesser General Public
 | 
			
		||||
** License version 2.1 as published by the Free Software Foundation
 | 
			
		||||
** and appearing in the file LICENSE.LGPL included in the packaging
 | 
			
		||||
** of this file.
 | 
			
		||||
**
 | 
			
		||||
****************************************************************************/
 | 
			
		||||
 | 
			
		||||
#include "wrtbooster.h"
 | 
			
		||||
#include "logger.h"
 | 
			
		||||
 | 
			
		||||
#ifdef HAVE_MCOMPONENTCACHE
 | 
			
		||||
#include <mcomponentcache.h>
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
const string WRTBooster::m_socketId  = "/tmp/boostw";
 | 
			
		||||
int WRTBooster::m_ProcessID = 0;
 | 
			
		||||
 | 
			
		||||
WRTBooster::WRTBooster()
 | 
			
		||||
{
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
WRTBooster::~WRTBooster()
 | 
			
		||||
{
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const string & WRTBooster::socketId() const
 | 
			
		||||
{
 | 
			
		||||
    return m_socketId;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool WRTBooster::preload()
 | 
			
		||||
{
 | 
			
		||||
#ifdef HAVE_MCOMPONENTCACHE
 | 
			
		||||
    MComponentCache::populateForWRTApplication();
 | 
			
		||||
#endif
 | 
			
		||||
    return true;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const string & WRTBooster::socketName()
 | 
			
		||||
{
 | 
			
		||||
    return m_socketId;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
char WRTBooster::type()
 | 
			
		||||
{
 | 
			
		||||
    return 'w';
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void WRTBooster::setProcessId(int pid)
 | 
			
		||||
{
 | 
			
		||||
    m_ProcessID = pid;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
int WRTBooster::ProcessId()
 | 
			
		||||
{
 | 
			
		||||
    return m_ProcessID;
 | 
			
		||||
}
 | 
			
		||||
@ -0,0 +1,93 @@
 | 
			
		||||
/***************************************************************************
 | 
			
		||||
**
 | 
			
		||||
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
 | 
			
		||||
** All rights reserved.
 | 
			
		||||
** Contact: Nokia Corporation (directui@nokia.com)
 | 
			
		||||
**
 | 
			
		||||
** This file is part of applauncherd
 | 
			
		||||
**
 | 
			
		||||
** If you have questions regarding the use of this file, please contact
 | 
			
		||||
** Nokia at directui@nokia.com.
 | 
			
		||||
**
 | 
			
		||||
** This library is free software; you can redistribute it and/or
 | 
			
		||||
** modify it under the terms of the GNU Lesser General Public
 | 
			
		||||
** License version 2.1 as published by the Free Software Foundation
 | 
			
		||||
** and appearing in the file LICENSE.LGPL included in the packaging
 | 
			
		||||
** of this file.
 | 
			
		||||
**
 | 
			
		||||
****************************************************************************/
 | 
			
		||||
 | 
			
		||||
#ifndef WRTBOOSTER_H
 | 
			
		||||
#define WRTBOOSTER_H
 | 
			
		||||
 | 
			
		||||
#include "booster.h"
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
    \class WRTBooster
 | 
			
		||||
    \brief Booster for web runtime applications running on top of MeeGo Touch.
 | 
			
		||||
 | 
			
		||||
    WRTBooster effectively fills MComponentCache with fresh objects
 | 
			
		||||
    similarly to MBooster. However, the cache content is optimized for
 | 
			
		||||
    web runtime's use.
 | 
			
		||||
 */
 | 
			
		||||
class WRTBooster : public Booster
 | 
			
		||||
{
 | 
			
		||||
public:
 | 
			
		||||
 | 
			
		||||
    //! \brief Constructor
 | 
			
		||||
    WRTBooster();
 | 
			
		||||
 | 
			
		||||
    //! \brief Destructor
 | 
			
		||||
    virtual ~WRTBooster();
 | 
			
		||||
 | 
			
		||||
    //! \reimp
 | 
			
		||||
    virtual bool preload();
 | 
			
		||||
 | 
			
		||||
    /*!
 | 
			
		||||
     * \brief Return the socket name common to all WRTBooster objects.
 | 
			
		||||
     * \return Path to the socket file.
 | 
			
		||||
     */
 | 
			
		||||
    static const string & socketName();
 | 
			
		||||
 | 
			
		||||
    //! \reimp
 | 
			
		||||
    virtual char boosterType() const { return type(); }
 | 
			
		||||
 | 
			
		||||
    /*!
 | 
			
		||||
     * \brief Return a unique character ('d') represtenting the type of WRTBoosters.
 | 
			
		||||
     * \return Type character.
 | 
			
		||||
     */
 | 
			
		||||
    static char type();
 | 
			
		||||
 | 
			
		||||
    /*!
 | 
			
		||||
     * \brief Keep booster pid, should be reset before booster run application's main() function
 | 
			
		||||
     */
 | 
			
		||||
    static void setProcessId(int pid);
 | 
			
		||||
 | 
			
		||||
    /*!
 | 
			
		||||
     * \brief Return booster pid
 | 
			
		||||
     */
 | 
			
		||||
    static int  ProcessId();
 | 
			
		||||
 | 
			
		||||
protected:
 | 
			
		||||
 | 
			
		||||
    //! \reimp
 | 
			
		||||
    virtual const string & socketId() const;
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
 | 
			
		||||
    //! Disable copy-constructor
 | 
			
		||||
    WRTBooster(const WRTBooster & r);
 | 
			
		||||
 | 
			
		||||
    //! Disable assignment operator
 | 
			
		||||
    WRTBooster & operator= (const WRTBooster & r);
 | 
			
		||||
 | 
			
		||||
    static const string m_socketId;
 | 
			
		||||
 | 
			
		||||
    static int m_ProcessID;
 | 
			
		||||
 | 
			
		||||
#ifdef UNIT_TEST
 | 
			
		||||
    friend class Ut_WRTBooster;
 | 
			
		||||
#endif
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#endif // WRTBOOSTER_H
 | 
			
		||||
					Loading…
					
					
				
		Reference in New Issue