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 moreAuto Trait Implementations§
impl Freeze for TransmitBodyConnectHandler
impl !RefUnwindSafe for TransmitBodyConnectHandler
impl Send for TransmitBodyConnectHandler
impl !Sync for TransmitBodyConnectHandler
impl Unpin for TransmitBodyConnectHandler
impl !UnwindSafe for TransmitBodyConnectHandler
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<T> Filterable for T
impl<T> Filterable for T
source§fn filterable(
self,
filter_name: &'static str,
) -> RequestFilterDataProvider<T, fn(_: DataRequest<'_>) -> bool>
fn filterable( self, filter_name: &'static str, ) -> RequestFilterDataProvider<T, fn(_: DataRequest<'_>) -> bool>
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more