mirror of
https://github.com/servo/servo
synced 2026-04-25 17:15:48 +02:00
Reviewable per commits: As noted in https://github.com/servo/servo/pull/42180#discussion_r2749861902 transmuting `&Reflector<AssociatedMemory>` to `&Reflector<()>` will ignore AssociatedMemory information and thus it will not remove extra associated memory. By returning `&Reflector<Self::ReflectorType>` from `DomObject::reflector()` we will preserve this information and thus correctly handle cases with associated memory. We also do not need `overrideMemoryUsage` in bindings.conf anymore. 🎉 Instead of removing associated memory in drop code we should do it as part of finalizers, otherwise we have problems in nested (inherited) structs, where drop is run for both parent and child, but we only added associated memory for child (on init_reflector) which already included size of parent. The only exception here is promise, because it is RCed and not finalized. Testing: Tested locally that it fixes speedometer. Fixes #42269 --------- Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
93 lines
2.4 KiB
Rust
93 lines
2.4 KiB
Rust
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
|
|
|
#![cfg_attr(crown, feature(register_tool))]
|
|
#![deny(unsafe_code)]
|
|
#![doc = "The script crate contains all matters DOM."]
|
|
// Register the linter `crown`, which is the Servo-specific linter for the script crate.
|
|
#![cfg_attr(crown, register_tool(crown))]
|
|
|
|
// These are used a lot so let's keep them for now
|
|
#[macro_use]
|
|
extern crate js;
|
|
#[macro_use]
|
|
extern crate jstraceable_derive;
|
|
#[macro_use]
|
|
extern crate log;
|
|
#[macro_use]
|
|
extern crate malloc_size_of_derive;
|
|
#[macro_use]
|
|
extern crate stylo_atoms;
|
|
|
|
mod animation_timeline;
|
|
mod animations;
|
|
mod css;
|
|
mod script_window_proxies;
|
|
#[macro_use]
|
|
mod task;
|
|
mod body;
|
|
pub(crate) mod clipboard_provider;
|
|
pub(crate) mod conversions;
|
|
mod devtools;
|
|
pub(crate) mod document_loader;
|
|
#[macro_use]
|
|
mod dom;
|
|
pub(crate) use dom::canvas_context;
|
|
pub(crate) mod fetch;
|
|
pub(crate) mod indexeddb;
|
|
mod init;
|
|
mod layout_image;
|
|
|
|
pub(crate) mod document_collection;
|
|
pub(crate) mod iframe_collection;
|
|
pub(crate) mod image_animation;
|
|
pub mod layout_dom;
|
|
pub(crate) mod messaging;
|
|
mod microtask;
|
|
pub(crate) mod mime;
|
|
mod module_loading;
|
|
mod navigation;
|
|
mod network_listener;
|
|
mod realms;
|
|
mod routed_promise;
|
|
mod script_module;
|
|
mod script_mutation_observers;
|
|
pub(crate) mod script_runtime;
|
|
#[expect(unsafe_code)]
|
|
pub(crate) mod script_thread;
|
|
pub(crate) mod security_manager;
|
|
pub(crate) mod serviceworker_manager;
|
|
mod stylesheet_loader;
|
|
mod stylesheet_set;
|
|
mod task_manager;
|
|
mod task_queue;
|
|
mod task_source;
|
|
pub mod test;
|
|
pub mod textinput;
|
|
mod timers;
|
|
mod webdriver_handlers;
|
|
mod window_named_properties;
|
|
mod xpath;
|
|
|
|
mod unminify;
|
|
|
|
mod drag_data_store;
|
|
mod links;
|
|
|
|
pub use init::init;
|
|
pub(crate) use script_bindings::DomTypes;
|
|
pub use script_runtime::JSEngineSetup;
|
|
pub use script_thread::ScriptThread;
|
|
pub use serviceworker_manager::ServiceWorkerManager;
|
|
|
|
pub(crate) use crate::dom::bindings::codegen::DomTypeHolder::DomTypeHolder;
|
|
// These trait exports are public, because they are used in the DOM bindings.
|
|
// Since they are used in derive macros,
|
|
// it is useful that they are accessible at the root of the crate.
|
|
pub(crate) use crate::dom::bindings::inheritance::HasParent;
|
|
pub(crate) use crate::dom::bindings::reflector::{
|
|
AssociatedMemory, DomObject, MutDomObject, Reflector,
|
|
};
|
|
pub(crate) use crate::dom::bindings::trace::{CustomTraceable, JSTraceable};
|