Struct mozjs::jsapi::JS::OptimizedEncodingListener
source · #[repr(C)]pub struct OptimizedEncodingListener {
pub vtable_: *const OptimizedEncodingListener__bindgen_vtable,
}
Expand description
The ConsumeStreamCallback is called from an active JSContext, passing a StreamConsumer that wishes to consume the given host object as a stream of bytes with the given MIME type. On failure, the embedding must report the appropriate error on ‘cx’. On success, the embedding must call consumer->consumeChunk() repeatedly on any thread until exactly one of:
- consumeChunk() returns false
- the embedding calls consumer->streamEnd()
- the embedding calls consumer->streamError() before JS_DestroyContext(cx) or JS::ShutdownAsyncTasks(cx) is called.
Note: consumeChunk(), streamEnd() and streamError() may be called synchronously by ConsumeStreamCallback.
When streamEnd() is called, the embedding may optionally pass an OptimizedEncodingListener*, indicating that there is a cache entry associated with this stream that can store an optimized encoding of the bytes that were just streamed at some point in the future by having SpiderMonkey call storeOptimizedEncoding(). Until the optimized encoding is ready, SpiderMonkey will hold an outstanding refcount to keep the listener alive.
After storeOptimizedEncoding() is called, on cache hit, the embedding may call consumeOptimizedEncoding() instead of consumeChunk()/streamEnd(). The embedding must ensure that the GetOptimizedEncodingBuildId() (see js/BuildId.h) at the time when an optimized encoding is created is the same as when it is later consumed.
Fields§
§vtable_: *const OptimizedEncodingListener__bindgen_vtable
Trait Implementations§
source§impl Debug for OptimizedEncodingListener
impl Debug for OptimizedEncodingListener
source§impl PartialEq for OptimizedEncodingListener
impl PartialEq for OptimizedEncodingListener
source§fn eq(&self, other: &OptimizedEncodingListener) -> bool
fn eq(&self, other: &OptimizedEncodingListener) -> bool
self
and other
values to be equal, and is used
by ==
.impl StructuralPartialEq for OptimizedEncodingListener
Auto Trait Implementations§
impl Freeze for OptimizedEncodingListener
impl RefUnwindSafe for OptimizedEncodingListener
impl !Send for OptimizedEncodingListener
impl !Sync for OptimizedEncodingListener
impl Unpin for OptimizedEncodingListener
impl UnwindSafe for OptimizedEncodingListener
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> 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> 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