pub struct FrameMemory {
    allocator: Option<NonNull<FrameInnerAllocator>>,
    references_created: UnsafeCell<i32>,
}Expand description
The backing storage for FrameAllocator
This object is meant to be stored in the built frame and must not be dropped or
recycled before all allocations have been deallocated and all FrameAllocators
have been dropped. In other words, drop or recycle this after dropping the rest
of the built frame.
Fields§
§allocator: Option<NonNull<FrameInnerAllocator>>Safety: The pointed FrameInnerAllocator must not move or be deallocated
while there are live FrameAllocators pointing to it. This is ensured
by respecting that the FrameMemory is dropped last and by the
FrameInnerAllocator not being exposed to the outside world.
It is also checked at runtime via the reference count.
references_created: UnsafeCell<i32>The number of FrameAllocators created during the current frame. This is
used to compare aganst the inner allocator’s dropped references counter
to check that references have all been dropped before freeing or recycling
the memory.
Implementations§
Source§impl FrameMemory
 
impl FrameMemory
Sourcepub fn fallback() -> Self
 
pub fn fallback() -> Self
Creates a fallback FrameMemory that uses the global allocator.
This should only be used for testing purposes and to handle the deserialization of webrender recordings.
Sourcepub fn new(pool: Arc<ChunkPool>, _frame_id: FrameId) -> Self
 
pub fn new(pool: Arc<ChunkPool>, _frame_id: FrameId) -> Self
§Panics
A FrameMemory must not be dropped until all of the associated
FrameAllocators as well as their allocations have been dropped,
otherwise the FrameMemory::drop will panic.
Sourcepub fn allocator(&self) -> FrameAllocator
 
pub fn allocator(&self) -> FrameAllocator
Create a FrameAllocator for the current frame.
Sourcepub fn new_vec<T>(&self) -> Vec<T, FrameAllocator>
 
pub fn new_vec<T>(&self) -> Vec<T, FrameAllocator>
Shorthand for creating a FrameVec.
Sourcepub fn new_vec_with_capacity<T>(&self, cap: usize) -> Vec<T, FrameAllocator>
 
pub fn new_vec_with_capacity<T>(&self, cap: usize) -> Vec<T, FrameAllocator>
Shorthand for creating a FrameVec.
Sourcepub fn assert_memory_reusable(&self)
 
pub fn assert_memory_reusable(&self)
Panics if there are still live allocations or FrameAllocators.
pub fn get_stats(&self) -> Stats
Trait Implementations§
Source§impl Drop for FrameMemory
 
impl Drop for FrameMemory
Source§impl Serialize for FrameMemory
 
impl Serialize for FrameMemory
impl Send for FrameMemory
Auto Trait Implementations§
impl !Freeze for FrameMemory
impl !RefUnwindSafe for FrameMemory
impl !Sync for FrameMemory
impl Unpin for FrameMemory
impl UnwindSafe for FrameMemory
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> 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