summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSami Merilä <sami.merila@nokia.com>2009-06-18 14:00:10 (GMT)
committerSami Merilä <sami.merila@nokia.com>2009-06-18 14:00:10 (GMT)
commit402acf14686738a20b184b646a3211a7633995a0 (patch)
tree385d2736ef8043ce5ac695b4337ebcc0e5a5a30b /src
parent39a85ed5f0bcd590391ac7c9b005cb7612b9d765 (diff)
parent22e27c6e3002566b39fea15bf4f05ed298818f47 (diff)
downloadQt-402acf14686738a20b184b646a3211a7633995a0.zip
Qt-402acf14686738a20b184b646a3211a7633995a0.tar.gz
Qt-402acf14686738a20b184b646a3211a7633995a0.tar.bz2
Merge branch 'master' of git@scm.dev.nokia.troll.no:qt/qt-s60-public
Diffstat (limited to 'src')
-rw-r--r--src/corelib/io/qprocess_symbian.cpp3
-rw-r--r--src/corelib/kernel/qeventdispatcher_symbian.cpp46
-rw-r--r--src/corelib/kernel/qeventdispatcher_symbian_p.h10
3 files changed, 41 insertions, 18 deletions
diff --git a/src/corelib/io/qprocess_symbian.cpp b/src/corelib/io/qprocess_symbian.cpp
index 26e7cdc..7da6a1d 100644
--- a/src/corelib/io/qprocess_symbian.cpp
+++ b/src/corelib/io/qprocess_symbian.cpp
@@ -65,6 +65,7 @@
#include "qstring.h"
#include "qprocess.h"
#include "qprocess_p.h"
+#include "qeventdispatcher_symbian_p.h"
#include <private/qthread_p.h>
#include <qmutex.h>
@@ -594,7 +595,7 @@ TInt processManagerThreadFunction(TAny* param)
QProcessManager* manager = reinterpret_cast<QProcessManager*>(param);
- CActiveScheduler* scheduler = new CActiveScheduler();
+ CActiveScheduler* scheduler = new CQtActiveScheduler();
QPROCESS_ASSERT(scheduler,
EProcessManagerSchedulerCreationFail,
diff --git a/src/corelib/kernel/qeventdispatcher_symbian.cpp b/src/corelib/kernel/qeventdispatcher_symbian.cpp
index 17bb9a7..88e2a88 100644
--- a/src/corelib/kernel/qeventdispatcher_symbian.cpp
+++ b/src/corelib/kernel/qeventdispatcher_symbian.cpp
@@ -249,7 +249,7 @@ void QTimerActiveObject::Run()
SymbianTimerInfoPtr timerInfoPtr(m_timerInfo);
m_timerInfo->dispatcher->timerFired(m_timerInfo->timerId);
-
+
iStatus = KRequestPending;
SetActive();
TRequestStatus *status = &iStatus;
@@ -618,7 +618,7 @@ QEventDispatcherSymbian::~QEventDispatcherSymbian()
void QEventDispatcherSymbian::startingUp()
{
if( !CActiveScheduler::Current() ) {
- m_activeScheduler = new(ELeave)CActiveScheduler();
+ m_activeScheduler = new(ELeave)CQtActiveScheduler();
CActiveScheduler::Install(m_activeScheduler);
}
m_wakeUpAO = new(ELeave) QWakeUpActiveObject(this);
@@ -652,7 +652,7 @@ bool QEventDispatcherSymbian::processEvents ( QEventLoop::ProcessEventsFlags fla
m_iterationCount++;
RThread &thread = d->threadData->symbian_thread_handle;
-
+
bool block;
if (flags & QEventLoop::WaitForMoreEvents) {
block = true;
@@ -660,7 +660,7 @@ bool QEventDispatcherSymbian::processEvents ( QEventLoop::ProcessEventsFlags fla
} else {
block = false;
}
-
+
bool oldNoSocketEventsValue = m_noSocketEvents;
if (flags & QEventLoop::ExcludeSocketNotifiers) {
m_noSocketEvents = true;
@@ -668,10 +668,10 @@ bool QEventDispatcherSymbian::processEvents ( QEventLoop::ProcessEventsFlags fla
m_noSocketEvents = false;
handledAnyEvent = sendDeferredSocketEvents();
}
-
+
bool handledSymbianEvent = false;
m_interrupt = false;
-
+
/*
* This QTime variable is used to measure the time it takes to finish
* the event loop. If we take too long in the loop, other processes
@@ -687,9 +687,9 @@ bool QEventDispatcherSymbian::processEvents ( QEventLoop::ProcessEventsFlags fla
SubsequentRun,
TimeStarted
} timeState = FirstRun;
-
+
TProcessPriority priority;
-
+
while (1) {
if (block) {
// This is where Qt will spend most of its time.
@@ -701,19 +701,19 @@ bool QEventDispatcherSymbian::processEvents ( QEventLoop::ProcessEventsFlags fla
// This one should return without delay.
CActiveScheduler::Current()->WaitForAnyRequest();
}
-
+
if (timeState == SubsequentRun) {
time.start();
timeState = TimeStarted;
}
-
+
TInt error;
handledSymbianEvent = CActiveScheduler::RunIfReady(error, CActive::EPriorityIdle);
if (error) {
qWarning("CActiveScheduler::RunIfReady() returned error: %i\n", error);
CActiveScheduler::Current()->Error(error);
}
-
+
if (!handledSymbianEvent) {
qFatal("QEventDispatcherSymbian::processEvents(): Caught Symbian stray signal");
}
@@ -735,14 +735,14 @@ bool QEventDispatcherSymbian::processEvents ( QEventLoop::ProcessEventsFlags fla
if (timeState == FirstRun)
timeState = SubsequentRun;
};
-
+
emit awake();
-
+
m_noSocketEvents = oldNoSocketEventsValue;
} QT_CATCH (const std::exception& ex) {
-#ifndef QT_NO_EXCEPTIONS
+#ifndef QT_NO_EXCEPTIONS
CActiveScheduler::Current()->Error(qt_translateExceptionToSymbianError(ex));
-#endif
+#endif
}
return handledAnyEvent;
@@ -972,5 +972,21 @@ QList<QEventDispatcherSymbian::TimerInfo> QEventDispatcherSymbian::registeredTim
return list;
}
+/*
+ * This active scheduler class implements a simple report and continue policy, for Symbian OS leaves
+ * or exceptions from Qt that fall back to the scheduler.
+ * It will be used in cases where there is no existing active scheduler installed.
+ * Apps which link to qts60main.lib will have the UI active scheduler installed in the main thread
+ * instead of this one. But this would be used in other threads in the UI.
+ * An app could replace this behaviour by installing an alternative active scheduler.
+ */
+void CQtActiveScheduler::Error(TInt aError) const
+{
+ QT_TRY {
+ qWarning("Error from active scheduler %d", aError);
+ }
+ QT_CATCH (const std::bad_alloc&) {} // ignore alloc fails, nothing more can be done
+}
+
QT_END_NAMESPACE
diff --git a/src/corelib/kernel/qeventdispatcher_symbian_p.h b/src/corelib/kernel/qeventdispatcher_symbian_p.h
index 3593055..b39d6df 100644
--- a/src/corelib/kernel/qeventdispatcher_symbian_p.h
+++ b/src/corelib/kernel/qeventdispatcher_symbian_p.h
@@ -136,7 +136,7 @@ public:
protected:
void DoCancel();
void RunL();
-
+
private:
void Run();
@@ -209,6 +209,12 @@ private:
bool m_quit;
};
+class Q_CORE_EXPORT CQtActiveScheduler : public CActiveScheduler
+{
+public: // from CActiveScheduler
+ virtual void Error(TInt aError) const;
+};
+
class Q_CORE_EXPORT QEventDispatcherSymbian : public QAbstractEventDispatcher
{
Q_DECLARE_PRIVATE(QAbstractEventDispatcher)
@@ -253,7 +259,7 @@ private:
private:
QSelectThread m_selectThread;
- CActiveScheduler *m_activeScheduler;
+ CQtActiveScheduler *m_activeScheduler;
QHash<int, SymbianTimerInfoPtr> m_timerList;
QHash<QSocketNotifier *, QSocketActiveObject *> m_notifiers;