diff options
author | Anthony Weston <anthonyelliotweston@gmail.com> | 2018-03-18 21:20:20 -0400 |
---|---|---|
committer | Anthony Weston <anthonyelliotweston@gmail.com> | 2018-03-27 20:35:39 -0400 |
commit | 7f7fc917586fa5ea9c0681f7a479c7ec8ad69019 (patch) | |
tree | f0896fbfdf6d623e6ffc03c28716fef2491d6412 /components/script/lib.rs | |
parent | 97c12bd3927c057d5610b0295f0e8320b64af5e5 (diff) | |
download | servo-7f7fc917586fa5ea9c0681f7a479c7ec8ad69019.tar.gz servo-7f7fc917586fa5ea9c0681f7a479c7ec8ad69019.zip |
Pass new method in CollectServoSizes for accurate DOM heap use reporting
Diffstat (limited to 'components/script/lib.rs')
-rw-r--r-- | components/script/lib.rs | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/components/script/lib.rs b/components/script/lib.rs index 882933ac5c9..02a86ee4d5d 100644 --- a/components/script/lib.rs +++ b/components/script/lib.rs @@ -107,7 +107,6 @@ extern crate xml5ever; #[macro_use] mod task; - mod body; pub mod clipboard_provider; mod devtools; @@ -150,7 +149,10 @@ pub mod layout_exports { } use dom::bindings::codegen::RegisterBindings; +use dom::bindings::conversions::is_dom_proxy; use dom::bindings::proxyhandler; +use dom::bindings::utils::is_platform_object; +use js::jsapi::JSObject; use script_traits::SWManagerSenders; use serviceworker_manager::ServiceWorkerManager; @@ -201,6 +203,11 @@ pub fn init_service_workers(sw_senders: SWManagerSenders) { } #[allow(unsafe_code)] +unsafe extern "C" fn is_dom_object(obj: *mut JSObject) -> bool { + !obj.is_null() && (is_platform_object(obj) || is_dom_proxy(obj)) +} + +#[allow(unsafe_code)] pub fn init() { unsafe { proxyhandler::init(); @@ -208,6 +215,8 @@ pub fn init() { // Create the global vtables used by the (generated) DOM // bindings to implement JS proxies. RegisterBindings::RegisterProxyHandlers(); + + js::glue::InitializeMemoryReporter(Some(is_dom_object)); } perform_platform_specific_initialization(); |