summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPiotr Wierciński <piotr.wiercinski@qt.io>2024-04-04 10:20:59 +0000
committerPiotr Wiercinski <piotr.wiercinski@qt.io>2024-04-05 14:41:23 +0200
commit157c9eef48916c3e11f43ffb0fe8e8030bed8d06 (patch)
treec43bd4afd0bb8b921e25cc1366f4eb74de64bfc7
parent938bdccb897db85396e96215281d66f64cb2a9ab (diff)
Revert "wasm: Proxy emscripten_fetch() to the main thread"
This reverts commit f2f2b6ef18907a76461b54e110618e7840971fa7. Reason for revert: There are couple of issues introduced. Lets revert to base revision and go with fixes from there. Pick-to: 6.5 6.6 6.7 Change-Id: I8341de42ef3e4a609bfbffdb763dd5c28794473c Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Even Oscar Andersen <even.oscar.andersen@qt.io>
-rw-r--r--src/corelib/kernel/qeventdispatcher_wasm_p.h2
-rw-r--r--src/network/access/qnetworkreplywasmimpl.cpp6
-rw-r--r--tests/auto/wasm/tst_fetchapi.cpp1
3 files changed, 3 insertions, 6 deletions
diff --git a/src/corelib/kernel/qeventdispatcher_wasm_p.h b/src/corelib/kernel/qeventdispatcher_wasm_p.h
index cf718a151b..7b257e02ad 100644
--- a/src/corelib/kernel/qeventdispatcher_wasm_p.h
+++ b/src/corelib/kernel/qeventdispatcher_wasm_p.h
@@ -55,7 +55,6 @@ public:
void wakeUp() override;
static void runOnMainThread(std::function<void(void)> fn);
- static void runOnMainThreadAsync(std::function<void(void)> fn);
static void socketSelect(int timeout, int socket, bool waitForRead, bool waitForWrite,
bool *selectForRead, bool *selectForWrite, bool *socketDisconnect);
@@ -98,6 +97,7 @@ private:
static void run(std::function<void(void)> fn);
static void runAsync(std::function<void(void)> fn);
+ static void runOnMainThreadAsync(std::function<void(void)> fn);
static QEventDispatcherWasm *g_mainThreadEventDispatcher;
diff --git a/src/network/access/qnetworkreplywasmimpl.cpp b/src/network/access/qnetworkreplywasmimpl.cpp
index eb3e50dec8..d8190434cc 100644
--- a/src/network/access/qnetworkreplywasmimpl.cpp
+++ b/src/network/access/qnetworkreplywasmimpl.cpp
@@ -9,7 +9,6 @@
#include <QtCore/qcoreapplication.h>
#include <QtCore/qfileinfo.h>
#include <QtCore/qthread.h>
-#include <QtCore/private/qeventdispatcher_wasm_p.h>
#include <QtCore/private/qoffsetstringarray_p.h>
#include <QtCore/private/qtools_p.h>
@@ -296,10 +295,7 @@ void QNetworkReplyWasmImplPrivate::doSendRequest()
QByteArray destinationPath = dPath.toUtf8();
attr.destinationPath = destinationPath.constData();
- auto url = request.url().toString().toUtf8();
- QEventDispatcherWasm::runOnMainThread([attr, url]() mutable {
- emscripten_fetch(&attr, url);
- });
+ m_fetch = emscripten_fetch(&attr, request.url().toString().toUtf8());
state = Working;
}
diff --git a/tests/auto/wasm/tst_fetchapi.cpp b/tests/auto/wasm/tst_fetchapi.cpp
index d8d9a7971a..3dcd8dd916 100644
--- a/tests/auto/wasm/tst_fetchapi.cpp
+++ b/tests/auto/wasm/tst_fetchapi.cpp
@@ -69,6 +69,7 @@ void tst_FetchApi::sendRequestOnMainThread()
void tst_FetchApi::sendRequestOnBackgroundThread()
{
+ QSKIP("Skip this test until we fix fetching from background threads.");
QEventLoop mainEventLoop;
BackgroundThread *backgroundThread = new BackgroundThread();
connect(backgroundThread, &BackgroundThread::finished, &mainEventLoop, &QEventLoop::quit);