Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
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 78 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 80 of file qnetworkreplywasmimpl_p.h.

Constructor & Destructor Documentation

◆ FetchContext()

FetchContext::FetchContext ( QNetworkReplyWasmImplPrivate * networkReply)
inline

Definition at line 82 of file qnetworkreplywasmimpl_p.h.

Member Data Documentation

◆ mutex

◆ reply

◆ requestData

QByteArray FetchContext::requestData

◆ state


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