diff options
Diffstat (limited to 'src/corelib')
-rw-r--r-- | src/corelib/animation/qabstractanimation.cpp | 16 | ||||
-rw-r--r-- | src/corelib/animation/qabstractanimation_p.h | 11 | ||||
-rw-r--r-- | src/corelib/global/qglobal.h | 6 | ||||
-rw-r--r-- | src/corelib/io/qiodevice.cpp | 4 | ||||
-rw-r--r-- | src/corelib/io/qsettings.cpp | 6 | ||||
-rw-r--r-- | src/corelib/kernel/qeventdispatcher_symbian.cpp | 46 | ||||
-rw-r--r-- | src/corelib/kernel/qeventdispatcher_symbian_p.h | 20 | ||||
-rw-r--r-- | src/corelib/kernel/qmetaobject_p.h | 11 | ||||
-rw-r--r-- | src/corelib/thread/qsemaphore.cpp | 7 | ||||
-rw-r--r-- | src/corelib/tools/qbytearray.cpp | 5 | ||||
-rw-r--r-- | src/corelib/tools/qsimd_p.h | 3 |
11 files changed, 57 insertions, 78 deletions
diff --git a/src/corelib/animation/qabstractanimation.cpp b/src/corelib/animation/qabstractanimation.cpp index 04342e7..641b42b 100644 --- a/src/corelib/animation/qabstractanimation.cpp +++ b/src/corelib/animation/qabstractanimation.cpp @@ -168,7 +168,7 @@ Q_GLOBAL_STATIC(QThreadStorage<QUnifiedTimer *>, unifiedTimer) QUnifiedTimer::QUnifiedTimer() : QObject(), lastTick(0), timingInterval(DEFAULT_TIMER_INTERVAL), currentAnimationIdx(0), consistentTiming(false), slowMode(false), - isPauseTimerActive(false), runningLeafAnimations(0) + slowdownFactor(5.0f), isPauseTimerActive(false), runningLeafAnimations(0) { time.invalidate(); } @@ -205,12 +205,18 @@ void QUnifiedTimer::ensureTimerUpdate() void QUnifiedTimer::updateAnimationsTime() { + qint64 totalElapsed = time.elapsed(); // ignore consistentTiming in case the pause timer is active int delta = (consistentTiming && !isPauseTimerActive) ? - timingInterval : time.elapsed() - lastTick; - if (slowMode) - delta /= 5; - lastTick = time.elapsed(); + timingInterval : totalElapsed - lastTick; + if (slowMode) { + if (slowdownFactor > 0) + delta = qRound(delta / slowdownFactor); + else + delta = 0; + } + + lastTick = totalElapsed; //we make sure we only call update time if the time has actually changed //it might happen in some cases that the time doesn't change because events are delayed diff --git a/src/corelib/animation/qabstractanimation_p.h b/src/corelib/animation/qabstractanimation_p.h index fcfe824..d3d4098 100644 --- a/src/corelib/animation/qabstractanimation_p.h +++ b/src/corelib/animation/qabstractanimation_p.h @@ -145,8 +145,9 @@ public: */ void setConsistentTiming(bool consistent) { consistentTiming = consistent; } - //this facilitates fine-tuning of complex animations + //these facilitate fine-tuning of complex animations void setSlowModeEnabled(bool enabled) { slowMode = enabled; } + void setSlowdownFactor(qreal factor) { slowdownFactor = factor; } /* this is used for updating the currentTime of all animations in case the pause @@ -171,11 +172,17 @@ private: ElapsedTimer time; - int lastTick; + qint64 lastTick; int timingInterval; int currentAnimationIdx; bool consistentTiming; bool slowMode; + + // This factor will be used to divide the DEFAULT_TIMER_INTERVAL at each tick + // when slowMode is enabled. Setting it to 0 or higher than DEFAULT_TIMER_INTERVAL (16) + // stops all animations. + qreal slowdownFactor; + // bool to indicate that only pause animations are active bool isPauseTimerActive; diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index 1eab394..76f35ac 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -412,15 +412,13 @@ namespace QT_NAMESPACE {} # if defined(__INTEL_COMPILER) # define Q_CC_INTEL # endif -/* x64 does not support mmx intrinsics on windows */ -# if (defined(Q_OS_WIN64) && defined(_M_X64)) +/* MSVC does not support SSE/MMX on x64 */ +# if (defined(Q_CC_MSVC) && defined(_M_X64)) # undef QT_HAVE_SSE -# undef QT_HAVE_SSE2 # undef QT_HAVE_MMX # undef QT_HAVE_3DNOW # endif - #elif defined(__BORLANDC__) || defined(__TURBOC__) # define Q_CC_BOR # define Q_INLINE_TEMPLATE diff --git a/src/corelib/io/qiodevice.cpp b/src/corelib/io/qiodevice.cpp index ea60792..26e587d 100644 --- a/src/corelib/io/qiodevice.cpp +++ b/src/corelib/io/qiodevice.cpp @@ -1452,7 +1452,7 @@ qint64 QIODevicePrivate::peek(char *data, qint64 maxSize) return readBytes; buffer.ungetBlock(data, readBytes); - pos -= readBytes; + *pPos -= readBytes; return readBytes; } @@ -1467,7 +1467,7 @@ QByteArray QIODevicePrivate::peek(qint64 maxSize) return result; buffer.ungetBlock(result.constData(), result.size()); - pos -= result.size(); + *pPos -= result.size(); return result; } diff --git a/src/corelib/io/qsettings.cpp b/src/corelib/io/qsettings.cpp index 64015ce..f802412 100644 --- a/src/corelib/io/qsettings.cpp +++ b/src/corelib/io/qsettings.cpp @@ -2274,9 +2274,9 @@ void QConfFileSettingsPrivate::ensureSectionParsed(QConfFile *confFile, be different instances of your application running at the same time or different applications altogether) to read and write to the same system locations. It uses advisory file locking and a - smart merging algorithm to ensure data integrity. Changes - performed by another process aren't visible in the current - process until sync() is called. + smart merging algorithm to ensure data integrity. Note that sync() + imports changes made by other processes (in addition to writing + the changes from this QSettings). \section1 Platform-Specific Notes diff --git a/src/corelib/kernel/qeventdispatcher_symbian.cpp b/src/corelib/kernel/qeventdispatcher_symbian.cpp index 9d8ee5a..e86efb2 100644 --- a/src/corelib/kernel/qeventdispatcher_symbian.cpp +++ b/src/corelib/kernel/qeventdispatcher_symbian.cpp @@ -100,40 +100,25 @@ static inline int qt_socket_select(int nfds, fd_set *readfds, fd_set *writefds, class QSelectMutexGrabber { public: - QSelectMutexGrabber(int fd, QMutex *threadMutex, QMutex *selectCallMutex) - : m_threadMutex(threadMutex), m_selectCallMutex(selectCallMutex), bHasThreadLock(false) + QSelectMutexGrabber(int fd, QMutex *mutex) + : m_mutex(mutex) { - // see if selectThread is waiting m_waitCond - // if yes ... dont write to pipe - if (m_threadMutex->tryLock()) { - bHasThreadLock = true; + if (m_mutex->tryLock()) return; - } - - // still check that SelectThread - // is in select call - if (m_selectCallMutex->tryLock()) { - m_selectCallMutex->unlock(); - return; - } char dummy = 0; qt_pipe_write(fd, &dummy, 1); - m_threadMutex->lock(); - bHasThreadLock = true; + m_mutex->lock(); } ~QSelectMutexGrabber() { - if(bHasThreadLock) - m_threadMutex->unlock(); + m_mutex->unlock(); } private: - QMutex *m_threadMutex; - QMutex *m_selectCallMutex; - bool bHasThreadLock; + QMutex *m_mutex; }; /* @@ -415,12 +400,7 @@ void QSelectThread::run() int ret; int savedSelectErrno; - { - // helps fighting the race condition between - // selctthread and new socket requests (cancel, restart ...) - QMutexLocker locker(&m_selectCallMutex); - ret = qt_socket_select(maxfd, &readfds, &writefds, &exceptionfds, 0); - } + ret = qt_socket_select(maxfd, &readfds, &writefds, &exceptionfds, 0); savedSelectErrno = errno; char buffer; @@ -515,9 +495,7 @@ void QSelectThread::requestSocketEvents ( QSocketNotifier *notifier, TRequestSta start(); } - QMutexLocker locker(&m_grabberMutex); - - QSelectMutexGrabber lock(m_pipeEnds[1], &m_mutex, &m_selectCallMutex); + QSelectMutexGrabber lock(m_pipeEnds[1], &m_mutex); Q_ASSERT(!m_AOStatuses.contains(notifier)); @@ -528,9 +506,7 @@ void QSelectThread::requestSocketEvents ( QSocketNotifier *notifier, TRequestSta void QSelectThread::cancelSocketEvents ( QSocketNotifier *notifier ) { - QMutexLocker locker(&m_grabberMutex); - - QSelectMutexGrabber lock(m_pipeEnds[1], &m_mutex, &m_selectCallMutex); + QSelectMutexGrabber lock(m_pipeEnds[1], &m_mutex); m_AOStatuses.remove(notifier); @@ -539,9 +515,7 @@ void QSelectThread::cancelSocketEvents ( QSocketNotifier *notifier ) void QSelectThread::restart() { - QMutexLocker locker(&m_grabberMutex); - - QSelectMutexGrabber lock(m_pipeEnds[1], &m_mutex, &m_selectCallMutex); + QSelectMutexGrabber lock(m_pipeEnds[1], &m_mutex); m_waitCond.wakeAll(); } diff --git a/src/corelib/kernel/qeventdispatcher_symbian_p.h b/src/corelib/kernel/qeventdispatcher_symbian_p.h index 211ded4..bc42753 100644 --- a/src/corelib/kernel/qeventdispatcher_symbian_p.h +++ b/src/corelib/kernel/qeventdispatcher_symbian_p.h @@ -211,26 +211,6 @@ private: QMutex m_mutex; QWaitCondition m_waitCond; bool m_quit; - - // to protect when several - // requests like: - // requestSocketEvents - // cancelSocketEvents - // kick in the same time - // all will fight for m_mutex - // - // TODO: fix more elegantely - // - QMutex m_grabberMutex; - - // this one will tell - // if selectthread is - // really in select call - // and will prevent - // writing to pipe that - // causes later in locking - // of the thread in waitcond - QMutex m_selectCallMutex; }; class Q_CORE_EXPORT CQtActiveScheduler : public CActiveScheduler diff --git a/src/corelib/kernel/qmetaobject_p.h b/src/corelib/kernel/qmetaobject_p.h index b538787..4a03874 100644 --- a/src/corelib/kernel/qmetaobject_p.h +++ b/src/corelib/kernel/qmetaobject_p.h @@ -276,12 +276,15 @@ static QByteArray normalizeTypeInternal(const char *t, const char *e, bool fixSc ++templdepth; if (c == '>') --templdepth; - if (templdepth == 0) { + if (templdepth == 0 || (templdepth == 1 && c == ',')) { result += normalizeTypeInternal(tt, t-1, fixScope, false); result += c; - if (*t == '>') - result += ' '; // avoid >> - break; + if (templdepth == 0) { + if (*t == '>') + result += ' '; // avoid >> + break; + } + tt = t; } } } diff --git a/src/corelib/thread/qsemaphore.cpp b/src/corelib/thread/qsemaphore.cpp index 9dc828d..8e8a88a 100644 --- a/src/corelib/thread/qsemaphore.cpp +++ b/src/corelib/thread/qsemaphore.cpp @@ -44,6 +44,8 @@ #ifndef QT_NO_THREAD #include "qmutex.h" #include "qwaitcondition.h" +#include "qelapsedtimer.h" +#include "qdatetime.h" QT_BEGIN_NAMESPACE @@ -218,8 +220,11 @@ bool QSemaphore::tryAcquire(int n, int timeout) while (n > d->avail) d->cond.wait(locker.mutex()); } else { + QElapsedTimer timer; + timer.start(); while (n > d->avail) { - if (!d->cond.wait(locker.mutex(), timeout)) + if (timer.hasExpired(timeout) + || !d->cond.wait(locker.mutex(), timeout - timer.elapsed())) return false; } } diff --git a/src/corelib/tools/qbytearray.cpp b/src/corelib/tools/qbytearray.cpp index 05d38f6..b46af1f 100644 --- a/src/corelib/tools/qbytearray.cpp +++ b/src/corelib/tools/qbytearray.cpp @@ -1805,6 +1805,11 @@ QByteArray &QByteArray::replace(int pos, int len, const QByteArray &after) /*! \fn QByteArray &QByteArray::replace(int pos, int len, const char *after) \overload + + Replaces \a len bytes from index position \a pos with the zero terminated + string \a after. + + Notice: this can change the lenght of the byte array. */ QByteArray &QByteArray::replace(int pos, int len, const char *after) { diff --git a/src/corelib/tools/qsimd_p.h b/src/corelib/tools/qsimd_p.h index cbe6146..58d2dcb 100644 --- a/src/corelib/tools/qsimd_p.h +++ b/src/corelib/tools/qsimd_p.h @@ -58,7 +58,8 @@ QT_BEGIN_HEADER #endif // SSE intrinsics -#if defined(__SSE2__) && defined(QT_HAVE_SSE2) && !defined(QT_BOOTSTRAPPED) +#if defined(QT_HAVE_SSE2) && !defined(QT_BOOTSTRAPPED) && (defined(__SSE2__) \ + || (defined(Q_CC_MSVC) && (defined(_M_X64) || _M_IX86_FP == 2))) #if defined(QT_LINUXBASE) /// this is an evil hack - the posix_memalign declaration in LSB /// is wrong - see http://bugs.linuxbase.org/show_bug.cgi?id=2431 |