aboutsummaryrefslogtreecommitdiff
path: root/mthemedaemon
diff options
context:
space:
mode:
authorTomas Junnonen <tomas.junnonen@nokia.com>2010-10-12 09:29:38 +0300
committerTomas Junnonen <tomas.junnonen@nokia.com>2010-10-21 11:25:43 +0300
commit5c66c393d2de347084eea3a7abf1ac945ee4a028 (patch)
tree92116fff0715cb2d1d79288f9b09c7870e1a46cf /mthemedaemon
parentf88a30be96ead0f887e14e181303c6b1cfe1ece9 (diff)
Changes: Added option to slow down the processing of pixmaps in the theme daemon
RevBy: Armin Berres Details: Helps to debug the asynchronous image loading
Diffstat (limited to 'mthemedaemon')
-rw-r--r--mthemedaemon/main.cpp12
-rw-r--r--mthemedaemon/mthemedaemonserver.cpp8
-rw-r--r--mthemedaemon/mthemedaemonserver.h2
3 files changed, 21 insertions, 1 deletions
diff --git a/mthemedaemon/main.cpp b/mthemedaemon/main.cpp
index d2d55fdc..8705b0f5 100644
--- a/mthemedaemon/main.cpp
+++ b/mthemedaemon/main.cpp
@@ -51,7 +51,7 @@ int main(int argc, char **argv)
// Apply custom server address, if the "-address" has been passed as argument
QString serverAddress;
- const int index = app.arguments().indexOf("-address");
+ int index = app.arguments().indexOf("-address");
if ((index >= 0) && (index + 1 < app.arguments().count())) {
serverAddress = app.arguments().at(index + 1);
}
@@ -69,5 +69,15 @@ int main(int argc, char **argv)
QTimer::singleShot(0, &app, SLOT(quit()));
}
+ index = app.arguments().indexOf("-slowdown");
+ if ((index >= 0) && (index + 1 < app.arguments().count())) {
+ bool conversionOk;
+ int slowDown = app.arguments().at(index + 1).toInt(&conversionOk);
+ if (conversionOk) {
+ server.setSlowDown(slowDown);
+ qDebug() << "Slowing down theme asset requests by" << slowDown << "microseconds";
+ }
+ }
+
return app.exec();
}
diff --git a/mthemedaemon/mthemedaemonserver.cpp b/mthemedaemon/mthemedaemonserver.cpp
index affe1645..9b551d68 100644
--- a/mthemedaemon/mthemedaemonserver.cpp
+++ b/mthemedaemon/mthemedaemonserver.cpp
@@ -37,6 +37,7 @@ MThemeDaemonServer::MThemeDaemonServer(const QString &serverAddress) :
currentLocale("/meegotouch/i18n/language"),
defaultTheme(M_THEME_DEFAULT),
delayedThemeChange(false),
+ slowDown(false),
sequenceCounter(0)
{
QString filename = M_INSTALL_SYSCONFDIR "/meegotouch/themedaemonpriorities.conf";
@@ -279,6 +280,11 @@ void MThemeDaemonServer::clientDataAvailable()
}
}
+void MThemeDaemonServer::setSlowDown(int slowDown)
+{
+ this->slowDown = slowDown;
+}
+
void MThemeDaemonServer::themeChanged(bool forceReload)
{
if (!forceReload && daemon.currentTheme() == currentTheme.value().toString())
@@ -389,6 +395,8 @@ void MThemeDaemonServer::processOneQueueItem()
Qt::HANDLE handle = 0;
if (daemon.pixmap(item.client, item.pixmapId, handle)) {
+ if (slowDown > 0)
+ usleep(slowDown);
item.client->stream() << Packet(Packet::PixmapUpdatedPacket, item.sequenceNumber,
new PixmapHandle(item.pixmapId, handle));
} else {
diff --git a/mthemedaemon/mthemedaemonserver.h b/mthemedaemon/mthemedaemonserver.h
index 820f559c..36b10304 100644
--- a/mthemedaemon/mthemedaemonserver.h
+++ b/mthemedaemon/mthemedaemonserver.h
@@ -48,6 +48,7 @@ public:
public slots:
void themeChanged(bool forceReload = false);
+ void setSlowDown(int slowDown);
private slots:
void clientConnected();
@@ -112,6 +113,7 @@ private:
MGConfItem currentLocale;
QString defaultTheme;
bool delayedThemeChange;
+ int slowDown;
QMap<qint32, QQueue<QueueItem> > loadPixmapsQueue;
QQueue<QueueItem> releasePixmapsQueue;