[webkit-changes] [WebKit/WebKit] b3c5d4: Use of many shadow trees with unique style trigger...

Antti Koivisto noreply at github.com
Tue Oct 10 08:23:50 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: b3c5d420be05ac62170f8fd5550773eb54fb6c6f
      https://github.com/WebKit/WebKit/commit/b3c5d420be05ac62170f8fd5550773eb54fb6c6f
  Author: Antti Koivisto <antti at apple.com>
  Date:   2023-10-10 (Tue, 10 Oct 2023)

  Changed paths:
    M Source/WebCore/dom/InlineStyleSheetOwner.cpp
    M Source/WebCore/style/StyleScope.cpp

  Log Message:
  -----------
  Use of many shadow trees with unique style triggers significant CPU usage and a rise in process size
https://bugs.webkit.org/show_bug.cgi?id=260925
rdar://114731415

Reviewed by Alan Baradlay.

Style resolver sharing cache in Style::Scope has unlimited size and the test case keeps adding more items
there. Low memory handler clears the cache causing memory use to eventually drop.

* Source/WebCore/dom/InlineStyleSheetOwner.cpp:
(WebCore::InlineStyleSheetOwner::createSheet):

Increase the size of the inline stylesheet sharing cache  (50 -> 256 items). Content that uses many unique
shadow tree style (like this test) could overrun this smallish cache easily rendering it ineffective.

Style resolver sharing in Style::Scope depends on inline stylesheet getting shared so this also made
that cache work poorly.

* Source/WebCore/style/StyleScope.cpp:
(WebCore::Style::Scope::createOrFindSharedShadowTreeResolver):

Add a limit to the resolver sharing cache size.

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




More information about the webkit-changes mailing list