Changes: Temporary booster process name defined and initialized in

booster classes as a static variable. Getters added.

RevBy: Antti Kervinen

Details: Temporary booster process name was previously generated from
the type char at the time process was renamed. This made it impossible
to use the temporary process name from other classes.
pull/1/head
Jussi Lind 15 years ago
parent 4f8880ac0f
commit 933faa51ad

@ -122,11 +122,7 @@ void Booster::renameProcess(int parentArgc, char** parentArgv)
{
// application name isn't known yet, let's give to the process
// temporary booster name
string newProcessName("booster-");
newProcessName.append(1, boosterType());
m_app.setAppName(newProcessName);
m_app.setAppName(boosterTemporaryProcessName());
}
const char* newProcessName = m_app.appName().c_str();

@ -98,6 +98,12 @@ public:
*/
virtual char boosterType() const = 0;
/*! Return the process name to be used when booster is not
* yet transformed into a running application (e.g. "booster-m"
* for MBooster)
*/
virtual const string & boosterTemporaryProcessName() const = 0;
//! Set nice value and store the old priority. Return true on success.
bool pushPriority(int nice);

@ -219,8 +219,8 @@ void Daemon::forkKiller()
BoosterKiller bk;
bk.addKey("/meegotouch/theme/name");
bk.addKey("/meegotouch/i18n/language");
bk.addProcessName("booster-m");
bk.addProcessName("booster-w");
bk.addProcessName(MBooster::temporaryProcessName().c_str());
bk.addProcessName(WRTBooster::temporaryProcessName().c_str());
bk.start(); // does not return.
}
}

