Skip to content

Commit 7494072

Browse files
tcl3awesomekling
authored andcommitted
LibWeb: Add an Internals method to dump the GC graph
1 parent ab00a4d commit 7494072

File tree

4 files changed

+12
-0
lines changed

4 files changed

+12
-0
lines changed

Libraries/LibWeb/Internals/Internals.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include <LibWeb/ARIA/StateAndProperties.h>
1414
#include <LibWeb/Bindings/InternalsPrototype.h>
1515
#include <LibWeb/Bindings/Intrinsics.h>
16+
#include <LibWeb/Bindings/MainThreadVM.h>
1617
#include <LibWeb/DOM/Document.h>
1718
#include <LibWeb/DOM/Event.h>
1819
#include <LibWeb/DOM/EventTarget.h>
@@ -342,6 +343,11 @@ String Internals::dump_display_list()
342343
return window().associated_document().dump_display_list();
343344
}
344345

346+
String Internals::dump_gc_graph()
347+
{
348+
return Bindings::main_thread_vm().heap().dump_graph().serialized();
349+
}
350+
345351
GC::Ptr<DOM::ShadowRoot> Internals::get_shadow_root(GC::Ref<DOM::Element> element)
346352
{
347353
return element->shadow_root();

Libraries/LibWeb/Internals/Internals.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ class WEB_API Internals final : public InternalsBase {
6868
bool headless();
6969

7070
String dump_display_list();
71+
String dump_gc_graph();
7172

7273
GC::Ptr<DOM::ShadowRoot> get_shadow_root(GC::Ref<DOM::Element>);
7374

Libraries/LibWeb/Internals/Internals.idl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ interface Internals {
5757
readonly attribute boolean headless;
5858

5959
DOMString dumpDisplayList();
60+
DOMString dumpGCGraph();
6061

6162
// Returns the shadow root of the element, if it has one, even if it's not normally accessible to JS.
6263
ShadowRoot? getShadowRoot(Element element);
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<!DOCTYPE html>
2+
<script>
3+
internals.dumpGCGraph();
4+
</script>

0 commit comments

Comments
 (0)