summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel
diff options
context:
space:
mode:
authorShane Kearns <shane.kearns@sosco.com>2009-08-20 14:09:00 (GMT)
committerShane Kearns <shane.kearns@sosco.com>2009-08-20 14:09:00 (GMT)
commitd4c0be3b5758b37ef9da6fcbce4c5a6d84f3a52b (patch)
tree9557e933bc640009f587c7b58062d57f8ada9f34 /src/corelib/kernel
parent06524f769fec76fa7ebcc39ac88ac9e08c720677 (diff)
downloadQt-d4c0be3b5758b37ef9da6fcbce4c5a6d84f3a52b.zip
Qt-d4c0be3b5758b37ef9da6fcbce4c5a6d84f3a52b.tar.gz
Qt-d4c0be3b5758b37ef9da6fcbce4c5a6d84f3a52b.tar.bz2
performance: refactored use of RFs so corelib and gui share one session
Opening and closing sessions has a performance impact on Symbian, so all users of RFs now share a single session. If a native file engine is written for Symbian (instead of the posix one currently in use) then that could own the global data instead of QCoreApplication. Task-number: 247617 Reviewed-by: jbarron
Diffstat (limited to 'src/corelib/kernel')
-rw-r--r--src/corelib/kernel/qcoreapplication.cpp49
-rw-r--r--src/corelib/kernel/qcoreapplication_p.h11
2 files changed, 43 insertions, 17 deletions
diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp
index 875c3cc..88df7ac 100644
--- a/src/corelib/kernel/qcoreapplication.cpp
+++ b/src/corelib/kernel/qcoreapplication.cpp
@@ -271,6 +271,12 @@ QCoreApplicationPrivate::QCoreApplicationPrivate(int &aargc, char **aargv)
qt_application_thread_id = QThread::currentThreadId();
#endif
+#ifdef Q_OS_SYMBIAN
+ if(KErrNone != fileServerSession.Connect())
+ qFatal("FATAL: QCoreApplicationPrivate can't connect to file server");
+ fileServerSession.ShareProtected(); //makes the handle ok for multithreading and IPC
+#endif
+
// note: this call to QThread::currentThread() may end up setting theMainThread!
if (QThread::currentThread() != theMainThread)
qWarning("WARNING: QApplication was not created in the main() thread.");
@@ -278,6 +284,7 @@ QCoreApplicationPrivate::QCoreApplicationPrivate(int &aargc, char **aargv)
QCoreApplicationPrivate::~QCoreApplicationPrivate()
{
+ fileServerSession.Close();
if (threadData) {
#ifndef QT_NO_THREAD
void *data = &threadData->tls;
@@ -816,6 +823,18 @@ bool QCoreApplicationPrivate::notify_helper(QObject *receiver, QEvent * event)
return receiver->event(event);
}
+#ifdef Q_OS_SYMBIAN
+/*!\internal
+
+ Accessor for shared global file server session
+ */
+RFs QCoreApplicationPrivate::fileServerSession;
+RFs& QCoreApplicationPrivate::fsSession()
+{
+ return fileServerSession;
+}
+#endif
+
/*!
Returns true if an application object has not been created yet;
otherwise returns false.
@@ -1117,7 +1136,7 @@ void QCoreApplication::postEvent(QObject *receiver, QEvent *event, int priority)
event->d = reinterpret_cast<QEventPrivate *>(quintptr(data->loopLevel));
}
- // delete the event on exceptions to protect against memory leaks till the event is
+ // delete the event on exceptions to protect against memory leaks till the event is
// properly owned in the postEventList
QScopedPointer<QEvent> eventDeleter(event);
if (data->postEventList.isEmpty() || data->postEventList.last().priority >= priority) {
@@ -2169,23 +2188,19 @@ QStringList QCoreApplication::libraryPaths()
// Add existing path on all drives for relative PluginsPath in Symbian
if (installPathPlugins.at(1) != QChar(':')) {
QString tempPath = installPathPlugins;
- if (tempPath.at(tempPath.length()-1) != QChar('\\')) {
+ if (tempPath.at(tempPath.length() - 1) != QChar('\\')) {
tempPath += QChar('\\');
}
- RFs fs;
- TInt err = fs.Connect();
- if (err == KErrNone) {
- TPtrC tempPathPtr(reinterpret_cast<const TText*>(tempPath.constData()));
- TFindFile finder(fs);
- err = finder.FindByDir(tempPathPtr, tempPathPtr);
- while (err == KErrNone) {
- QString foundDir = QString::fromUtf16(finder.File().Ptr(), finder.File().Length());
- foundDir = QDir(foundDir).canonicalPath();
- if (!app_libpaths->contains(foundDir))
- app_libpaths->append(foundDir);
- err = finder.Find();
- }
- fs.Close();
+ RFs& fs = QCoreApplicationPrivate::fsSession();
+ TPtrC tempPathPtr(reinterpret_cast<const TText*> (tempPath.constData()));
+ TFindFile finder(fs);
+ TInt err = finder.FindByDir(tempPathPtr, tempPathPtr);
+ while (err == KErrNone) {
+ QString foundDir = QString::fromUtf16(finder.File().Ptr(), finder.File().Length());
+ foundDir = QDir(foundDir).canonicalPath();
+ if (!app_libpaths->contains(foundDir))
+ app_libpaths->append(foundDir);
+ err = finder.Find();
}
}
#else
@@ -2329,7 +2344,7 @@ void QCoreApplication::removeLibraryPath(const QString &path)
By default, no event filter function is set (i.e., this function
returns a null EventFilter the first time it is called).
-
+
\note The filter function set here receives native messages,
i.e. MSG or XEvent structs, that are going to Qt objects. It is
called by QCoreApplication::filterEvent(). If the filter function
diff --git a/src/corelib/kernel/qcoreapplication_p.h b/src/corelib/kernel/qcoreapplication_p.h
index 169835f..1adb837 100644
--- a/src/corelib/kernel/qcoreapplication_p.h
+++ b/src/corelib/kernel/qcoreapplication_p.h
@@ -57,6 +57,10 @@
#include "QtCore/qtranslator.h"
#include "private/qobject_p.h"
+#ifdef Q_OS_SYMBIAN
+#include <f32file.h>
+#endif
+
QT_BEGIN_NAMESPACE
typedef QList<QTranslator*> QTranslatorList;
@@ -86,6 +90,10 @@ public:
static QString macMenuBarName();
#endif
+#ifdef Q_OS_SYMBIAN
+ static RFs& fsSession();
+#endif
+
static QThread *theMainThread;
static QThread *mainThread();
static bool checkInstance(const char *method);
@@ -118,6 +126,9 @@ public:
static uint attribs;
static inline bool testAttribute(uint flag) { return attribs & (1 << flag); }
+#ifdef Q_OS_SYMBIAN
+ static RFs fileServerSession; //this should be moved into a symbian file engine if/when one is written
+#endif
};
QT_END_NAMESPACE