1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 06:38:10 +00:00

Ladybird+LibWebView: Add -P/--enable-callgrind-profiling option

This adds a -P option to run Ladybird under callgrind. It starts with
instrumentation disabled. To start capturing a profile (once Ladybird
has launched) run `callgrind_control -i on` and to stop it again run
`callgrind_control -i off`.

P.s. This is pretty much stolen from Andreas (and is based on the patch
everyone [that wants a profile] have been manually applying).
This commit is contained in:
MacDue 2023-04-15 01:04:28 +01:00 committed by Andreas Kling
parent 5db1eb9961
commit 0329ddf46a
12 changed files with 52 additions and 26 deletions

View file

@ -18,6 +18,12 @@
namespace WebView {
// Note: This only exists inside Serenity to avoid #ifdefs in all implementors of ViewImplementation.
enum class EnableCallgrindProfiling {
No,
Yes
};
class ViewImplementation {
public:
virtual ~ViewImplementation() { }
@ -120,11 +126,12 @@ protected:
WebContentClient& client();
WebContentClient const& client() const;
virtual void create_client() = 0;
virtual void update_zoom() = 0;
virtual void create_client(EnableCallgrindProfiling = EnableCallgrindProfiling::No) {};
#if !defined(AK_OS_SERENITY)
ErrorOr<NonnullRefPtr<WebView::WebContentClient>> launch_web_content_process(ReadonlySpan<String> candidate_web_content_paths);
ErrorOr<NonnullRefPtr<WebView::WebContentClient>> launch_web_content_process(ReadonlySpan<String> candidate_web_content_paths, EnableCallgrindProfiling = EnableCallgrindProfiling::No);
#endif
struct SharedBitmap {