diff options
author | Robin Burchell <robin.burchell@viroteck.net> | 2015-06-24 12:02:42 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@theqtcompany.com> | 2015-06-27 07:54:36 +0000 |
commit | 6648b8d3dd442392638a40d617f86166282aa5fd (patch) | |
tree | 302219cf3e3395a4f017d4592c9661a6c8e8c51a /src/quick/scenegraph/qsgthreadedrenderloop.cpp | |
parent | 138f24d2b365326fc466018d1a98e0f6b317ef4d (diff) |
QSGThreadedRenderLoop::maybeUpdate: Micro-optimize.
* Put the cheap checks (pointer ones) first
* Don't call currentThread twice as it involves a mutex lock/unlock
Change-Id: I5df92ea99b034301113e9bd34f8a66df1a7e7dfe
Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
Diffstat (limited to 'src/quick/scenegraph/qsgthreadedrenderloop.cpp')
-rw-r--r-- | src/quick/scenegraph/qsgthreadedrenderloop.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/quick/scenegraph/qsgthreadedrenderloop.cpp b/src/quick/scenegraph/qsgthreadedrenderloop.cpp index 074e7633da..3b8fdebeed 100644 --- a/src/quick/scenegraph/qsgthreadedrenderloop.cpp +++ b/src/quick/scenegraph/qsgthreadedrenderloop.cpp @@ -1015,20 +1015,20 @@ void QSGThreadedRenderLoop::maybeUpdate(Window *w) if (!QCoreApplication::instance()) return; + if (!w || !w->thread->isRunning()) + return; + QThread *current = QThread::currentThread(); if (current != QCoreApplication::instance()->thread() && (current != w->thread || !m_lockedForSync)) { qWarning() << "Updates can only be scheduled from GUI thread or from QQuickItem::updatePaintNode()"; return; } - if (!w || !w->thread->isRunning()) { - return; - } qCDebug(QSG_LOG_RENDERLOOP) << "update from item" << w->window; // Call this function from the Gui thread later as startTimer cannot be // called from the render thread. - if (QThread::currentThread() == w->thread) { + if (current == w->thread) { qCDebug(QSG_LOG_RENDERLOOP) << "- on render thread"; w->updateDuringSync = true; return; |