Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
Loading...
Searching...
No Matches
qwasmglobal_p.h
Go to the documentation of this file.
1
// Copyright (C) 2024 The Qt Company Ltd.
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
// Qt-Security score:significant reason:default
4
5
#
ifndef
QWASMGLOBAL_P_H
6
#
define
QWASMGLOBAL_P_H
7
8
#
include
<
emscripten
/
proxying
.
h
>
9
#
include
<
emscripten
/
threading
.
h
>
10
11
//
12
// W A R N I N G
13
// -------------
14
//
15
// This file is not part of the Qt API. It exists purely as an
16
// implementation detail. This header file may change from version to
17
// version without notice, or even be removed.
18
//
19
// We mean it.
20
//
21
22
QT_BEGIN_NAMESPACE
23
24
namespace
qwasmglobal
{
25
26
#
if
QT_CONFIG
(
thread
)
27
template
<
class
T
>
28
T
proxyCall
(
std
::
function
<
T
()>
task
,
emscripten
::
ProxyingQueue
*
queue
)
29
{
30
T
result
;
31
queue
->
proxySync
(
emscripten_main_runtime_thread_id
(),
32
[
task
,
result
= &
result
]() { *
result
=
task
(); });
33
return
result
;
34
}
35
36
template
<>
37
inline
void
proxyCall
<
void
>(
std
::
function
<
void
()>
task
,
emscripten
::
ProxyingQueue
*
queue
)
38
{
39
queue
->
proxySync
(
emscripten_main_runtime_thread_id
(),
task
);
40
}
41
42
template
<
class
T
>
43
T
runTaskOnMainThread
(
std
::
function
<
T
()>
task
,
emscripten
::
ProxyingQueue
*
queue
)
44
{
45
return
emscripten_is_main_runtime_thread
() ?
task
() :
proxyCall
<
T
>(
std
::
move
(
task
),
queue
);
46
}
47
48
template
<
class
T
>
49
T
runTaskOnMainThread
(
std
::
function
<
T
()>
task
)
50
{
51
emscripten
::
ProxyingQueue
singleUseQueue
;
52
return
runTaskOnMainThread
<
T
>(
task
, &
singleUseQueue
);
53
}
54
55
#
else
56
template
<
class
T>
57
T runTaskOnMainThread(
std
::function<T()> task)
58
{
59
return
task();
60
}
61
#
endif
// QT_CONFIG(thread)
62
63
Q_CORE_EXPORT
void
runAsync(
std
::function<
void
(
void
)> fn);
64
Q_CORE_EXPORT
void
runOnMainThread(
std
::function<
void
(
void
)> fn);
65
Q_CORE_EXPORT
void
runOnMainThreadAsync(
std
::function<
void
(
void
)> fn);
66
}
67
68
QT_END_NAMESPACE
69
70
#
endif
// QWASMGLOBAL_P_H
QWasmAnimationFrameMultiHandler
Definition
qwasmsuspendresumecontrol_p.h:98
QWasmEventHandler
Definition
qwasmsuspendresumecontrol_p.h:64
QWasmSuspendResumeControl
Definition
qwasmsuspendresumecontrol_p.h:26
QWasmTimer
Definition
qwasmsuspendresumecontrol_p.h:81
QWasmTimer::hasTimeout
bool hasTimeout()
Definition
qwasmsuspendresumecontrol.cpp:345
QWasmTimer::setTimeout
void setTimeout(std::chrono::milliseconds timeout)
Definition
qwasmsuspendresumecontrol.cpp:333
QWasmTimer::clearTimeout
void clearTimeout()
Definition
qwasmsuspendresumecontrol.cpp:350
QWasmTimer::QWasmTimer
QWasmTimer(QWasmSuspendResumeControl *suspendResume, std::function< void()> handler)
Definition
qwasmsuspendresumecontrol.cpp:312
QWasmTimer::~QWasmTimer
~QWasmTimer()
Definition
qwasmsuspendresumecontrol.cpp:326
QWasmTimer::QWasmTimer
QWasmTimer(QWasmTimer const &)=delete
QWasmTimer::operator=
QWasmTimer & operator=(QWasmTimer const &)=delete
qstdweb::ArrayBuffer
Definition
qstdweb_p.h:65
qstdweb::BlobIODevice
Definition
qstdweb_p.h:373
qstdweb::Blob
Definition
qstdweb_p.h:78
qstdweb::EventCallback
Definition
qstdweb_p.h:225
qstdweb::FileList
Definition
qstdweb_p.h:142
qstdweb::FileReader
Definition
qstdweb_p.h:156
qstdweb::FileSystemFileHandle
Definition
qstdweb_p.h:209
qstdweb::FileSystemFileIODevice
Definition
qstdweb_p.h:426
qstdweb::FileSystemWritableFileStreamIODevice
Definition
qstdweb_p.h:407
qstdweb::FileSystemWritableFileStream
Definition
qstdweb_p.h:199
qstdweb::FileUrlRegistration
Definition
qstdweb_p.h:124
qstdweb::File
Definition
qstdweb_p.h:95
qstdweb::Promise
Definition
qstdweb_p.h:243
qstdweb::Uint8ArrayIODevice
Definition
qstdweb_p.h:390
qstdweb::Uint8ArrayIODevice::size
qint64 size() const override
For open random-access devices, this function returns the size of the device.
Definition
qstdweb.cpp:733
qstdweb::Uint8ArrayIODevice::seek
bool seek(qint64 pos) override
For random-access devices, this function sets the current position to pos, returning true on success,...
Definition
qstdweb.cpp:738
qstdweb::Uint8ArrayIODevice::Uint8ArrayIODevice
Uint8ArrayIODevice(Uint8Array array)
Definition
qstdweb.cpp:717
qstdweb::Uint8ArrayIODevice::isSequential
bool isSequential() const override
Returns true if this device is sequential; otherwise returns false.
Definition
qstdweb.cpp:728
qstdweb::Uint8ArrayIODevice::writeData
qint64 writeData(const char *data, qint64 size) override
Writes up to maxSize bytes from data to the device.
Definition
qstdweb.cpp:755
qstdweb::Uint8ArrayIODevice::open
bool open(QIODevice::OpenMode mode) override
Definition
qstdweb.cpp:723
qstdweb::Uint8ArrayIODevice::readData
qint64 readData(char *data, qint64 maxSize) override
Reads up to maxSize bytes from the device into data, and returns the number of bytes read or -1 if an...
Definition
qstdweb.cpp:745
qstdweb::Uint8Array
Definition
qstdweb_p.h:173
qstdweb
Definition
qstdweb.cpp:29
qstdweb::canBlockCallingThread
bool canBlockCallingThread()
Definition
qstdweb.cpp:665
qstdweb::window
emscripten::val window()
Definition
qstdweb_p.h:446
qstdweb::uint53_t
double uint53_t
Definition
qstdweb.cpp:46
qstdweb::haveAsyncify
bool haveAsyncify()
Definition
qstdweb.cpp:659
qstdweb::haveJspi
bool haveJspi()
Definition
qstdweb.cpp:653
qstdweb::makeContextfulPromiseFunctionName
const char makeContextfulPromiseFunctionName[]
qstdweb::usePotentialyUnusedSymbols
static void usePotentialyUnusedSymbols()
Definition
qstdweb.cpp:31
qstdweb::bindForever
decltype(auto) bindForever(F wrappedCallback)
Definition
qstdweb_p.h:367
qwasmglobal
Definition
qwasmglobal.cpp:8
std
[33]
Definition
src_corelib_tools_qhash.cpp:421
qstdweb::PromiseCallbacks
Definition
qstdweb_p.h:235
qstdweb::PromiseCallbacks::thenFunc
std::function< void(emscripten::val)> thenFunc
Definition
qstdweb_p.h:236
qstdweb::PromiseCallbacks::finallyFunc
std::function< void()> finallyFunc
Definition
qstdweb_p.h:238
qstdweb::PromiseCallbacks::catchFunc
std::function< void(emscripten::val)> catchFunc
Definition
qstdweb_p.h:237
qtbase
src
corelib
platform
wasm
qwasmglobal_p.h
Generated on
for Qt by
1.18.0