Struct xpcom::interfaces::nsISerialEventTarget
[−]
[src]
#[repr(C)]pub struct nsISerialEventTarget { /* fields omitted */ }
interface nsISerialEventTarget : nsIEventTarget
/**
* A serial event target is an event dispatching interface like
* nsIEventTarget. Runnables dispatched to an nsISerialEventTarget are required
* to execute serially. That is, two different runnables dispatched to the
* target should never be allowed to execute simultaneously. One exception to
* this rule is nested event loops. If a runnable spins a nested event loop,
* causing another runnable dispatched to the target to run, the target may
* still be considered "serial".
*
* Examples:
* - nsIThread is a serial event target.
* - Thread pools are not serial event targets.
* - However, one can "convert" a thread pool into an nsISerialEventTarget
* by putting a TaskQueue in front of it.
*/
Methods
impl nsISerialEventTarget
[src]
pub fn coerce<T: nsISerialEventTargetCoerce>(&self) -> &T
[src]
Cast this nsISerialEventTarget
to one of its base interfaces.
Methods from Deref<Target = nsIEventTarget>
pub fn coerce<T: nsIEventTargetCoerce>(&self) -> &T
[src]
Cast this nsIEventTarget
to one of its base interfaces.
pub const DISPATCH_NORMAL: i64
pub const DISPATCH_SYNC: i64
pub const DISPATCH_AT_END: i64
pub unsafe fn IsOnCurrentThreadInfallible(&self) -> bool
[src]
/**
* IsOnCurrentThread() should return true if events dispatched to this target
* can possibly run on the current thread, and false otherwise. In the case
* of an nsIEventTarget for a thread pool, it should return true on all
* threads in the pool. In the case of a non-thread nsIEventTarget such as
* ThrottledEventQueue, it should return true on the thread where events are
* expected to be processed, even if no events from the queue are actually
* being processed right now.
*
* When called on an nsISerialEventTarget, IsOnCurrentThread can be used to
* ensure that no other thread has "ownership" of the event target. As such,
* it's useful for asserting that an object is only used on a particular
* thread. IsOnCurrentThread can't guarantee that the current event has been
* dispatched through a particular event target.
*
* The infallible version of IsOnCurrentThread() is optimized to avoid a
* virtual call for non-thread event targets. Thread targets should set
* mVirtualThread to their virtual PRThread. Non-thread targets should leave
* mVirtualThread null and implement IsOnCurrentThreadInfallible() to
* return the correct answer.
*
* The fallible version of IsOnCurrentThread may return errors, such as during
* shutdown. If it does not return an error, it should return the same result
* as the infallible version. The infallible method should return the correct
* result regardless of whether the fallible method returns an error.
*/
[noscript,notxpcom] boolean isOnCurrentThreadInfallible ();
pub unsafe fn IsOnCurrentThread(&self, _retval: *mut bool) -> nsresult
[src]
boolean isOnCurrentThread ();
pub unsafe fn DispatchFromScript(
&self,
event: *const nsIRunnable,
flags: uint32_t
) -> nsresult
[src]
&self,
event: *const nsIRunnable,
flags: uint32_t
) -> nsresult
/**
* Version of Dispatch to expose to JS, which doesn't require an alreadyAddRefed<>
* (it will be converted to that internally)
*
* @param event
* The (raw) event to dispatch.
* @param flags
* The flags modifying event dispatch. The flags are described in detail
* below.
*
* @throws NS_ERROR_INVALID_ARG
* Indicates that event is null.
* @throws NS_ERROR_UNEXPECTED
* Indicates that the thread is shutting down and has finished processing
* events, so this event would never run and has not been dispatched.
*/
[binaryname(DispatchFromScript)] void dispatch (in nsIRunnable event, in unsigned long flags);
Trait Implementations
impl XpCom for nsISerialEventTarget
[src]
const IID: nsIID
IID: nsIID = nsID(2677547904, 9396, 18931, [136, 246, 69, 226, 149, 32, 54, 199])
fn query_interface<T: XpCom>(&self) -> Option<RefPtr<T>>
[src]
Perform a QueryInterface call on this object, attempting to dynamically cast it to the requested interface type. Returns Some(RefPtr) if the cast succeeded, and None otherwise. Read more
impl RefCounted for nsISerialEventTarget
[src]
unsafe fn addref(&self)
[src]
Increment the reference count.
unsafe fn release(&self)
[src]
Decrement the reference count, potentially freeing backing memory.
impl Deref for nsISerialEventTarget
[src]
type Target = nsIEventTarget
The resulting type after dereferencing.
fn deref(&self) -> &nsIEventTarget
[src]
Dereferences the value.