mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Replace all uses of the heapsize
crate with malloc_size_of
.
Servo currently uses `heapsize`, but Stylo/Gecko use `malloc_size_of`. `malloc_size_of` is better -- it handles various cases that `heapsize` does not -- so this patch changes Servo to use `malloc_size_of`. This patch makes the following changes to the `malloc_size_of` crate. - Adds `MallocSizeOf` trait implementations for numerous types, some built-in (e.g. `VecDeque`), some external and Servo-only (e.g. `string_cache`). - Makes `enclosing_size_of_op` optional, because vanilla jemalloc doesn't support that operation. - For `HashSet`/`HashMap`, falls back to a computed estimate when `enclosing_size_of_op` isn't available. - Adds an extern "C" `malloc_size_of` function that does the actual heap measurement; this is based on the same functions from the `heapsize` crate. This patch makes the following changes elsewhere. - Converts all the uses of `heapsize` to instead use `malloc_size_of`. - Disables the "heapsize"/"heap_size" feature for the external crates that provide it. - Removes the `HeapSizeOf` implementation from `hashglobe`. - Adds `ignore` annotations to a few `Rc`/`Arc`, because `malloc_size_of` doesn't derive those types, unlike `heapsize`.
This commit is contained in:
parent
421baa854e
commit
4506f0d30c
269 changed files with 1418 additions and 1521 deletions
|
@ -135,7 +135,7 @@ fn has_invalid_blend_constants(arg1: u32, arg2: u32) -> bool {
|
|||
|
||||
/// Set of bitflags for texture unpacking (texImage2d, etc...)
|
||||
bitflags! {
|
||||
#[derive(HeapSizeOf, JSTraceable)]
|
||||
#[derive(JSTraceable, MallocSizeOf)]
|
||||
flags TextureUnpacking: u8 {
|
||||
const FLIP_Y_AXIS = 0x01,
|
||||
const PREMULTIPLY_ALPHA = 0x02,
|
||||
|
@ -145,7 +145,7 @@ bitflags! {
|
|||
|
||||
/// Information about the bound textures of a WebGL texture unit.
|
||||
#[must_root]
|
||||
#[derive(HeapSizeOf, JSTraceable)]
|
||||
#[derive(JSTraceable, MallocSizeOf)]
|
||||
struct TextureUnitBindings {
|
||||
bound_texture_2d: MutNullableDom<WebGLTexture>,
|
||||
bound_texture_cube_map: MutNullableDom<WebGLTexture>,
|
||||
|
@ -181,15 +181,15 @@ impl TextureUnitBindings {
|
|||
#[dom_struct]
|
||||
pub struct WebGLRenderingContext {
|
||||
reflector_: Reflector,
|
||||
#[ignore_heap_size_of = "Channels are hard"]
|
||||
#[ignore_malloc_size_of = "Channels are hard"]
|
||||
webgl_sender: WebGLMsgSender,
|
||||
#[ignore_heap_size_of = "Defined in webrender"]
|
||||
#[ignore_malloc_size_of = "Defined in webrender"]
|
||||
webrender_image: Cell<Option<webrender_api::ImageKey>>,
|
||||
share_mode: WebGLContextShareMode,
|
||||
#[ignore_heap_size_of = "Defined in offscreen_gl_context"]
|
||||
#[ignore_malloc_size_of = "Defined in offscreen_gl_context"]
|
||||
limits: GLLimits,
|
||||
canvas: Dom<HTMLCanvasElement>,
|
||||
#[ignore_heap_size_of = "Defined in canvas_traits"]
|
||||
#[ignore_malloc_size_of = "Defined in canvas_traits"]
|
||||
last_error: Cell<Option<WebGLError>>,
|
||||
texture_unpacking_settings: Cell<TextureUnpacking>,
|
||||
texture_unpacking_alignment: Cell<u32>,
|
||||
|
@ -201,11 +201,11 @@ pub struct WebGLRenderingContext {
|
|||
bound_buffer_element_array: MutNullableDom<WebGLBuffer>,
|
||||
bound_attrib_buffers: DomRefCell<FnvHashMap<u32, Dom<WebGLBuffer>>>,
|
||||
current_program: MutNullableDom<WebGLProgram>,
|
||||
#[ignore_heap_size_of = "Because it's small"]
|
||||
#[ignore_malloc_size_of = "Because it's small"]
|
||||
current_vertex_attrib_0: Cell<(f32, f32, f32, f32)>,
|
||||
#[ignore_heap_size_of = "Because it's small"]
|
||||
#[ignore_malloc_size_of = "Because it's small"]
|
||||
current_scissor: Cell<(i32, i32, i32, i32)>,
|
||||
#[ignore_heap_size_of = "Because it's small"]
|
||||
#[ignore_malloc_size_of = "Because it's small"]
|
||||
current_clear_color: Cell<(f32, f32, f32, f32)>,
|
||||
extension_manager: WebGLExtensions,
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue