mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 03:15:11 +00:00
Bug 1655298 - Pass in MallocSizeOfOps to reporter. r=gw
Just passing this along with the report is easier than trying to store these functions some place as we do in other places. These ops aren't used yet but will be in subsequent patches. There's a bit of ugly around the bindings because of a cbindgen limitation. Differential Revision: https://phabricator.services.mozilla.com/D84916
This commit is contained in:
parent
e67129e6ad
commit
78402acff4
1
Cargo.lock
generated
1
Cargo.lock
generated
@ -5585,6 +5585,7 @@ dependencies = [
|
||||
"uuid",
|
||||
"webrender",
|
||||
"winapi 0.3.7",
|
||||
"wr_malloc_size_of",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -22,6 +22,7 @@ uuid = { version = "0.8", features = ["v4"] }
|
||||
fxhash = "0.2.1"
|
||||
thin-vec = { version = "0.1.0", features = ["gecko-ffi"] }
|
||||
swgl = { path = "../wr/swgl" }
|
||||
wr_malloc_size_of = { path = "../wr/wr_malloc_size_of" }
|
||||
|
||||
[dependencies.webrender]
|
||||
path = "../wr/webrender"
|
||||
|
@ -566,7 +566,8 @@ void WebRenderAPI::NotifyMemoryPressure() {
|
||||
}
|
||||
|
||||
void WebRenderAPI::AccumulateMemoryReport(MemoryReport* aReport) {
|
||||
wr_api_accumulate_memory_report(mDocHandle, aReport);
|
||||
wr_api_accumulate_memory_report(mDocHandle, aReport, &WebRenderMallocSizeOf,
|
||||
&WebRenderMallocEnclosingSizeOf);
|
||||
}
|
||||
|
||||
void WebRenderAPI::WakeSceneBuilder() { wr_api_wake_scene_builder(mDocHandle); }
|
||||
|
@ -39,6 +39,7 @@ use webrender::{
|
||||
NativeTileId, PipelineInfo, ProfilerHooks, RecordedFrameHandle, Renderer, RendererOptions, RendererStats,
|
||||
SceneBuilderHooks, ShaderPrecacheFlags, Shaders, ThreadListener, UploadMethod, WrShaders, ONE_TIME_USAGE_HINT,
|
||||
};
|
||||
use wr_malloc_size_of::MallocSizeOfOps;
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
use core_foundation::string::CFString;
|
||||
@ -1611,8 +1612,15 @@ pub extern "C" fn wr_api_set_debug_flags(dh: &mut DocumentHandle, flags: DebugFl
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn wr_api_accumulate_memory_report(dh: &mut DocumentHandle, report: &mut MemoryReport) {
|
||||
*report += dh.api.report_memory();
|
||||
pub unsafe extern "C" fn wr_api_accumulate_memory_report(
|
||||
dh: &mut DocumentHandle,
|
||||
report: &mut MemoryReport,
|
||||
// we manually expand VoidPtrToSizeFn here because cbindgen otherwise fails to fold the Option<fn()>
|
||||
// https://github.com/eqrion/cbindgen/issues/552
|
||||
size_of_op: unsafe extern "C" fn(ptr: *const c_void) -> usize,
|
||||
enclosing_size_of_op: Option<unsafe extern "C" fn(ptr: *const c_void) -> usize>) {
|
||||
let ops = MallocSizeOfOps::new(size_of_op, enclosing_size_of_op);
|
||||
*report += dh.api.report_memory(ops);
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
|
@ -17,6 +17,7 @@ extern crate thin_vec;
|
||||
extern crate tracy_rs;
|
||||
extern crate uuid;
|
||||
extern crate webrender;
|
||||
extern crate wr_malloc_size_of;
|
||||
|
||||
#[macro_use]
|
||||
extern crate log;
|
||||
|
@ -1543,7 +1543,7 @@ impl RenderApi {
|
||||
}
|
||||
|
||||
/// Synchronously requests memory report.
|
||||
pub fn report_memory(&self) -> MemoryReport {
|
||||
pub fn report_memory(&self, _ops: malloc_size_of::MallocSizeOfOps) -> MemoryReport {
|
||||
let (tx, rx) = channel();
|
||||
self.api_sender.send(ApiMsg::ReportMemory(tx)).unwrap();
|
||||
*rx.recv().unwrap()
|
||||
|
Loading…
Reference in New Issue
Block a user