Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
FetchContext Struct Reference

The FetchContext class ensures the requestData object remains valid while a fetch operation is pending. More...

#include <qnetworkreplywasmimpl_p.h>

Collaboration diagram for FetchContext:

Public Types

enum class  State {
  SCHEDULED , SENT , FINISHED , CANCELED ,
  TO_BE_DESTROYED
}

Public Member Functions

 FetchContext (QNetworkReplyWasmImplPrivate *networkReply)

Public Attributes

QNetworkReplyWasmImplPrivatereply { nullptr }
std::mutex mutex
QByteArray requestData
State state { State::SCHEDULED }

Detailed Description

The FetchContext class ensures the requestData object remains valid while a fetch operation is pending.

Since Emscripten fetch is asynchronous, requestData must persist until one of the final callbacks is invoked. Additionally, there's a potential race condition between the thread scheduling the fetch operation and the one executing it. Since fetch must occur on the main thread due to browser limitations, a mutex safeguards the FetchContext to ensure atomic state transitions.

Definition at line 79 of file qnetworkreplywasmimpl_p.h.

Member Enumeration Documentation

◆ State

enum class FetchContext::State
strong
Enumerator
SCHEDULED 
SENT 
FINISHED 
CANCELED 
TO_BE_DESTROYED 

Definition at line 81 of file qnetworkreplywasmimpl_p.h.

Constructor & Destructor Documentation

◆ FetchContext()

FetchContext::FetchContext ( QNetworkReplyWasmImplPrivate * networkReply)
inline

Definition at line 83 of file qnetworkreplywasmimpl_p.h.

References reply.

Referenced by QNetworkReplyWasmImplPrivate::doSendRequest().

Here is the caller graph for this function:

Member Data Documentation

◆ mutex

std::mutex FetchContext::mutex

Definition at line 86 of file qnetworkreplywasmimpl_p.h.

◆ reply

QNetworkReplyWasmImplPrivate* FetchContext::reply { nullptr }

◆ requestData

QByteArray FetchContext::requestData

Definition at line 87 of file qnetworkreplywasmimpl_p.h.

◆ state


The documentation for this struct was generated from the following file: