wasm: remove dead qt_asyncify_yield() code
The call to this function was behind a broken #define and was never enabled. It also does not work, so remove it. This means that calling processEvents() in a loop (as opposed to calling exec()) most likely does not work either, which is something we want to revisit. Pick-to: 6.4 Change-Id: I90802a69d3a48e7f2b5d0b657d89452c09d9571a Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This commit is contained in:
parent
fa0e24b641
commit
238e90cd58
@ -76,17 +76,6 @@ bool qt_asyncify_resume()
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Yields control to the browser, so that it can process events. Must
|
|
||||||
// be called on the main thread. Returns false immediately if Qt has
|
|
||||||
// already suspended the main thread. Returns true after yielding.
|
|
||||||
bool qt_asyncify_yield()
|
|
||||||
{
|
|
||||||
if (g_is_asyncify_suspended)
|
|
||||||
return false;
|
|
||||||
emscripten_sleep(0);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // QT_HAVE_EMSCRIPTEN_ASYNCIFY
|
#endif // QT_HAVE_EMSCRIPTEN_ASYNCIFY
|
||||||
|
|
||||||
Q_CONSTINIT QEventDispatcherWasm *QEventDispatcherWasm::g_mainThreadEventDispatcher = nullptr;
|
Q_CONSTINIT QEventDispatcherWasm *QEventDispatcherWasm::g_mainThreadEventDispatcher = nullptr;
|
||||||
@ -198,9 +187,6 @@ bool QEventDispatcherWasm::processEvents(QEventLoop::ProcessEventsFlags flags)
|
|||||||
handleApplicationExec();
|
handleApplicationExec();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(flags & QEventLoop::ExcludeUserInputEvents))
|
|
||||||
pollForNativeEvents();
|
|
||||||
|
|
||||||
hasPendingEvents = qGlobalPostedEventsCount() > 0;
|
hasPendingEvents = qGlobalPostedEventsCount() > 0;
|
||||||
|
|
||||||
if (!hasPendingEvents && (flags & QEventLoop::WaitForMoreEvents))
|
if (!hasPendingEvents && (flags & QEventLoop::WaitForMoreEvents))
|
||||||
@ -386,21 +372,6 @@ void QEventDispatcherWasm::handleDialogExec()
|
|||||||
// For the asyncify case we do nothing here and wait for events in wait()
|
// For the asyncify case we do nothing here and wait for events in wait()
|
||||||
}
|
}
|
||||||
|
|
||||||
void QEventDispatcherWasm::pollForNativeEvents()
|
|
||||||
{
|
|
||||||
// Secondary thread event dispatchers do not support native events
|
|
||||||
if (isSecondaryThreadEventDispatcher())
|
|
||||||
return;
|
|
||||||
|
|
||||||
#if HAVE_EMSCRIPTEN_ASYNCIFY
|
|
||||||
// Asyncify allows us to yield to the browser and have it process native events -
|
|
||||||
// but this will fail if we are recursing and are already in a yield.
|
|
||||||
bool didYield = qt_asyncify_yield();
|
|
||||||
if (!didYield)
|
|
||||||
qWarning("QEventDispatcherWasm::processEvents() did not asyncify process native events");
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
// Blocks/suspends the calling thread. This is possible in two cases:
|
// Blocks/suspends the calling thread. This is possible in two cases:
|
||||||
// - Caller is a secondary thread: block on m_moreEvents
|
// - Caller is a secondary thread: block on m_moreEvents
|
||||||
// - Caller is the main thread and asyncify is enabled: suspend using qt_asyncify_suspend()
|
// - Caller is the main thread and asyncify is enabled: suspend using qt_asyncify_suspend()
|
||||||
|
@ -62,7 +62,6 @@ private:
|
|||||||
|
|
||||||
void handleApplicationExec();
|
void handleApplicationExec();
|
||||||
void handleDialogExec();
|
void handleDialogExec();
|
||||||
void pollForNativeEvents();
|
|
||||||
bool wait(int timeout = -1);
|
bool wait(int timeout = -1);
|
||||||
bool wakeEventDispatcherThread();
|
bool wakeEventDispatcherThread();
|
||||||
static void callProcessEvents(void *eventDispatcher);
|
static void callProcessEvents(void *eventDispatcher);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user