@ -25,16 +25,9 @@
#endif
const string MBooster::m_socketId = "/tmp/boostm";
const string MBooster::m_temporaryProcessName = "booster-m";
int MBooster::m_ProcessID = 0;
MBooster::MBooster()
{
}
MBooster::~MBooster()
{
}
const string & MBooster::socketId() const
{
return m_socketId;
@ -53,6 +46,16 @@ const string & MBooster::socketName()
return m_socketId;
}
const string & MBooster::temporaryProcessName()
{
return m_temporaryProcessName;
}
const string & MBooster::boosterTemporaryProcessName() const
{
return temporaryProcessName();
}
char MBooster::type()
{
return 'm';

@ -36,10 +36,10 @@ class MBooster : public Booster
public:
//! \brief Constructor
MBooster();
MBooster() {};
//! \brief Destructor
virtual ~MBooster();
virtual ~MBooster() {};
//! \reimp
virtual bool preload();
@ -50,6 +50,13 @@ public:
*/
static const string & socketName();
//! Return the process name to be used when booster is not
//! yet transformed into a running application
static const string & temporaryProcessName();
//! \reimp
virtual const string & boosterTemporaryProcessName() const;
//! \reimp
virtual char boosterType() const { return type(); }
@ -86,6 +93,10 @@ private:
static int m_ProcessID;
//! Process name to be used when booster is not
//! yet transformed into a running application
static const string m_temporaryProcessName;
#ifdef UNIT_TEST
friend class Ut_MBooster;
#endif

@ -20,24 +20,27 @@
#include "qtbooster.h"
const string QtBooster::m_socketId = "/tmp/boostq";
const string QtBooster::m_temporaryProcessName = "booster-q";
int QtBooster::m_ProcessID = 0;
QtBooster::QtBooster()
const string & QtBooster::socketId() const
{
return m_socketId;
}
QtBooster::~QtBooster()
const string & QtBooster::socketName()
{
return m_socketId;
}
const string & QtBooster::socketId() const
const string & QtBooster::temporaryProcessName()
{
return m_socketId;
return m_temporaryProcessName;
}
const string & QtBooster::socketName()
const string & QtBooster::boosterTemporaryProcessName() const
{
return m_socketId;
return temporaryProcessName();
}
char QtBooster::type()

@ -31,10 +31,10 @@ class QtBooster : public Booster
public:
//! Constructor.
QtBooster();
QtBooster() {};
//! Destructor.
virtual ~QtBooster();
virtual ~QtBooster() {};
/*!
* \brief Return the socket name common to all QtBooster objects.
@ -42,6 +42,13 @@ public:
*/
static const string & socketName();
//! Return the process name to be used when booster is not
//! yet transformed into a running application
static const string & temporaryProcessName();
//! \reimp
virtual const string & boosterTemporaryProcessName() const;
//! \reimp
virtual char boosterType() const { return type(); }
@ -81,6 +88,9 @@ private:
static int m_ProcessID;
//! Process name to be used when booster is not
//! yet transformed into a running application
static const string m_temporaryProcessName;
#ifdef UNIT_TEST
friend class Ut_QtBooster;

@ -25,16 +25,9 @@
#endif
const string WRTBooster::m_socketId = "/tmp/boostw";
const string WRTBooster::m_temporaryProcessName = "booster-w";
int WRTBooster::m_ProcessID = 0;
WRTBooster::WRTBooster()
{
}
WRTBooster::~WRTBooster()
{
}
const string & WRTBooster::socketId() const
{
return m_socketId;
@ -53,6 +46,16 @@ const string & WRTBooster::socketName()
return m_socketId;
}
const string & WRTBooster::temporaryProcessName()
{
return m_temporaryProcessName;
}
const string & WRTBooster::boosterTemporaryProcessName() const
{
return temporaryProcessName();
}
char WRTBooster::type()
{
return 'w';

@ -35,10 +35,10 @@ class WRTBooster : public Booster
public:
//! \brief Constructor
WRTBooster();
WRTBooster() {};
//! \brief Destructor
virtual ~WRTBooster();
virtual ~WRTBooster() {};
//! \reimp
virtual bool preload();
@ -49,6 +49,13 @@ public:
*/
static const string & socketName();
//! Return the process name to be used when booster is not
//! yet transformed into a running application
static const string & temporaryProcessName();
//! \reimp
virtual const string & boosterTemporaryProcessName() const;
//! \reimp
virtual char boosterType() const { return type(); }
@ -85,6 +92,10 @@ private:
static int m_ProcessID;
//! Process name to be used when booster is not
//! yet transformed into a running application
static const string m_temporaryProcessName;
#ifdef UNIT_TEST
friend class Ut_WRTBooster;
#endif

@ -20,25 +20,34 @@
#include "ut_booster.h"
#include "booster.h"
// Booster is an abstract base-class, so let's inherit it
// Booster is an abstract base-class, so let's inherit it and
// define methods that are pure virtual
class MyBooster : public Booster
{
public:
MyBooster();
char boosterType() const;
const std::string & socketId() const;
const std::string & boosterTemporaryProcessName() const;
private:
const string m_socketId;
const string m_temporaryProcessName;
};
MyBooster::MyBooster() :
m_socketId("/tmp/MyBooster")
m_socketId("/tmp/MyBooster"),
m_temporaryProcessName("x-booster")
{}
char MyBooster::boosterType() const
{
return 'm';
return 'x';
}
const std::string & MyBooster::boosterTemporaryProcessName() const
{
return m_temporaryProcessName;
}
const std::string & MyBooster::socketId() const
@ -46,12 +55,6 @@ const std::string & MyBooster::socketId() const
return m_socketId;
}
Ut_Booster::Ut_Booster()
{}
Ut_Booster::~Ut_Booster()
{}
void Ut_Booster::initTestCase()
{}
@ -87,7 +90,7 @@ void Ut_Booster::testRenameBoosterProcess()
m_subject->renameProcess(INIT_ARGS, const_cast<char **>(initialArgv));
// New name and arguments fit and are correct
QVERIFY(strcmp(initialArgv[0], "booster-m") == 0);
QVERIFY(strcmp(initialArgv[0], m_subject->boosterTemporaryProcessName().c_str()) == 0);
// Define and copy args because it's assumed that they are allocated in the heap
// (AppData deletes the argv on exit)

@ -33,10 +33,6 @@ class Ut_Booster : public QObject
{
Q_OBJECT
public:
Ut_Booster();
virtual ~Ut_Booster();
private Q_SLOTS:
void initTestCase();
void testRenameProcess();

Loading…
Cancel
Save