New: wrtbooster basic implementation added

pull/1/head
Antti Kervinen 15 years ago
parent f021bde933
commit 97bd274cf7

@ -31,7 +31,8 @@ char *invoke_recv_str(int fd);
/* FIXME: Should be '/var/run/'. */
//#define INVOKER_SOCK "/tmp/."PACKAGE
#define INVOKER_M_SOCK "/tmp/mlnchr"
#define INVOKER_QT_SOCK "/tmp/qtlnchr"
#define INVOKER_M_SOCK "/tmp/boostm"
#define INVOKER_QT_SOCK "/tmp/boostq"
#define INVOKER_WRT_SOCK "/tmp/boostw"
#endif

@ -53,7 +53,7 @@ static const int DEFAULT_DELAY = 0;
// M_APP: MeeGo Touch application
// QT_APP: Qt/generic application
//
enum APP_TYPE { M_APP, QT_APP, UNKNOWN_APP };
enum APP_TYPE { M_APP, QT_APP, WRT_APP, UNKNOWN_APP };
// Environment
extern char ** environ;
@ -193,6 +193,10 @@ static int invoker_init(enum APP_TYPE app_type)
{
strncpy(sun.sun_path, INVOKER_QT_SOCK, maxSize);
}
else if (app_type == WRT_APP)
{
strncpy(sun.sun_path, INVOKER_WRT_SOCK, maxSize);
}
else
{
die(1, "Unknown type of application: %d\n", app_type);
@ -388,6 +392,7 @@ static void usage(int status)
"Possible values for TYPE: \n"
" m Launch a MeeGo Touch application.\n"
" qt Launch a Qt application.\n\n"
" wrt Launch a web runtime application.\n\n"
"Options:\n"
" -c, --creds Print Aegis security credentials (if enabled).\n"
" -d, --delay SECS After invoking sleep for SECS seconds (default %d).\n"
@ -526,10 +531,12 @@ int main(int argc, char *argv[])
break;
case 't':
if (strcmp(optarg, "qt") == 0)
app_type = QT_APP;
else if (strcmp(optarg, "m") == 0)
if (strcmp(optarg, "m") == 0)
app_type = M_APP;
else if (strcmp(optarg, "q") == 0 || strcmp(optarg, "qt") == 0)
app_type = QT_APP;
else if (strcmp(optarg, "w") == 0 || strcmp(optarg, "wrt") == 0)
app_type = WRT_APP;
else
{
report(report_error, "Unknown application type: %s \n", optarg);

@ -18,7 +18,7 @@ else (EXISTS ${M_COMPONENT_CACHE})
endif (EXISTS ${M_COMPONENT_CACHE})
# Set sources
set(SRC appdata.cpp booster.cpp connection.cpp daemon.cpp mbooster.cpp logger.cpp main.cpp qtbooster.cpp)
set(SRC appdata.cpp booster.cpp connection.cpp daemon.cpp mbooster.cpp logger.cpp main.cpp qtbooster.cpp wrtbooster.cpp)
# Find libdl
find_library(LIBDL NAMES dl)

@ -23,6 +23,7 @@
#include "booster.h"
#include "mbooster.h"
#include "qtbooster.h"
#include "wrtbooster.h"
#include <cstdlib>
#include <cerrno>
@ -136,9 +137,11 @@ void Daemon::run()
// create sockets for each of the boosters
Connection::initSocket(MBooster::socketName());
Connection::initSocket(QtBooster::socketName());
Connection::initSocket(WRTBooster::socketName());
forkBooster(MBooster::type());
forkBooster(QtBooster::type());
forkBooster(WRTBooster::type());
while (true)
{
@ -219,6 +222,10 @@ bool Daemon::forkBooster(char type, int sleepTime)
{
booster = new QtBooster();
}
else if (WRTBooster::type() == type)
{
booster = new WRTBooster();
}
else
{
Logger::logErrorAndDie(EXIT_FAILURE, "Daemon: Unknown booster type \n");
@ -289,6 +296,10 @@ bool Daemon::forkBooster(char type, int sleepTime)
{
QtBooster::setProcessId(newPid);
}
else if (WRTBooster::type() == type)
{
WRTBooster::setProcessId(newPid);
}
}
return true;
@ -321,6 +332,10 @@ void Daemon::reapZombies()
{
forkBooster(QtBooster::type(), m_boosterSleepTime);
}
else if (pid == WRTBooster::ProcessId())
{
forkBooster(WRTBooster::type(), m_boosterSleepTime);
}
}
else
{

@ -24,7 +24,7 @@
#include <mcomponentcache.h>
#endif
const string MBooster::m_socketId = "/tmp/mlnchr";
const string MBooster::m_socketId = "/tmp/boostm";
int MBooster::m_ProcessID = 0;
MBooster::MBooster()

@ -19,7 +19,7 @@
#include "qtbooster.h"
const string QtBooster::m_socketId = "/tmp/qtlnchr";
const string QtBooster::m_socketId = "/tmp/boostq";
int QtBooster::m_ProcessID = 0;
QtBooster::QtBooster()

@ -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

@ -1,7 +1,7 @@
set(LAUNCHER ${CMAKE_HOME_DIRECTORY}/src/launcher)
# Set sources
set(SRC ut_connection.cpp ${LAUNCHER}/appdata.cpp ${LAUNCHER}/booster.cpp ${LAUNCHER}/daemon.cpp ${LAUNCHER}/connection.cpp ${LAUNCHER}/logger.cpp ${LAUNCHER}/mbooster.cpp ${LAUNCHER}/qtbooster.cpp)
set(SRC ut_connection.cpp ${LAUNCHER}/appdata.cpp ${LAUNCHER}/booster.cpp ${LAUNCHER}/daemon.cpp ${LAUNCHER}/connection.cpp ${LAUNCHER}/logger.cpp ${LAUNCHER}/mbooster.cpp ${LAUNCHER}/qtbooster.cpp ${LAUNCHER}/wrtbooster.cpp)
# Set moc headers
set(MOC_HDRS ut_connection.h)

@ -1,6 +1,6 @@
# Set sources
set(LAUNCHER ${CMAKE_HOME_DIRECTORY}/src/launcher)
set(SRC ut_daemon.cpp ${LAUNCHER}/appdata.cpp ${LAUNCHER}/booster.cpp ${LAUNCHER}/daemon.cpp ${LAUNCHER}/connection.cpp ${LAUNCHER}/logger.cpp ${LAUNCHER}/mbooster.cpp ${LAUNCHER}/qtbooster.cpp)
set(SRC ut_daemon.cpp ${LAUNCHER}/appdata.cpp ${LAUNCHER}/booster.cpp ${LAUNCHER}/daemon.cpp ${LAUNCHER}/connection.cpp ${LAUNCHER}/logger.cpp ${LAUNCHER}/mbooster.cpp ${LAUNCHER}/qtbooster.cpp ${LAUNCHER}/wrtbooster.cpp)
# Set moc headers
set(MOC_HDRS ut_daemon.h)

Loading…
Cancel
Save