Skip to content

Commit 312f9ad

Browse files
[memoryprofiler] Add CSS class to parent div (#25595)
Add a CSS class to the main parent div of the memory profiler UI. Currently, the profiler's container div is created with no ID or class, making it impossible to target with CSS. This is problematic for developers (like in the original issue) who run their application in full-screen, as the profiler UI gets hidden with no way to adjust its `z-index`. This change adds the class `emscripten-memory-profiler-container` to the div upon its creation in `library_memoryprofiler.js`. This allows developers to easily style the profiler. For example: ``` <style> .emscripten-memory-profiler-container { z-index: 9999; } </style> ``` Fixes: #20115
1 parent 779c8f2 commit 312f9ad

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/memoryprofiler.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,7 @@ var emscriptenMemoryProfiler = {
272272
var div;
273273
if (!emscriptenMemoryProfiler.memoryprofiler_summary) {
274274
div = document.createElement("div");
275+
div.className = 'emscripten-memory-profiler-container';
275276
div.innerHTML = "<div style='border: 2px solid black; padding: 2px;'><canvas style='border: 1px solid black; margin-left: auto; margin-right: auto; display: block;' id='memoryprofiler_canvas' width='100%' height='50'></canvas><input type='checkbox' id='showHeapResizes' onclick='emscriptenMemoryProfiler.updateUi()'>Display heap and sbrk() resizes. Filter sbrk() and heap resize callstacks by keywords: <input type='text' id='sbrkFilter'>(reopen page with ?sbrkFilter=foo,bar query params to prepopulate this list)<br/>Track all allocation sites larger than <input id='memoryprofiler_min_tracked_alloc_size' type=number value="+emscriptenMemoryProfiler.trackedCallstackMinSizeBytes+"></input> bytes, and all allocation sites with more than <input id='memoryprofiler_min_tracked_alloc_count' type=number value="+emscriptenMemoryProfiler.trackedCallstackMinAllocCount+"></input> outstanding allocations. (visit this page via URL query params foo.html?trackbytes=1000&trackcount=100 to apply custom thresholds starting from page load)<br/><div id='memoryprofiler_summary'></div><input id='memoryprofiler_clear_alloc_stats' type='button' value='Clear alloc stats' ></input><br />Sort allocations by:<select id='memoryProfilerSort'><option value='bytes'>Bytes</option><option value='count'>Count</option><option value='fixed'>Fixed</option></select><div id='memoryprofiler_ptrs'></div>";
276277
}
277278
var populateHtmlBody = function() {

0 commit comments

Comments
 (0)