Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: a836f7d0d68af50c503f55fa0358e6bed9d99fe1
      
https://github.com/WebKit/WebKit/commit/a836f7d0d68af50c503f55fa0358e6bed9d99fe1
  Author: Rupin Mittal <ru...@apple.com>
  Date:   2025-08-19 (Tue, 19 Aug 2025)

  Changed paths:
    M Source/WebCore/history/BackForwardClient.h
    M Source/WebCore/history/BackForwardController.cpp
    M Source/WebCore/loader/EmptyClients.cpp
    M Source/WebKit/UIProcess/WebBackForwardList.h
    M Source/WebKit/UIProcess/WebPageProxy.cpp
    M Source/WebKit/UIProcess/WebPageProxy.h
    M Source/WebKit/UIProcess/WebPageProxy.messages.in
    M Source/WebKit/WebProcess/WebPage/WebBackForwardListProxy.cpp
    M Source/WebKit/WebProcess/WebPage/WebBackForwardListProxy.h
    M Source/WebKitLegacy/mac/History/BackForwardList.h

  Log Message:
  -----------
  Navigation API is making O(# entries in back forward list) sync IPC calls 
each time a document is created
https://bugs.webkit.org/show_bug.cgi?id=297571
rdar://158648936

Reviewed by Charlie Wolfe.

When a new navigation object is created, we need to initialize
it's history entries. Back in the initial implementation of the
Navigation API in https://commits.webkit.org/273532@main,
this was done by getting each individual entry by calling
WebBackForwardListProxy::itemAtIndex(). This gets the entry
by making a sync IPC to the UIProcess.

This means every time we make a new navigation object (which
is every time a new document is created), we are making a sync
IPC call for each individual entry in the back forward list.

This is not great for performance.

We fix this by adding a new IPC to allow us to get the whole list at
once. From testing, this reduces the PLT regression caused by enabling
the Navigation API by almost 2% (16.2% --> 14.6%).

To fully eliminate the remaining 15% regression, we'll need to
completely eliminate this IPC or make it async. I'm not yet sure
how to remove this call or make it async since a second navigation
happening before the async call finishing would mean the list of
entries is corrupted. Still, this is useful since a single IPC is
better than many. It reduces the regression a bit and allItems()
is called other places as well.

No new tests as this doesn't change user-facing behavior, just
improves performance.

* Source/WebCore/history/BackForwardClient.h:
* Source/WebCore/history/BackForwardController.cpp:
(WebCore::BackForwardController::allItems):

Instead of first making a sync IPC to get the backCount and then
making a sync IPC via itemForIndex() to get each item, call the
new WebBackForwardListProxy::allItems() function which will get
all the items with a single sync IPC call.

* Source/WebCore/loader/EmptyClients.cpp:
* Source/WebKit/UIProcess/WebBackForwardList.h:
(WebKit::WebBackForwardList::allItems const):
* Source/WebKit/UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::backForwardAllItems):

New function that returns all the items in the back forward list.

* Source/WebKit/UIProcess/WebPageProxy.h:
* Source/WebKit/UIProcess/WebPageProxy.messages.in:
* Source/WebKit/WebProcess/WebPage/WebBackForwardListProxy.cpp:
(WebKit::WebBackForwardListProxy::allItems):

This will make the IPC from the Web Process to the UI Process
to get all the items from WebPageProxy::backForwardAllItems().

* Source/WebKit/WebProcess/WebPage/WebBackForwardListProxy.h:
* Source/WebKitLegacy/mac/History/BackForwardList.h:

Canonical link: https://commits.webkit.org/298922@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to