Repository: LadybirdBrowser/ladybird
File: Services/WebContent/PageClient.h (C/C++)

Code before:
    virtual void page_did_finish_test(String const& text) override;
    virtual void page_did_set_test_timeout(double milliseconds) override;
    virtual void page_did_receive_reference_test_metadata(JsonValue) override;
    virtual void page_did_set_browser_zoom(double factor) override;
    virtual void page_did_change_theme_color(Gfx::Color color) override;
    virtual void page_did_insert_clipboard_entry(Web::Clipboard::SystemClipboardRepresentation const&, StringView presentation_style) override;
    virtual void page_did_request_clipboard_entries(u64 request_id) override;
    virtual void page_did_change_audio_play_state(Web::HTML::AudioPlayState) override;
    virtual void page_did_allocate_backing_stores(i32 front_bitmap_id, Gfx::ShareableBitmap front_bitmap, i32 back_bitmap_id, Gfx::ShareableBitmap back_bitmap) override;
    virtual IPC::File request_worker_agent(Web::Bindings::AgentType) override;
    virtual void page_did_mutate_dom(FlyString const& type, Web::DOM::Node const& target, Web::DOM::NodeList& added_nodes, Web::DOM::NodeList& removed_nodes, GC::Ptr<Web::DOM::Node> previous_sibling, GC::Ptr<Web::DOM::Node> next_sibling, Optional<String> const& attribute_name) override;
    virtual void page_did_paint(Gfx::IntRect const& content_rect, i32 bitmap_id) override;
    virtual void page_did_take_screenshot(Gfx::ShareableBitmap const& screenshot) override;
    virtual void received_message_from_web_ui(String const& name, JS::Value data) override;
    virtual void page_did_start_network_request(u64 request_id, URL::URL const&, ByteString const&, Vector<HTTP::Header> const&, ReadonlyBytes, Optional<String>) override;
    virtual void page_did_receive_network_response_headers(u64 request_id, u32 status_code, Optional<String>, Vector<HTTP::Header> const&) override;
    virtual void page_did_receive_network_response_body(u64 request_id, ReadonlyBytes) override;
    virtual void page_did_finish_network_request(u64 request_id, u64 body_size, Requests::RequestTimingInfo const&, Optional<Requests::NetworkError> const&) override;

    void setup_palette();
    ConnectionFromClient& client() const;

    PageHost& m_owner;
    GC::Ref<Web::Page> m_page;
    RefPtr<Gfx::PaletteImpl> m_palette_impl;
    Vector<Web::DevicePixelRect, 4> m_all_screen_rects { Web::DevicePixelRect {} };
    size_t m_main_screen_index { 0 };
    double m_device_pixel_ratio { 1.0 };
    double m_zoom_level { 1.0 };
    double m_maximum_frames_per_second { 60.0 };
    u64 m_id { 0 };
    bool m_has_focus { false };

    Web::CSS::PreferredColorScheme m_preferred_color_scheme { Web::CSS::PreferredColorScheme::Auto };
    Web::CSS::PreferredContrast m_preferred_contrast { Web::CSS::PreferredContrast::NoPreference };
    Web::CSS::PreferredMotion m_preferred_motion { Web::CSS::PreferredMotion::NoPreference };

    RefPtr<WebDriverConnection> m_webdriver;
    RefPtr<WebUIConnection> m_web_ui;

    WeakPtr<WebContentConsoleClient> m_top_level_document_console_client;

    GC::Root<JS::GlobalObject> m_console_global_object;

    RefPtr<Core::Timer> m_paint_refresh_timer;

    u64 m_devtools_client_count { 0 };
};

}


Review comment (performance):
Not sure if you need the inline size of `4` here at all; as long as we're not limited in performance on the setter and moving vector around, I think we'll do just fine with a `Vector<Web::DevicePixelRect>`.

Code after:
    virtual void page_did_finish_test(String const& text) override;
    virtual void page_did_set_test_timeout(double milliseconds) override;
    virtual void page_did_receive_reference_test_metadata(JsonValue) override;
    virtual void page_did_receive_test_variant_metadata(JsonValue) override;
    virtual void page_did_set_browser_zoom(double factor) override;
    virtual void page_did_change_theme_color(Gfx::Color color) override;
    virtual void page_did_insert_clipboard_entry(Web::Clipboard::SystemClipboardRepresentation const&, StringView presentation_style) override;
    virtual void page_did_request_clipboard_entries(u64 request_id) override;
    virtual void page_did_change_audio_play_state(Web::HTML::AudioPlayState) override;
    virtual void page_did_allocate_backing_stores(i32 front_bitmap_id, Gfx::ShareableBitmap front_bitmap, i32 back_bitmap_id, Gfx::ShareableBitmap back_bitmap) override;
    virtual IPC::File request_worker_agent(Web::Bindings::AgentType) override;
    virtual void page_did_mutate_dom(FlyString const& type, Web::DOM::Node const& target, Web::DOM::NodeList& added_nodes, Web::DOM::NodeList& removed_nodes, GC::Ptr<Web::DOM::Node> previous_sibling, GC::Ptr<Web::DOM::Node> next_sibling, Optional<String> const& attribute_name) override;
    virtual void page_did_paint(Gfx::IntRect const& content_rect, i32 bitmap_id) override;
    virtual void page_did_take_screenshot(Gfx::ShareableBitmap const& screenshot) override;
    virtual void received_message_from_web_ui(String const& name, JS::Value data) override;
    virtual void page_did_start_network_request(u64 request_id, URL::URL const&, ByteString const&, Vector<HTTP::Header> const&, ReadonlyBytes, Optional<String>) override;
    virtual void page_did_receive_network_response_headers(u64 request_id, u32 status_code, Optional<String>, Vector<HTTP::Header> const&) override;
    virtual void page_did_receive_network_response_body(u64 request_id, ReadonlyBytes) override;
    virtual void page_did_finish_network_request(u64 request_id, u64 body_size, Requests::RequestTimingInfo const&, Optional<Requests::NetworkError> const&) override;

    void setup_palette();
    ConnectionFromClient& client() const;

    PageHost& m_owner;
    GC::Ref<Web::Page> m_page;
    RefPtr<Gfx::PaletteImpl> m_palette_impl;
    Vector<Web::DevicePixelRect> m_all_screen_rects { Web::DevicePixelRect {} };
    size_t m_main_screen_index { 0 };
    double m_device_pixel_ratio { 1.0 };
    double m_zoom_level { 1.0 };
    double m_maximum_frames_per_second { 60.0 };
    u64 m_id { 0 };
    bool m_has_focus { false };

    Web::CSS::PreferredColorScheme m_preferred_color_scheme { Web::CSS::PreferredColorScheme::Auto };
    Web::CSS::PreferredContrast m_preferred_contrast { Web::CSS::PreferredContrast::NoPreference };
    Web::CSS::PreferredMotion m_preferred_motion { Web::CSS::PreferredMotion::NoPreference };

    RefPtr<WebDriverConnection> m_webdriver;
    RefPtr<WebUIConnection> m_web_ui;

    WeakPtr<WebContentConsoleClient> m_top_level_document_console_client;

    GC::Root<JS::GlobalObject> m_console_global_object;

    RefPtr<Core::Timer> m_paint_refresh_timer;

    u64 m_devtools_client_count { 0 };
};

}