mirror of
https://github.com/servo/servo.git
synced 2025-07-23 07:13:52 +01:00
Add back code to identify JSObjects that should be counted in memory profiling
This commit is contained in:
parent
cf68cd16bd
commit
3c8680f273
1 changed files with 9 additions and 0 deletions
|
@ -3,8 +3,10 @@
|
|||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use crate::dom::bindings::codegen::RegisterBindings;
|
||||
use crate::dom::bindings::conversions::is_dom_proxy;
|
||||
use crate::dom::bindings::proxyhandler;
|
||||
use crate::script_runtime::JSEngineSetup;
|
||||
use js::jsapi::JSObject;
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
#[allow(unsafe_code)]
|
||||
|
@ -49,6 +51,11 @@ fn perform_platform_specific_initialization() {
|
|||
#[cfg(not(target_os = "linux"))]
|
||||
fn perform_platform_specific_initialization() {}
|
||||
|
||||
#[allow(unsafe_code)]
|
||||
unsafe extern "C" fn is_dom_object(obj: *mut JSObject) -> bool {
|
||||
!obj.is_null() && is_dom_proxy(obj)
|
||||
}
|
||||
|
||||
#[allow(unsafe_code)]
|
||||
pub fn init() -> JSEngineSetup {
|
||||
unsafe {
|
||||
|
@ -57,6 +64,8 @@ pub fn init() -> JSEngineSetup {
|
|||
// 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();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue