diff options
author | axis <qt-info@nokia.com> | 2010-09-23 12:20:13 (GMT) |
---|---|---|
committer | axis <qt-info@nokia.com> | 2010-09-23 12:37:39 (GMT) |
commit | ecc7beca87bdfdad2e260f6b9621b77055cf313c (patch) | |
tree | f204bad6ff57e718beecf960a25fec745687ae56 | |
parent | 8d8d147f1dd5d2922a4c61c43d378c8784224f13 (diff) | |
download | Qt-ecc7beca87bdfdad2e260f6b9621b77055cf313c.zip Qt-ecc7beca87bdfdad2e260f6b9621b77055cf313c.tar.gz Qt-ecc7beca87bdfdad2e260f6b9621b77055cf313c.tar.bz2 |
Made it more clear what the okToRun function does by renaming it.
Since it has the side effect of possibly adding the object to the
deferred run queue, this name is more appropriate.
AutoTest: Passed
RevBy: mread
-rw-r--r-- | src/corelib/kernel/qeventdispatcher_symbian.cpp | 22 | ||||
-rw-r--r-- | src/corelib/kernel/qeventdispatcher_symbian_p.h | 2 |
2 files changed, 12 insertions, 12 deletions
diff --git a/src/corelib/kernel/qeventdispatcher_symbian.cpp b/src/corelib/kernel/qeventdispatcher_symbian.cpp index 89012d1..d8cc344 100644 --- a/src/corelib/kernel/qeventdispatcher_symbian.cpp +++ b/src/corelib/kernel/qeventdispatcher_symbian.cpp @@ -127,9 +127,9 @@ private: * cannot change active objects that we do not own, but the active objects that Qt owns will use * this as a base class with convenience functions. * - * Here is how it works: On every RunL, the deriving class should call okToRun(). This will allow - * exactly one run of the active object, and mark it as such. If it is called again, it will return - * false, and add the object to a queue so it can be run later. + * Here is how it works: On every RunL, the deriving class should call maybeQueueForLater(). + * This will return whether the active object has been queued, or whether it should run immediately. + * Queued objects will run again after other events have been processed. * * The QCompleteDeferredAOs class is a special object that runs after all others, which will * reactivate the objects that were previously not run. @@ -149,7 +149,7 @@ QActiveObject::~QActiveObject() m_dispatcher->removeDeferredActiveObject(this); } -bool QActiveObject::okToRun() +bool QActiveObject::maybeQueueForLater() { Q_ASSERT(!m_hasRunAgain); @@ -157,12 +157,12 @@ bool QActiveObject::okToRun() // First occurrence of this event in this iteration. m_hasAlreadyRun = true; m_iterationCount = m_dispatcher->iterationCount(); - return true; + return false; } else { // The event has already occurred. m_dispatcher->addDeferredActiveObject(this); m_hasRunAgain = true; - return false; + return true; } } @@ -200,7 +200,7 @@ void QWakeUpActiveObject::DoCancel() void QWakeUpActiveObject::RunL() { - if (!okToRun()) + if (maybeQueueForLater()) return; iStatus = KRequestPending; @@ -272,7 +272,7 @@ void QTimerActiveObject::Run() return; } - if (!okToRun()) + if (maybeQueueForLater()) return; if (m_timerInfo->interval > 0) { @@ -632,7 +632,7 @@ void QSocketActiveObject::DoCancel() void QSocketActiveObject::RunL() { - if (!okToRun()) + if (maybeQueueForLater()) return; QT_TRYCATCH_LEAVING(m_dispatcher->socketFired(this)); @@ -1066,10 +1066,10 @@ void QEventDispatcherSymbian::registerTimer ( int timerId, int interval, QObject if (m_insideTimerEvent) // If we are inside a timer event, we need to prevent event starvation // by preventing newly created timers from running in the same event processing - // iteration. Do this by calling the okToRun() function to "fake" that we have + // iteration. Do this by calling the maybeQueueForLater() function to "fake" that we have // already run once. This will cause the next run to be added to the deferred // queue instead. - timer->timerAO->okToRun(); + timer->timerAO->maybeQueueForLater(); } bool QEventDispatcherSymbian::unregisterTimer ( int timerId ) diff --git a/src/corelib/kernel/qeventdispatcher_symbian_p.h b/src/corelib/kernel/qeventdispatcher_symbian_p.h index 8e20d56..1486db5 100644 --- a/src/corelib/kernel/qeventdispatcher_symbian_p.h +++ b/src/corelib/kernel/qeventdispatcher_symbian_p.h @@ -82,7 +82,7 @@ public: QActiveObject(TInt priority, QEventDispatcherSymbian *dispatcher); ~QActiveObject(); - bool okToRun(); + bool maybeQueueForLater(); void reactivateAndComplete(); |