Struct script::body::TransmitBodyConnectHandler
source · struct TransmitBodyConnectHandler {
stream: Trusted<ReadableStream>,
task_source: NetworkingTaskSource,
canceller: TaskCanceller,
bytes_sender: Option<IpcSender<BodyChunkResponse>>,
control_sender: IpcSender<BodyChunkRequest>,
in_memory: Option<Vec<u8>>,
in_memory_done: bool,
source: BodySource,
}
Expand description
The IPC route handler for https://fetch.spec.whatwg.org/#concept-request-transmit-body. This route runs in the script process, and will queue tasks to perform operations on the stream and transmit body chunks over IPC.
Fields§
§stream: Trusted<ReadableStream>
§task_source: NetworkingTaskSource
§canceller: TaskCanceller
§bytes_sender: Option<IpcSender<BodyChunkResponse>>
§control_sender: IpcSender<BodyChunkRequest>
§in_memory: Option<Vec<u8>>
§in_memory_done: bool
§source: BodySource
Implementations§
source§impl TransmitBodyConnectHandler
impl TransmitBodyConnectHandler
pub fn new(
stream: Trusted<ReadableStream>,
task_source: NetworkingTaskSource,
canceller: TaskCanceller,
control_sender: IpcSender<BodyChunkRequest>,
in_memory: Option<Vec<u8>>,
source: BodySource
) -> TransmitBodyConnectHandler
sourcepub fn reset_in_memory_done(&mut self)
pub fn reset_in_memory_done(&mut self)
Reset in_memory_done
, called when a stream is
re-extracted from the source to support a re-direct.
sourcefn re_extract(&mut self, chunk_request_receiver: IpcReceiver<BodyChunkRequest>)
fn re_extract(&mut self, chunk_request_receiver: IpcReceiver<BodyChunkRequest>)
Re-extract the source to support streaming it again for a re-direct. TODO: actually re-extract the source, instead of just cloning data, to support Blob.
sourcefn transmit_source(&mut self)
fn transmit_source(&mut self)
In case of re-direct, and of a source available in memory, send it all in one chunk.
TODO: this method should be deprecated
in favor of making re_extract
actually re-extract a stream from the source.
See #26686
sourcefn start_reading(&mut self, sender: IpcSender<BodyChunkResponse>)
fn start_reading(&mut self, sender: IpcSender<BodyChunkResponse>)
Take the IPC sender sent by net
, so we can send body chunks with it.
Also the entry point to https://fetch.spec.whatwg.org/#concept-request-transmit-body
sourcefn stop_reading(&mut self, reason: StopReading)
fn stop_reading(&mut self, reason: StopReading)
Drop the IPC sender sent by net
sourcefn transmit_body_chunk(&mut self)
fn transmit_body_chunk(&mut self)
Step 4 and following of https://fetch.spec.whatwg.org/#concept-request-transmit-body
Trait Implementations§
source§impl Clone for TransmitBodyConnectHandler
impl Clone for TransmitBodyConnectHandler
source§fn clone(&self) -> TransmitBodyConnectHandler
fn clone(&self) -> TransmitBodyConnectHandler
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more